Win32OperatingSystem.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Mar 2004 00:05:08 +0100
changeset 8118 efc99c0f68bc
parent 8078 dc95f02fa4c5
child 8172 14f6383d7da0
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     1
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
     3
 COPYRIGHT (c) 1998-2004 by eXept Software AG
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
     4
	      All Rights Reserved
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     5
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     6
 This software is furnished under a license and may be used
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     7
 only in accordance with the terms of that license and with the
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     8
 inclusion of the above copyright notice.   This software may not
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
     9
 be provided or otherwise made available to, or used by, any
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    10
 other person.  No title to or ownership of the software is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    11
 hereby transferred.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    12
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    13
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
    14
"{ Package: 'stx:libbasic' }"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
    15
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    16
AbstractOperatingSystem subclass:#Win32OperatingSystem
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    17
	instanceVariableNames:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    18
	classVariableNames:'HostName DomainName CurrentDirectory'
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    19
	poolDictionaries:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    20
	category:'OS-Windows'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    21
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    22
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
    23
Object subclass:#FileStatusInfo
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    24
	instanceVariableNames:'type mode uid gid size id accessed modified created statusChanged
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    25
		path fullName alternativeName'
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    26
	classVariableNames:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    27
	poolDictionaries:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    28
	privateIn:Win32OperatingSystem
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    29
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    30
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    31
Object subclass:#OSProcessStatus
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    32
	instanceVariableNames:'pid status code core'
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    33
	classVariableNames:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    34
	poolDictionaries:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    35
	privateIn:Win32OperatingSystem
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    36
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    37
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
    38
Object subclass:#RegistryEntry
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    39
	instanceVariableNames:'path handle'
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    40
	classVariableNames:'Lobby HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    41
		HKEY_USERS HKEY_PERFORMANCE_DATA HKEY_CURRENT_CONFIG
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    42
		HKEY_DYN_DATA'
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    43
	poolDictionaries:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    44
	privateIn:Win32OperatingSystem
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    45
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    46
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
    47
OSFileHandle subclass:#Win32FILEHandle
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    48
	instanceVariableNames:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    49
	classVariableNames:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    50
	poolDictionaries:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    51
	privateIn:Win32OperatingSystem
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
    52
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
    53
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
    54
OSFileHandle subclass:#Win32Handle
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    55
	instanceVariableNames:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    56
	classVariableNames:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    57
	poolDictionaries:''
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    58
	privateIn:Win32OperatingSystem
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
    59
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
    60
7749
abfd41c7d264 missing method for windows
Stefan Vogel <sv@exept.de>
parents: 7720
diff changeset
    61
Win32OperatingSystem::Win32Handle subclass:#Win32ProcessHandle
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
    62
	instanceVariableNames:''
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
    63
	classVariableNames:''
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
    64
	poolDictionaries:''
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
    65
	privateIn:Win32OperatingSystem
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
    66
!
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
    67
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    68
!Win32OperatingSystem primitiveDefinitions!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    69
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    70
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    71
/*
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    72
 * if DO_WRAP_CALLS is not defined, API-calls are performed directly
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    73
 * if it is, they are performed by another thread.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    74
 * The system does not work correctly without wrapCalls.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    75
 */
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
    76
# ifndef DO_WRAP_CALLS
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    77
#  define STX_C_CALL0(__nm__, __f__)                                            __f__( )
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    78
#  define STX_C_CALL1(__nm__, __f__, __a1__)                                    __f__((__a1__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    79
#  define STX_C_CALL2(__nm__, __f__, __a1__, __a2__)                            __f__((__a1__), (__a2__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    80
#  define STX_C_CALL3(__nm__, __f__, __a1__, __a2__, __a3__)                    __f__((__a1__), (__a2__), (__a3__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    81
#  define STX_API_CALL0(__nm__, __f__)                                          __f__( )
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    82
#  define STX_API_CALL1(__nm__, __f__, __a1__)                                  __f__((__a1__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    83
#  define STX_API_CALL2(__nm__, __f__, __a1__, __a2__)                          __f__((__a1__), (__a2__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    84
#  define STX_API_CALL3(__nm__, __f__, __a1__, __a2__, __a3__)                  __f__((__a1__), (__a2__), (__a3__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    85
#  define STX_API_CALL4(__nm__, __f__, __a1__, __a2__, __a3__, __a4__)          __f__((__a1__), (__a2__), (__a3__), (__a4__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    86
#  define STX_API_CALL5(__nm__, __f__, __a1__, __a2__, __a3__, __a4__, __a5__)  __f__((__a1__), (__a2__), (__a3__), (__a4__), (__a5__))
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
    87
# else
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    88
#  define STX_C_CALL0(__nm__, __f__)                                            __STX_C_CALL0(__nm__, (void*)__f__)
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    89
#  define STX_C_CALL1(__nm__, __f__, __a1__)                                    __STX_C_CALL1(__nm__, (void*)__f__, (void*)(__a1__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    90
#  define STX_C_CALL2(__nm__, __f__, __a1__, __a2__)                            __STX_C_CALL2(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    91
#  define STX_C_CALL3(__nm__, __f__, __a1__, __a2__, __a3__)                    __STX_C_CALL3(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    92
#  define STX_API_CALL0(__nm__, __f__)                                          __STX_API_CALL0(__nm__, (void*)__f__)
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    93
#  define STX_API_CALL1(__nm__, __f__, __a1__)                                  __STX_API_CALL1(__nm__, (void*)__f__, (void*)(__a1__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    94
#  define STX_API_CALL2(__nm__, __f__, __a1__, __a2__)                          __STX_API_CALL2(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    95
#  define STX_API_CALL3(__nm__, __f__, __a1__, __a2__, __a3__)                  __STX_API_CALL3(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    96
#  define STX_API_CALL4(__nm__, __f__, __a1__, __a2__, __a3__, __a4__)          __STX_API_CALL4(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__), (void*)(__a4__))
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    97
#  define STX_API_CALL5(__nm__, __f__, __a1__, __a2__, __a3__, __a4__, __a5__)  __STX_API_CALL5(__nm__, (void*)__f__, (void*)(__a1__), (void*)(__a2__), (void*)(__a3__), (void*)(__a4__), (void*)(__a5__))
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
    98
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    99
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   100
# ifndef MSDOS_LIKE    /* windows is not a real operating system */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   101
#  define MSDOS_LIKE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   102
# endif
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   103
# undef UNIX_LIKE       
6095
fd28101edf09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5922
diff changeset
   104
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   105
# ifdef i386
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   106
#  ifndef _X86_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   107
#   define _X86_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   108
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   109
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   110
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   111
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   112
 * notice: although many systems' include files
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   113
 * already block against multiple inclusion, some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   114
 * do not. Therefore, this is done here again.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   115
 * (it does not hurt)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   116
 */ 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   117
# ifndef _SIGNAL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   118
#  include <signal.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   119
#  define _SIGNAL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   120
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   121
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   122
# ifndef _SYS_TYPES_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   123
#  include <sys/types.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   124
#  define _SYS_TYPES_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   125
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   126
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   127
# ifndef _TIME_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   128
#  include <time.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   129
#  define _TIME_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   130
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   131
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   132
# ifndef _SYS_TIMEB_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   133
#  include <sys/timeb.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   134
#  define _SYS_TIMEB_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   135
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   136
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   137
# ifndef _SYS_STAT_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   138
#  include <sys/stat.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   139
#  define _SYS_STAT_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   140
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   141
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   142
# ifndef _ERRNO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   143
#  include <errno.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   144
#  define _ERRNO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   145
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   146
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   147
# ifndef _STDIO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   148
#  include <stdio.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   149
#  define _STDIO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   150
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   151
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   152
# ifndef _FCNTL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   153
#  include <fcntl.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   154
#  define _FCNTL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   155
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   156
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   157
/* # define PROCESSDEBUGWIN32     /* */
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   158
/* # define PROCESS1DEBUGWIN32    /* */
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   159
/* # define PROCESS2DEBUGWIN32    /* */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   160
/* # define SELECTDEBUGWIN32     /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   161
/* # define SELECT1DEBUGWIN32    /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   162
/* # define SELECT2DEBUGWIN32    /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   163
/* # define WAITDEBUGWIN32       /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   164
/* # define SIGNALDEBUGWIN32     /* */
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   165
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   166
# undef INT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   167
# undef Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   168
# undef Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   169
# undef Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   170
# undef Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   171
# undef Rectangle
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   172
# undef Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   173
# undef String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   174
# undef Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   175
# undef Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   176
# undef Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   177
# undef Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   178
# undef Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   179
# undef Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   180
# undef Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   181
# undef Delay
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   182
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   183
/* # define NO_GETADAPTERSINFO
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   184
*/
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
   185
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   186
# include <stdarg.h> /* */
7531
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   187
# ifndef WINDOWS_H_INCLUDED
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   188
#  define WINDOWS_H_INCLUDED
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   189
#  include <windows.h>
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   190
# endif
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   191
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
   192
# ifndef NO_GETADAPTERSINFO
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   193
#  include <iphlpapi.h>
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
   194
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   195
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   196
# if !defined(__BORLANDC__)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   197
#  undef stat
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   198
#  define stat _stat
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   199
#  undef chmod
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   200
#  define chmod _chmod
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   201
#  undef access
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   202
#  define access _access
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   203
#  define MAXFILELEN 256
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   204
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   205
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   206
# ifdef __DEF_Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   207
#  define Array __DEF_Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   208
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   209
# ifdef __DEF_Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   210
#  define Number __DEF_Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   211
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   212
# ifdef __DEF_Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   213
#  define Method __DEF_Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   214
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   215
# ifdef __DEF_Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   216
#  define Point __DEF_Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   217
# endif
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   218
# ifdef __DEF_Rectangle
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   219
#  define Rectangle __DEF_Rectangle
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   220
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   221
# ifdef __DEF_Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   222
#  define Block __DEF_Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   223
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   224
# ifdef __DEF_String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   225
#  define String __DEF_String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   226
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   227
# ifdef __DEF_Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   228
#  define Message __DEF_Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   229
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   230
# ifdef __DEF_Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   231
#  define Object __DEF_Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   232
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   233
# ifdef __DEF_Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   234
#  define Context __DEF_Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   235
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   236
# ifdef __DEF_Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   237
#  define Date __DEF_Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   238
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   239
# ifdef __DEF_Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   240
#  define Time __DEF_Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   241
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   242
# ifdef __DEF_Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   243
#  define Set __DEF_Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   244
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   245
# ifdef __DEF_Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   246
#  define Signal __DEF_Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   247
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   248
# ifdef __DEF_Delay
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   249
#  define Delay __DEF_Delay
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   250
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   251
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   252
# define INT int
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   253
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   254
typedef int (*intf)(int);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   255
BOOL __signalUserInterruptWIN32(DWORD sig);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   256
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   257
# if defined (HAS_LOCALECONV)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   258
#  ifndef _LOCALE_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   259
#   include <locale.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   260
#   define _LOCALE_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   261
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   262
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   263
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   264
/* 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   265
 * posix systems should define these ... 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   266
 * but on some (older) systems, they are not.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   267
 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   268
# ifndef S_IXUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   269
#  ifdef S_IEXEC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   270
#   define S_IXUSR S_IEXEC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   271
#   define S_IXGRP (S_IEXEC>>3)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   272
#   define S_IXOTH (S_IEXEC>>6)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   273
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   274
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   275
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   276
# ifndef S_IXUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   277
#  define S_IXUSR 0100
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   278
#  define S_IXGRP 0010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   279
#  define S_IXOTH 0001
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   280
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   281
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   282
# ifndef S_IRUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   283
#  define S_IRUSR 0400
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   284
#  define S_IRGRP 0040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   285
#  define S_IROTH 0004
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   286
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   287
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   288
# ifndef S_IWUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   289
#  define S_IWUSR 0200
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   290
#  define S_IWGRP 0020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   291
#  define S_IWOTH 0002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   292
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   293
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   294
# ifdef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   295
#  include <dir.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   296
#  define MAXPATHLEN MAXPATH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   297
#  define MAXFILELEN MAXFILE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   298
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   299
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   300
# ifndef MAXPATHLEN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   301
#  ifndef MSDOS_LIKE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   302
#   ifndef NO_SYS_PARAM_H
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   303
#    include <sys/param.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   304
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   305
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   306
#  ifndef MAXPATHLEN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   307
#   ifdef FILENAME_MAX  /* i.e. MSDOS_LIKE */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   308
#    define MAXPATHLEN FILENAME_MAX
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   309
#   else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   310
#    ifdef MAX_PATH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   311
#     define MAXPATHLEN MAX_PATH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   312
#    else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   313
#     define MAXPATHLEN 1024
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   314
#    endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   315
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   316
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   317
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   318
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   319
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   320
 * sigaction dummies (you won't believe these call themself ``POSIX'' systems ...)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   321
 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   322
# ifndef SA_RESTART
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   323
#  define SA_RESTART    0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   324
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   325
# ifndef SA_SIGINFO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   326
#  define SA_SIGINFO    0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   327
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   328
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   329
# if defined(HAS_WAITPID) || defined(HAS_WAIT3)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   330
#  include <sys/wait.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   331
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   332
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   333
# if defined(HAS_SYSINFO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   334
#  include <sys/systeminfo.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   335
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   336
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   337
#define SIGHANDLER_ARG int
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   338
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   339
#define _HANDLEVal(o)        (HANDLE)(__externalAddressVal(o))
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   340
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   341
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   342
 * not all systems have time_t and off_t
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   343
 * explicit add of those we know to have ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   344
 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   345
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   346
#ifndef TIME_T
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   347
# define TIME_T long
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   348
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   349
#ifndef OFF_T
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   350
# define OFF_T  long
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   351
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   352
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   353
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   354
 * where is the timezone info ?
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   355
 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   356
#if defined(HAS_NO_TIMEZONE)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   357
# if defined(HAS_NO_TM_GMTOFF)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   358
#  define TIMEZONE(tmPtr)       0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   359
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   360
#  define TIMEZONE(tmPtr)       ((tmPtr)->tm_gmtoff)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   361
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   362
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   363
# ifdef MSDOS_LIKE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   364
#   define TIMEZONE(tmPtr)      0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   365
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   366
#  define TIMEZONE(tmPtr)       timezone
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   367
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   368
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   369
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   370
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   371
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   372
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   373
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   374
!Win32OperatingSystem primitiveFunctions!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   375
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   376
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   377
/* isWindows-NT flag: 
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   378
 *  1 for NT based systemes, such as NT,XP or 2k
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   379
 *  0 for w95 based systems, such as w95/w98/ME
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   380
 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   381
static int __isWinNT = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   382
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   383
#define __wait wait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   384
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   385
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   386
static int 
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   387
_canAccessIOWithoutBlocking (aFD, readMode) 
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   388
int aFD;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   389
int readMode;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   390
{
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   391
    struct timeval tv;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   392
    fd_set         fds;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   393
    int            n;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   394
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   395
/* we use the osfhandle insteat of the fd !! WHY ?? (I do not know)
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   396
   but otherwise it not works
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   397
*/
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   398
    int sock = (int) _get_osfhandle (aFD);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   399
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   400
    FD_ZERO( & fds );
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   401
    FD_SET ( sock, & fds );
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   402
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   403
    tv.tv_sec  = 0;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   404
    tv.tv_usec = 0;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   405
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   406
    if (readMode) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   407
	n = select (sock + 1, & fds, NULL, NULL, & tv);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   408
    } else {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   409
	n = select (sock + 1, NULL, & fds, NULL, & tv);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   410
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   411
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   412
    if (n == 0) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   413
	return (0);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   414
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   415
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   416
    if (n > 0) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   417
	return ((FD_ISSET (sock, & fds)) ? 1 : 0);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   418
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   419
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   420
    switch (WSAGetLastError()) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   421
	case WSAENOTSOCK:
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   422
	    if (readMode) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   423
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   424
		DWORD  w = 0;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   425
		HANDLE h = (HANDLE) _get_osfhandle (aFD);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   426
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   427
		if (PeekNamedPipe (h, 0, 0, 0, & w, 0)) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   428
		    if( !__isWinNT || w > 0 )
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   429
			return (1);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   430
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   431
		    return (0);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   432
		}
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   433
		return (-1);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   434
	    }
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   435
	    /* in writeMode we return allways true for none-sockets */
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   436
	    return (1);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   437
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   438
	case WSAEINPROGRESS:
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   439
	case WSAEWOULDBLOCK: return (0);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   440
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   441
	default: return (1);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   442
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   443
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   444
    return (0);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   445
}
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   446
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   447
#define _canReadWithoutBlocking(fd)     _canAccessIOWithoutBlocking(fd, 1)
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   448
#define _canWriteWithoutBlocking(fd)    _canAccessIOWithoutBlocking(fd, 0)
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   449
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   450
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   451
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   452
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   453
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   454
!Win32OperatingSystem class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   455
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   456
copyright
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   457
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   458
 COPYRIGHT (c) 1988 by Claus Gittinger
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   459
 COPYRIGHT (c) 1998-2004 by eXept Software AG
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   460
	      All Rights Reserved
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   461
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   462
 This software is furnished under a license and may be used
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   463
 only in accordance with the terms of that license and with the
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   464
 inclusion of the above copyright notice.   This software may not
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   465
 be provided or otherwise made available to, or used by, any
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   466
 other person.  No title to or ownership of the software is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   467
 hereby transferred.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   468
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   469
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   470
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   471
documentation
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   472
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   473
    this class resulted from extracting WIN32 specifics of the old
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   474
    OperatingSystemClass into this sub-class.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   475
    You may find some leftover unix stuff, which will go away sooner
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   476
    or later.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   477
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   478
    this class realizes access to most (all ?) required operating system services;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   479
    some of it is very specific for unix, so do not depend on
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   480
    things available here in your applications 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   481
    - some may not be found in other OS's or be slightly different ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   482
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   483
    (On the other hand: I do not want to hide all features
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   484
     from you - in some situations it MAY be interesting to be
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   485
     able to get down to a select or fork system call easily (at least on Unix systems).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   486
     You decide - portability vs. functionality)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   487
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   488
    [Class variables:]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   489
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   490
	HostName        <String>        remembered hostname
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   491
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   492
	DomainName      <String>        remembered domainname
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   493
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   494
	CurrentDirectory <String>       remembered currentDirectories path
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   495
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   496
    [author:]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   497
	Claus Gittinger (initial version & cleanup)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   498
	Manfred Dierolf (many features)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   499
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   500
    [see also:]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   501
	OSProcessStatus
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   502
	Filename Date Time
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   503
	ExternalStream FileStream PipeStream Socket
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   504
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   505
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   506
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   507
examples
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   508
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   509
  various queries
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   510
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   511
    Transcript 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   512
	showCR:'hello ' , (OperatingSystem getLoginName)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   513
								[exEnd]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   514
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   515
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   516
    OperatingSystem isUNIXlike ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   517
	Transcript showCR:'this is some UNIX-like OS'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   518
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   519
	Transcript showCR:'this OS is not UNIX-like'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   520
    ]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   521
								[exEnd]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   522
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   523
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   524
    Transcript 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   525
	showCR:'this machine is called ' , OperatingSystem getHostName
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   526
								[exEnd]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   527
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   528
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   529
    Transcript 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   530
	showCR:('this machine is in the '
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   531
	       , OperatingSystem getDomainName
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   532
	       , ' domain')
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   533
								[exEnd]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   534
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   535
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   536
    Transcript 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   537
	showCR:('this machine''s CPU is a '
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   538
	       , OperatingSystem getCPUType
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   539
	       )
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   540
								[exEnd]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   541
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   542
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   543
    Transcript showCR:'executing ls command ...'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   544
    OperatingSystem executeCommand:'ls'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   545
    Transcript showCR:'... done.'.
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   546
								[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   547
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   548
  locking a file 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   549
  (should be executed on two running smalltalks - not in two threads):
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   550
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   551
    |f|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   552
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   553
    f := 'testFile' asFilename readWriteStream.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   554
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   555
    10 timesRepeat:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   556
	'about to lock ...' printCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   557
	[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   558
	  OperatingSystem 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   559
	    lockFD:(f fileDescriptor)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   560
	    shared:false
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   561
	    blocking:false
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   562
	] whileFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   563
	    'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   564
	    Delay waitForSeconds:1
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   565
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   566
	'LOCKED ...' printCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   567
	Delay waitForSeconds:10.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   568
	'unlock ...' printCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   569
	(OperatingSystem 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   570
	    unlockFD:(f fileDescriptor)) printCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   571
	Delay waitForSeconds:3.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   572
    ]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   573
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   574
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   575
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   576
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   577
!Win32OperatingSystem class methodsFor:'initialization'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   578
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   579
initOSType
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   580
    "internal - see if running under win-NT/XP/2k
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   581
     (as opposed to win-95/98/ME)"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   582
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   583
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   584
    OSVERSIONINFO osvi;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   585
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   586
    memset(&osvi, 0, sizeof(OSVERSIONINFO));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   587
    osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   588
    GetVersionEx (&osvi);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   589
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   590
    if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   591
	__isWinNT = 1;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   592
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   593
	__isWinNT = 0;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   594
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   595
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   596
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   597
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   598
initialize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   599
    "initialize the class"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   600
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   601
    ObjectMemory addDependent:self.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   602
    HostName := nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   603
    DomainName := nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   604
    LastErrorNumber := nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   605
    PipeFailed := false.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   606
    self initOSType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   607
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   608
    "Modified: 13.9.1997 / 10:47:32 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   609
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   610
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   611
update:something with:aParameter from:changedObject
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   612
    "catch image restart and flush some cached data"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   613
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   614
    something == #earlyRestart ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   615
	"
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   616
	 flush cached data
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   617
	"
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   618
	HostName := nil.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   619
	DomainName := nil.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   620
	LastErrorNumber := nil.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   621
	PipeFailed := false.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   622
	self initOSType
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   623
    ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   624
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   625
    "Modified: 22.4.1996 / 13:10:43 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   626
    "Created: 15.6.1996 / 15:22:37 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   627
    "Modified: 7.1.1997 / 19:36:11 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   628
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   629
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   630
!Win32OperatingSystem class methodsFor:'OS signal constants'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   631
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   632
sigABRT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   633
    "return the signal number for SIGABRT - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   634
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   635
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   636
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   637
#ifdef SIGABRT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   638
    RETURN ( __MKSMALLINT(SIGABRT) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   639
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   640
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   641
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   642
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   643
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   644
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   645
sigALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   646
    "return the signal number for SIGALRM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   647
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   648
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   649
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   650
#ifdef SIGALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   651
    RETURN ( __MKSMALLINT(SIGALRM) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   652
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   653
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   654
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   655
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   656
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   657
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   658
sigBREAK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   659
    "return the signal number for SIGBREAK - 0 if not supported.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   660
     This is an MSDOS specific signal"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   661
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   662
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   663
#ifdef SIGBREAK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   664
    RETURN ( __MKSMALLINT(SIGBREAK) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   665
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   666
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   667
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   668
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   669
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   670
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   671
sigBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   672
    "return the signal number for SIGBUS - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   673
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   674
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   675
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   676
#ifdef SIGBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   677
    RETURN ( __MKSMALLINT(SIGBUS) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   678
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   679
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   680
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   681
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   682
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   683
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   684
sigCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   685
    "return the signal number for SIGCHLD - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   686
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   687
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   688
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   689
#if defined(SIGCHLD)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   690
    RETURN ( __MKSMALLINT(SIGCHLD) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   691
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   692
# if  defined(SIGCLD)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   693
    RETURN ( __MKSMALLINT(SIGCLD) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   694
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   695
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   696
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   697
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   698
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   699
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   700
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   701
sigCONT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   702
    "return the signal number for SIGCONT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   703
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   704
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   705
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   706
#if defined(SIGCONT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   707
    RETURN ( __MKSMALLINT(SIGCONT) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   708
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   709
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   710
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   711
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   712
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   713
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   714
sigDANGER
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   715
    "return the signal number for SIGDANGER - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   716
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   717
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   718
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   719
#if defined(SIGDANGER)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   720
    RETURN ( __MKSMALLINT(SIGDANGER) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   721
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   722
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   723
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   724
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   725
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   726
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   727
sigEMT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   728
    "return the signal number for SIGEMT - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   729
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   730
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   731
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   732
#ifdef SIGEMT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   733
    RETURN ( __MKSMALLINT(SIGEMT) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   734
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   735
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   736
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   737
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   738
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   739
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   740
sigFP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   741
    "return the signal number for SIGFP - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   742
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   743
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   744
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   745
#ifdef SIGFPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   746
    RETURN ( __MKSMALLINT(SIGFPE) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   747
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   748
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   749
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   750
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   751
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   752
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   753
sigGRANT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   754
    "return the signal number for SIGGRANT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   755
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   756
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   757
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   758
#if defined(SIGGRANT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   759
    RETURN ( __MKSMALLINT(SIGGRANT) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   760
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   761
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   762
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   763
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   764
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   765
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   766
sigHUP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   767
    "return the signal number for SIGHUP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   768
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   769
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   770
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   771
#ifdef SIGHUP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   772
    RETURN ( __MKSMALLINT(SIGHUP) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   773
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   774
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   775
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   776
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   777
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   778
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   779
sigILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   780
    "return the signal number for SIGILL - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   781
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   782
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   783
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   784
#ifdef SIGILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   785
    RETURN ( __MKSMALLINT(SIGILL) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   786
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   787
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   788
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   789
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   790
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   791
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   792
sigINT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   793
    "return the signal number for SIGINT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   794
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   795
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   796
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   797
#ifdef SIGINT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   798
    RETURN ( __MKSMALLINT(SIGINT) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   799
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   800
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   801
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   802
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   803
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   804
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   805
sigIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   806
    "return the signal number for SIGIO - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   807
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   808
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   809
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   810
#if defined(SIGIO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   811
    RETURN ( __MKSMALLINT(SIGIO) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   812
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   813
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   814
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   815
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   816
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   817
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   818
sigIOT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   819
    "return the signal number for SIGIOT - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   820
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   821
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   822
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   823
#ifdef SIGIOT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   824
    RETURN ( __MKSMALLINT(SIGIOT) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   825
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   826
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   827
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   828
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   829
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   830
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   831
sigKILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   832
    "return the signal number for SIGKILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   833
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   834
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   835
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   836
#ifdef SIGKILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   837
    RETURN ( __MKSMALLINT(SIGKILL) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   838
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   839
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   840
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   841
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   842
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   843
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   844
sigLOST
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   845
    "return the signal number for SIGLOST - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   846
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   847
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   848
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   849
#if defined(SIGLOST)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   850
    RETURN ( __MKSMALLINT(SIGLOST) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   851
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   852
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   853
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   854
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   855
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   856
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   857
sigMIGRATE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   858
    "return the signal number for SIGMIGRATE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   859
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   860
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   861
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   862
#if defined(SIGMIGRATE)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   863
    RETURN ( __MKSMALLINT(SIGMIGRATE) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   864
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   865
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   866
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   867
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   868
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   869
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   870
sigMSG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   871
    "return the signal number for SIGMSG - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   872
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   873
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   874
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   875
#if defined(SIGMSG)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   876
    RETURN ( __MKSMALLINT(SIGMSG) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   877
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   878
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   879
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   880
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   881
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   882
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   883
sigPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   884
    "return the signal number for SIGPIPE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   885
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   886
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   887
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   888
#ifdef SIGPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   889
    RETURN ( __MKSMALLINT(SIGPIPE) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   890
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   891
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   892
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   893
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   894
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   895
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   896
sigPOLL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   897
    "return the signal number for SIGPOLL - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   898
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   899
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   900
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   901
#if defined(SIGPOLL)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   902
    RETURN ( __MKSMALLINT(SIGPOLL) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   903
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   904
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   905
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   906
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   907
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   908
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   909
sigPRE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   910
    "return the signal number for SIGPRE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   911
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   912
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   913
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   914
#if defined(SIGPRE)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   915
    RETURN ( __MKSMALLINT(SIGPRE) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   916
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   917
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   918
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   919
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   920
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   921
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   922
sigPROF
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   923
    "return the signal number for SIGPROF - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   924
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   925
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   926
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   927
#if defined(SIGPROF)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   928
    RETURN ( __MKSMALLINT(SIGPROF) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   929
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   930
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   931
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   932
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   933
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   934
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   935
sigPWR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   936
    "return the signal number for SIGPWR - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   937
     (not available on all systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   938
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   939
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   940
#if defined(SIGPWR)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   941
    RETURN ( __MKSMALLINT(SIGPWR) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   942
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   943
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   944
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   945
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   946
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   947
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   948
sigQUIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   949
    "return the signal number for SIGQUIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   950
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   951
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   952
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   953
#ifdef SIGQUIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   954
    RETURN ( __MKSMALLINT(SIGQUIT) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   955
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   956
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   957
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   958
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   959
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   960
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   961
sigRETRACT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   962
    "return the signal number for SIGRETRACT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   963
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   964
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   965
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   966
#if defined(SIGRETRACT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   967
    RETURN ( __MKSMALLINT(SIGRETRACT) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   968
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   969
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   970
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   971
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   972
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   973
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   974
sigSAK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   975
    "return the signal number for SIGSAK - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   976
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   977
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   978
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   979
#if defined(SIGSAK)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   980
    RETURN ( __MKSMALLINT(SIGSAK) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   981
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   982
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   983
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   984
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   985
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   986
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   987
sigSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   988
    "return the signal number for SIGSEGV - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   989
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   990
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   991
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   992
#ifdef SIGSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   993
    RETURN ( __MKSMALLINT(SIGSEGV) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   994
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   995
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   996
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   997
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   998
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   999
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1000
sigSOUND
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1001
    "return the signal number for SIGSOUND - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1002
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1003
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1004
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1005
#if defined(SIGSOUND)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1006
    RETURN ( __MKSMALLINT(SIGSOUND) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1007
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1008
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1009
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1010
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1011
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1012
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1013
sigSTOP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1014
    "return the signal number for SIGSTOP - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1015
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1016
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1017
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1018
#if defined(SIGSTOP)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1019
    RETURN ( __MKSMALLINT(SIGSTOP) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1020
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1021
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1022
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1023
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1024
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1025
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1026
sigSYS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1027
    "return the signal number for SIGSYS - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1028
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1029
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1030
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1031
#ifdef SIGSYS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1032
    RETURN ( __MKSMALLINT(SIGSYS) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1033
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1034
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1035
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1036
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1037
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1038
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1039
sigTERM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1040
    "return the signal number for SIGTERM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1041
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1042
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1043
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1044
#ifdef SIGTERM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1045
    RETURN ( __MKSMALLINT(SIGTERM) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1046
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1047
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1048
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1049
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1050
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1051
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1052
sigTRAP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1053
    "return the signal number for SIGTRAP - 0 if not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1054
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1055
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1056
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1057
#ifdef SIGTRAP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1058
    RETURN ( __MKSMALLINT(SIGTRAP) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1059
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1060
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1061
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1062
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1063
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1064
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1065
sigTSTP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1066
    "return the signal number for SIGTSTP - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1067
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1068
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1069
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1070
#if defined(SIGTSTP)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1071
    RETURN ( __MKSMALLINT(SIGTSTP) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1072
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1073
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1074
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1075
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1076
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1077
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1078
sigTTIN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1079
    "return the signal number for SIGTTIN - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1080
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1081
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1082
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1083
#if defined(SIGTTIN)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1084
    RETURN ( __MKSMALLINT(SIGTTIN) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1085
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1086
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1087
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1088
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1089
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1090
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1091
sigTTOU
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1092
    "return the signal number for SIGTTOU - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1093
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1094
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1095
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1096
#if defined(SIGTTOU)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1097
    RETURN ( __MKSMALLINT(SIGTTOU) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1098
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1099
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1100
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1101
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1102
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1103
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1104
sigURG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1105
    "return the signal number for SIGURG - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1106
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1107
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1108
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1109
#if defined(SIGURG)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1110
    RETURN ( __MKSMALLINT(SIGURG) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1111
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1112
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1113
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1114
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1115
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1116
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1117
sigUSR1
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1118
    "return the signal number for SIGUSR1 - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1119
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1120
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1121
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1122
#if defined(SIGUSR1)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1123
    RETURN ( __MKSMALLINT(SIGUSR1) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1124
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1125
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1126
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1127
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1128
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1129
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1130
sigUSR2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1131
    "return the signal number for SIGUSR2 - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1132
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1134
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1135
#if defined(SIGUSR2)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1136
    RETURN ( __MKSMALLINT(SIGUSR2) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1137
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1138
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1139
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1140
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1141
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1142
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1143
sigVTALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1144
    "return the signal number for SIGVTALRM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1145
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1146
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1147
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1148
#if defined(SIGVTALRM)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1149
    RETURN ( __MKSMALLINT(SIGVTALRM) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1150
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1151
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1152
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1153
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1154
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1155
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1156
sigWINCH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1157
    "return the signal number for SIGWINCH - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1158
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1159
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1160
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1161
#if defined(SIGWINCH)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1162
    RETURN ( __MKSMALLINT(SIGWINCH) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1163
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1164
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1165
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1166
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1167
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1168
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1169
sigXCPU
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1170
    "return the signal number for SIGXCPU - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1171
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1172
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1173
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1174
#if defined(SIGXCPU)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1175
    RETURN ( __MKSMALLINT(SIGXCPU) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1176
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1177
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1178
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1179
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1180
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1181
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1182
sigXFSZ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1183
    "return the signal number for SIGXFSZ - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1184
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1185
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1186
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1187
#if defined(SIGXFSZ)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1188
    RETURN ( __MKSMALLINT(SIGXFSZ) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1189
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1190
    RETURN ( __MKSMALLINT(0) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1191
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1192
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1193
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1194
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1195
!Win32OperatingSystem class methodsFor:'error messages'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1196
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1197
currentErrorNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1198
    "returns the OS's last error nr (i.e. the value of errno).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1199
     Notice, that the value of this flag is only valid immediately
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1200
     after the error occurred - it gets updated with every other
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1201
     request to the OS.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1202
     Use lastErrorNumber - currentErrorNumber is invalidated by
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1203
     many, many internal calls."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1204
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1205
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1206
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1207
     RETURN ( __MKSMALLINT(__threadErrno) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1208
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1209
     "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1210
      OperatingSystem currentErrorNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1211
     "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1212
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1213
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1214
errorHolderForNumber:errNr
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1215
    "return an osErrorHolder for the given error number (as returned by a system call)." 
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1216
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1217
    |sym typ holder|
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1218
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1219
%{
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1220
    /* claus:
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1221
     * I made this primitive code, since errnos are not
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1222
     * standard across unixes
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1223
     */
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1224
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1225
    typ = @symbol(defaultOsErrorSignal);
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1226
    sym = @symbol(ERROR_OTHER);
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1227
6288
dad5c4e592e0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 6277
diff changeset
  1228
    if (__isSmallInteger(errNr)) {
dad5c4e592e0 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 6277
diff changeset
  1229
      int __eno = __intVal(errNr);
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1230
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1231
      if (__isWIN32Error(__eno)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1232
	switch (__eno & 0xFFFF) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1233
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1234
	     * WIN32 GetLastError returns
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1235
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1236
	    case ERROR_INVALID_FUNCTION:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1237
		sym = @symbol(ERROR_INVALID_FUNCTION);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1238
		typ = @symbol(illegalOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1239
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1240
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1241
	    case ERROR_BAD_FORMAT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1242
		sym = @symbol(ERROR_BAD_FORMAT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1243
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1244
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1245
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1246
	    case ERROR_FILE_NOT_FOUND:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1247
		sym = @symbol(ERROR_FILE_NOT_FOUND);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1248
		typ = @symbol(nonexistentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1249
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1250
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1251
	    case ERROR_PATH_NOT_FOUND:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1252
		sym = @symbol(ERROR_PATH_NOT_FOUND);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1253
		typ = @symbol(nonexistentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1254
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1255
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1256
	    case ERROR_TOO_MANY_OPEN_FILES:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1257
		sym = @symbol(ERROR_TOO_MANY_OPEN_FILES);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1258
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1259
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1260
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1261
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1262
	     * what a nice errorCode - thats the most "useful" one I ever
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1263
	     * encountered ... (... those stupid micro-softies ...)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1264
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1265
	    case ERROR_OPEN_FAILED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1266
		sym = @symbol(ERROR_OPEN_FAILED);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1267
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1268
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1269
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1270
	    case ERROR_ACCESS_DENIED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1271
		sym = @symbol(ERROR_ACCESS_DENIED);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1272
		typ = @symbol(noPermissionsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1273
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1274
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1275
	    case ERROR_INVALID_HANDLE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1276
		sym = @symbol(ERROR_INVALID_HANDLE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1277
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1278
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1279
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1280
	    case ERROR_NOT_ENOUGH_MEMORY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1281
		sym = @symbol(ERROR_NOT_ENOUGH_MEMORY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1282
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1283
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1284
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1285
	    case ERROR_INVALID_ACCESS:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1286
		sym = @symbol(ERROR_INVALID_ACCESS);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1287
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1288
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1289
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1290
	    case ERROR_INVALID_DATA:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1291
		sym = @symbol(ERROR_INVALID_DATA);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1292
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1293
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1294
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1295
	    case ERROR_INVALID_NAME:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1296
		sym = @symbol(ERROR_INVALID_NAME);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1297
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1298
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1299
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1300
	    case ERROR_ARENA_TRASHED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1301
		sym = @symbol(ERROR_ARENA_TRASHED);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1302
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1303
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1304
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1305
	    case ERROR_OUTOFMEMORY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1306
		sym = @symbol(ERROR_OUTOFMEMORY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1307
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1308
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1309
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1310
	    case ERROR_BROKEN_PIPE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1311
		sym = @symbol(ERROR_BROKEN_PIPE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1312
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1313
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1314
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1315
	    case ERROR_GEN_FAILURE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1316
		sym = @symbol(ERROR_GEN_FAILURE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1317
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1318
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1319
	    case ERROR_WRITE_PROTECT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1320
		sym = @symbol(ERROR_WRITE_PROTECT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1321
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1322
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1323
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1324
	    case ERROR_WRITE_FAULT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1325
		sym = @symbol(ERROR_WRITE_FAULT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1326
		typ = @symbol(transferFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1327
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1328
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1329
	    case ERROR_READ_FAULT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1330
		sym = @symbol(ERROR_READ_FAULT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1331
		typ = @symbol(transferFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1332
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1333
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1334
	    case ERROR_HANDLE_DISK_FULL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1335
		sym = @symbol(ERROR_HANDLE_DISK_FULL);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1336
		typ = @symbol(volumeFullSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1337
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1338
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1339
	    case ERROR_DISK_FULL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1340
		sym = @symbol(ERROR_DISK_FULL);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1341
		typ = @symbol(volumeFullSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1342
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1343
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1344
	    case ERROR_SHARING_VIOLATION:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1345
		sym = @symbol(ERROR_SHARING_VIOLATION);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1346
		typ = @symbol(noPermissionsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1347
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1348
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1349
	    case ERROR_LOCK_VIOLATION:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1350
		sym = @symbol(ERROR_LOCK_VIOLATION);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1351
		typ = @symbol(noPermissionsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1352
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1353
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1354
	    case ERROR_INVALID_PARAMETER:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1355
		sym = @symbol(ERROR_INVALID_PARAMETER);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1356
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1357
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1358
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1359
	    case ERROR_NET_WRITE_FAULT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1360
		sym = @symbol(ERROR_NET_WRITE_FAULT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1361
		typ = @symbol(transferFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1362
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1363
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1364
	    case ERROR_NOT_SUPPORTED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1365
		sym = @symbol(ERROR_NOT_SUPPORTED);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1366
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1367
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1368
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1369
	    case ERROR_REM_NOT_LIST:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1370
		sym = @symbol(ERROR_REM_NOT_LIST);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1371
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1372
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1373
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1374
	    case ERROR_NETWORK_ACCESS_DENIED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1375
		sym = @symbol(ERROR_NETWORK_ACCESS_DENIED);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1376
		typ = @symbol(noPermissionsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1377
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1378
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1379
	    case ERROR_DUP_NAME:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1380
		sym = @symbol(ERROR_DUP_NAME);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1381
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1382
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1383
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1384
	    case ERROR_BAD_NETPATH:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1385
		sym = @symbol(ERROR_BAD_NETPATH);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1386
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1387
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1388
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1389
	    case ERROR_NETWORK_BUSY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1390
		sym = @symbol(ERROR_NETWORK_BUSY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1391
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1392
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1393
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1394
	    case ERROR_DRIVE_LOCKED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1395
		sym = @symbol(ERROR_DRIVE_LOCKED);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1396
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1397
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1398
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1399
	    case ERROR_INVALID_DRIVE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1400
		sym = @symbol(ERROR_INVALID_DRIVE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1401
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1402
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1403
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1404
	    case ERROR_WRONG_DISK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1405
		sym = @symbol(ERROR_WRONG_DISK);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1406
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1407
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1408
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1409
	    case ERROR_CURRENT_DIRECTORY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1410
		sym = @symbol(ERROR_CURRENT_DIRECTORY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1411
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1412
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1413
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1414
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1415
	     * what a nice errorCode - thats the most "useful" one I ever
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1416
	     * encountered ... (... those stupid micro-softies ...)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1417
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1418
	    case ERROR_CANNOT_MAKE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1419
		sym = @symbol(ERROR_CANNOT_MAKE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1420
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1421
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1422
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1423
	    case ERROR_NO_MORE_FILES:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1424
		sym = @symbol(ERROR_NO_MORE_FILES);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1425
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1426
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1427
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1428
	    case ERROR_NOT_READY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1429
		sym = @symbol(ERROR_NOT_READY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1430
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1431
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1432
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1433
	    case ERROR_NOT_DOS_DISK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1434
		sym = @symbol(ERROR_NOT_DOS_DISK);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1435
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1436
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1437
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1438
	    case ERROR_OUT_OF_PAPER:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1439
		sym = @symbol(ERROR_OUT_OF_PAPER);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1440
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1441
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1442
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1443
	    case ERROR_PRINTQ_FULL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1444
		sym = @symbol(ERROR_PRINTQ_FULL);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1445
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1446
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1447
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1448
	    default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1449
		sym = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1450
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1451
	}
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1452
      } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1453
	switch (__eno) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1454
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1455
	     * POSIX errnos - these should be defined
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1456
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1457
#ifdef EPERM
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1458
	    case EPERM:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1459
		sym = @symbol(EPERM);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1460
		typ = @symbol(noPermissionsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1461
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1462
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1463
#ifdef ENOENT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1464
	    case ENOENT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1465
		sym = @symbol(ENOENT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1466
		typ = @symbol(nonexistentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1467
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1468
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1469
#ifdef ESRCH
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1470
	    case ESRCH:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1471
		sym = @symbol(ESRCH);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1472
		typ = @symbol(unavailableReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1473
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1474
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1475
#ifdef EINTR
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1476
	    case EINTR:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1477
		sym = @symbol(EINTR);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1478
		typ = @symbol(transientErrorSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1479
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1480
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1481
#ifdef EIO
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1482
	    case EIO:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1483
		sym = @symbol(EIO);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1484
		typ = @symbol(transferFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1485
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1486
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1487
#ifdef ENXIO
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1488
	    case ENXIO:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1489
		sym = @symbol(ENXIO);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1490
		typ = @symbol(unavailableReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1491
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1492
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1493
#ifdef E2BIG
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1494
	    case E2BIG:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1495
		sym = @symbol(E2BIG);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1496
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1497
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1498
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1499
#ifdef ENOEXEC
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1500
	    case ENOEXEC:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1501
		sym = @symbol(ENOEXEC);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1502
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1503
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1504
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1505
#ifdef EBADF
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1506
	    case EBADF:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1507
		sym = @symbol(EBADF);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1508
		typ = @symbol(badAccessorSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1509
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1510
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1511
#ifdef ECHILD
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1512
	    case ECHILD:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1513
		sym = @symbol(ECHILD);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1514
		typ = @symbol(informationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1515
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1516
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1517
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1518
	    case EAGAIN:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1519
		sym = @symbol(EAGAIN);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1520
		typ = @symbol(notReadySignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1521
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1522
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1523
#ifdef ENOMEM
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1524
	    case ENOMEM:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1525
		sym = @symbol(ENOMEM);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1526
		typ = @symbol(noMemorySignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1527
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1528
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1529
#ifdef EACCES
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1530
	    case EACCES:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1531
		sym = @symbol(EACCES);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1532
		typ = @symbol(noPermissionsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1533
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1534
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1535
#ifdef EFAULT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1536
	    case EFAULT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1537
		sym = @symbol(EFAULT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1538
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1539
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1540
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1541
#ifdef EBUSY
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1542
	    case EBUSY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1543
		sym = @symbol(EBUSY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1544
		typ = @symbol(unavailableReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1545
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1546
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1547
#ifdef EEXIST
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1548
	    case EEXIST:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1549
		sym = @symbol(EEXIST);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1550
		typ = @symbol(existingReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1551
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1552
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1553
#ifdef EXDEV
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1554
	    case EXDEV:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1555
		sym = @symbol(EXDEV);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1556
		typ = @symbol(inappropriateReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1557
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1558
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1559
#ifdef ENODEV
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1560
	    case ENODEV:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1561
		sym = @symbol(ENODEV);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1562
		typ = @symbol(inaccessibleSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1563
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1564
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1565
#ifdef ENOTDIR
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1566
	    case ENOTDIR:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1567
		sym = @symbol(ENOTDIR);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1568
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1569
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1570
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1571
#ifdef EISDIR
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1572
	    case EISDIR:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1573
		sym = @symbol(EISDIR);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1574
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1575
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1576
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1577
#ifdef EINVAL
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1578
	    case EINVAL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1579
		sym = @symbol(EINVAL);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1580
		typ = @symbol(invalidArgumentsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1581
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1582
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1583
#ifdef ENFILE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1584
	    case ENFILE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1585
		sym = @symbol(ENFILE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1586
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1587
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1588
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1589
#ifdef EMFILE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1590
	    case EMFILE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1591
		sym = @symbol(EMFILE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1592
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1593
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1594
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1595
#ifdef ENOTTY
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1596
	    case ENOTTY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1597
		sym = @symbol(ENOTTY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1598
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1599
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1600
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1601
#ifdef EFBIG
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1602
	    case EFBIG:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1603
		sym = @symbol(EFBIG);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1604
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1605
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1606
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1607
#ifdef ENOSPC
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1608
	    case ENOSPC:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1609
		sym = @symbol(ENOSPC);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1610
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1611
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1612
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1613
#ifdef ESPIPE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1614
	    case ESPIPE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1615
		sym = @symbol(ESPIPE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1616
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1617
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1618
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1619
#ifdef EROFS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1620
	    case EROFS:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1621
		sym = @symbol(EROFS);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1622
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1623
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1624
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1625
#ifdef EMLINK
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1626
	    case EMLINK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1627
		sym = @symbol(EMLINK);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1628
		typ = @symbol(rangeErrorSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1629
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1630
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1631
#ifdef EPIPE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1632
	    case EPIPE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1633
		sym = @symbol(EPIPE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1634
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1635
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1636
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1637
#ifdef EDOM
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1638
	    case EDOM:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1639
		sym = @symbol(EDOM);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1640
		typ = @symbol(rangeErrorSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1641
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1642
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1643
#ifdef ERANGE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1644
	    case ERANGE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1645
		sym = @symbol(ERANGE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1646
		typ = @symbol(rangeErrorSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1647
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1648
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1649
#ifdef EDEADLK
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1650
# if EDEADLK != EWOULDBLOCK
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1651
	    case EDEADLK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1652
		sym = @symbol(EDEADLK);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1653
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1654
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1655
# endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1656
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1657
#ifdef ENAMETOOLONG
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1658
	    case ENAMETOOLONG:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1659
		sym = @symbol(ENAMETOOLONG);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1660
		typ = @symbol(rangeErrorSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1661
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1662
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1663
#ifdef ENOLCK
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1664
	    case ENOLCK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1665
		sym = @symbol(ENOLCK);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1666
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1667
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1668
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1669
#ifdef ENOSYS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1670
	    case ENOSYS:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1671
		sym = @symbol(ENOSYS);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1672
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1673
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1674
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1675
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1676
	    case ENOTEMPTY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1677
		sym = @symbol(ENOTEMPTY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1678
		typ = @symbol(inappropriateReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1679
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1680
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1681
#ifdef EILSEQ
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1682
	    case EILSEQ:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1683
		sym = @symbol(EILSEQ);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1684
		typ = @symbol(transferFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1685
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1686
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1687
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1688
	     * XPG3 errnos - defined on most systems
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1689
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1690
#ifdef ENOTBLK
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1691
	    case ENOTBLK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1692
		sym = @symbol(ENOTBLK);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1693
		typ = @symbol(inappropriateReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1694
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1695
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1696
#ifdef ETXTBSY
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1697
	    case ETXTBSY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1698
		sym = @symbol(ETXTBSY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1699
		typ = @symbol(inaccessibleSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1700
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1701
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1702
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1703
	     * some others
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1704
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1705
#ifdef EWOULDBLOCK
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1706
	    case EWOULDBLOCK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1707
		sym = @symbol(EWOULDBLOCK);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1708
		typ = @symbol(notReadySignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1709
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1710
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1711
#ifdef ENOMSG
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1712
	    case ENOMSG:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1713
		sym = @symbol(ENOMSG);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1714
		typ = @symbol(noDataSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1715
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1716
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1717
#ifdef ELOOP
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1718
	    case ELOOP:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1719
		sym = @symbol(ELOOP);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1720
		typ = @symbol(rangeErrorSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1721
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1722
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1723
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1724
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1725
	     * some stream errors
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1726
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1727
#ifdef ETIME
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1728
	    case ETIME:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1729
		sym = @symbol(ETIME);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1730
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1731
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1732
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1733
#ifdef ENOSR
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1734
	    case ENOSR:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1735
		sym = @symbol(ENOSR);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1736
		typ = @symbol(noResourcesSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1737
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1738
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1739
#ifdef ENOSTR
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1740
	    case ENOSTR:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1741
		sym = @symbol(ENOSTR);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1742
		typ = @symbol(inappropriateReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1743
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1744
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1745
#ifdef ECOMM
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1746
	    case ECOMM:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1747
		sym = @symbol(ECOMM);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1748
		typ = @symbol(transferFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1749
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1750
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1751
#ifdef EPROTO
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1752
	    case EPROTO:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1753
		sym = @symbol(EPROTO);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1754
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1755
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1756
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1757
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1758
	     * nfs errors
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1759
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1760
#ifdef ESTALE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1761
	    case ESTALE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1762
		sym = @symbol(ESTALE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1763
		typ = @symbol(unavailableReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1764
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1765
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1766
#ifdef EREMOTE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1767
	    case EREMOTE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1768
		sym = @symbol(EREMOTE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1769
		typ = @symbol(rangeErrorSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1770
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1771
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1772
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1773
	     * some networking errors
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1774
	     */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1775
#ifdef EINPROGRESS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1776
	    case EINPROGRESS:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1777
		sym = @symbol(EINPROGRESS);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1778
		typ = @symbol(operationStartedSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1779
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1780
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1781
#ifdef EALREADY
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1782
	    case EALREADY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1783
		sym = @symbol(EALREADY);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1784
		typ = @symbol(operationStartedSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1785
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1786
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1787
#ifdef ENOTSOCK
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1788
	    case ENOTSOCK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1789
		sym = @symbol(ENOTSOCK);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1790
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1791
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1792
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1793
#ifdef EDESTADDRREQ
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1794
	    case EDESTADDRREQ:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1795
		sym = @symbol(EDESTADDRREQ);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1796
		typ = @symbol(underspecifiedSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1797
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1798
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1799
#ifdef EMSGSIZE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1800
	    case EMSGSIZE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1801
		sym = @symbol(EMSGSIZE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1802
		typ = @symbol(rangeErrorSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1803
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1804
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1805
#ifdef EPROTOTYPE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1806
	    case EPROTOTYPE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1807
		sym = @symbol(EPROTOTYPE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1808
		typ = @symbol(wrongSubtypeForOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1809
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1810
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1811
#ifdef ENOPROTOOPT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1812
	    case ENOPROTOOPT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1813
		sym = @symbol(ENOPROTOOPT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1814
		typ = @symbol(unsupportedOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1815
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1816
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1817
#ifdef EPROTONOSUPPORT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1818
	    case EPROTONOSUPPORT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1819
		sym = @symbol(EPROTONOSUPPORT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1820
		typ = @symbol(unsupportedOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1821
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1822
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1823
#ifdef ESOCKTNOSUPPORT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1824
	    case ESOCKTNOSUPPORT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1825
		sym = @symbol(ESOCKTNOSUPPORT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1826
		typ = @symbol(unsupportedOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1827
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1828
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1829
#ifdef EOPNOTSUPP
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1830
	    case EOPNOTSUPP:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1831
		sym = @symbol(EOPNOTSUPP);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1832
		typ = @symbol(inappropriateOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1833
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1834
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1835
#ifdef EPFNOSUPPORT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1836
	    case EPFNOSUPPORT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1837
		sym = @symbol(EPFNOSUPPORT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1838
		typ = @symbol(unsupportedOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1839
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1840
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1841
#ifdef EAFNOSUPPORT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1842
	    case EAFNOSUPPORT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1843
		sym = @symbol(EAFNOSUPPORT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1844
		typ = @symbol(unsupportedOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1845
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1846
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1847
#ifdef EADDRINUSE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1848
	    case EADDRINUSE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1849
		sym = @symbol(EADDRINUSE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1850
		typ = @symbol(existingReferentSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1851
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1852
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1853
#ifdef EADDRNOTAVAIL
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1854
	    case EADDRNOTAVAIL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1855
		sym = @symbol(EADDRNOTAVAIL);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1856
		typ = @symbol(noPermissionsSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1857
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1858
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1859
#ifdef ETIMEDOUT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1860
	    case ETIMEDOUT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1861
		sym = @symbol(ETIMEDOUT);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1862
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1863
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1864
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1865
#ifdef ECONNREFUSED
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1866
	    case ECONNREFUSED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1867
		sym = @symbol(ECONNREFUSED);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1868
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1869
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1870
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1871
#ifdef ENETDOWN
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1872
	    case ENETDOWN:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1873
		sym = @symbol(ENETDOWN);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1874
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1875
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1876
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1877
#ifdef ENETUNREACH
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1878
	    case ENETUNREACH:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1879
		sym = @symbol(ENETUNREACH);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1880
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1881
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1882
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1883
#ifdef ENETRESET
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1884
	    case ENETRESET:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1885
		sym = @symbol(ENETRESET);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1886
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1887
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1888
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1889
#ifdef ECONNABORTED
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1890
	    case ECONNABORTED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1891
		sym = @symbol(ECONNABORTED);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1892
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1893
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1894
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1895
#ifdef ECONNRESET
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1896
	    case ECONNRESET:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1897
		sym = @symbol(ECONNRESET);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1898
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1899
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1900
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1901
#ifdef EISCONN
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1902
	    case EISCONN:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1903
		sym = @symbol(EISCONN);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1904
		typ = @symbol(unpreparedOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1905
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1906
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1907
#ifdef ENOTCONN
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1908
	    case ENOTCONN:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1909
		sym = @symbol(ENOTCONN);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1910
		typ = @symbol(unpreparedOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1911
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1912
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1913
#ifdef ESHUTDOWN
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1914
	    case ESHUTDOWN:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1915
		sym = @symbol(ESHUTDOWN);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1916
		typ = @symbol(unpreparedOperationSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1917
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1918
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1919
#ifdef EHOSTDOWN
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1920
	    case EHOSTDOWN:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1921
		sym = @symbol(EHOSTDOWN);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1922
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1923
		break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1924
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1925
#ifdef EHOSTUNREACH
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1926
	    case EHOSTUNREACH:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1927
		sym = @symbol(EHOSTUNREACH);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1928
		typ = @symbol(peerFaultSignal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1929
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1930
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1931
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1932
	    default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1933
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1934
	}
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1935
      }
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1936
    }
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1937
%}.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1938
    holder := OSErrorHolder new.
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1939
    holder errorSymbol:sym errorCategory:typ.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1940
    ^ holder
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1941
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1942
    "
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1943
     OperatingSystem errorHolderForNumber:4           
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1944
     self errorHolderForNumber:(self errorNumberFor:#EPERM)   
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1945
     self errorHolderForNumber:(self errorNumberFor:#EIO)
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1946
     self errorHolderForNumber:(self errorNumberFor:#ENXIO)
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1947
    "
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1948
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1949
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1950
errorNumberFor:aSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1951
    "given a symbolic error, return the numeric;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1952
     (i.e. errorNumberFor:#EBADF returns EBADF's value).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1953
     Use this, since error numbers are really not standard across unix systems."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1954
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1955
%{   /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1956
    OBJ sym = aSymbol;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1957
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1958
    /*
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1959
     * WIN32 GetLastError returns
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1960
     */
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1961
#ifdef ERROR_INVALID_FUNCTION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1962
    if (sym == @symbol(ERROR_INVALID_FUNCTION)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1963
	RETURN ( __MKSMALLINT(ERROR_INVALID_FUNCTION) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1964
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1965
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1966
#ifdef ERROR_BAD_FORMAT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1967
    if (sym == @symbol(ERROR_BAD_FORMAT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1968
	RETURN ( __MKSMALLINT(ERROR_BAD_FORMAT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1969
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1970
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1971
#ifdef ERROR_FILE_NOT_FOUND
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1972
    if (sym == @symbol(ERROR_FILE_NOT_FOUND)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1973
	RETURN ( __MKSMALLINT(ERROR_FILE_NOT_FOUND) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1974
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1975
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1976
#ifdef ERROR_PATH_NOT_FOUND
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1977
    if (sym == @symbol(ERROR_PATH_NOT_FOUND)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1978
	RETURN ( __MKSMALLINT(ERROR_PATH_NOT_FOUND) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1979
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1980
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1981
#ifdef ERROR_TOO_MANY_OPEN_FILES
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1982
    if (sym == @symbol(ERROR_TOO_MANY_OPEN_FILES)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1983
	RETURN ( __MKSMALLINT(ERROR_TOO_MANY_OPEN_FILES) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1984
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1985
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1986
#ifdef ERROR_OPEN_FAILED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1987
    if (sym == @symbol(ERROR_OPEN_FAILED)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1988
	RETURN ( __MKSMALLINT(ERROR_OPEN_FAILED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1989
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1990
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1991
#ifdef ERROR_ACCESS_DENIED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1992
    if (sym == @symbol(ERROR_ACCESS_DENIED)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1993
	RETURN ( __MKSMALLINT(ERROR_ACCESS_DENIED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1994
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1995
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1996
#ifdef ERROR_INVALID_HANDLE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1997
    if (sym == @symbol(ERROR_INVALID_HANDLE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1998
	RETURN ( __MKSMALLINT(ERROR_INVALID_HANDLE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1999
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2000
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2001
#ifdef ERROR_NOT_ENOUGH_MEMORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2002
    if (sym == @symbol(ERROR_NOT_ENOUGH_MEMORY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2003
	RETURN ( __MKSMALLINT(ERROR_NOT_ENOUGH_MEMORY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2004
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2005
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2006
#ifdef ERROR_INVALID_ACCESS
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2007
    if (sym == @symbol(ERROR_INVALID_ACCESS)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2008
	RETURN ( __MKSMALLINT(ERROR_INVALID_ACCESS) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2009
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2010
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2011
#ifdef ERROR_INVALID_DATA
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2012
    if (sym == @symbol(ERROR_INVALID_DATA)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2013
	RETURN ( __MKSMALLINT(ERROR_INVALID_DATA) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2014
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2015
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2016
#ifdef ERROR_INVALID_NAME
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2017
    if (sym == @symbol(ERROR_INVALID_NAME)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2018
	RETURN ( __MKSMALLINT(ERROR_INVALID_NAME) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2019
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2020
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2021
#ifdef ERROR_ARENA_TRASHED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2022
    if (sym == @symbol(ERROR_ARENA_TRASHED)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2023
	RETURN ( __MKSMALLINT(ERROR_ARENA_TRASHED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2024
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2025
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2026
#ifdef ERROR_OUTOFMEMORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2027
    if (sym == @symbol(ERROR_OUTOFMEMORY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2028
	RETURN ( __MKSMALLINT(ERROR_OUTOFMEMORY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2029
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2030
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2031
#ifdef ERROR_BROKEN_PIPE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2032
    if (sym == @symbol(ERROR_BROKEN_PIPE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2033
	RETURN ( __MKSMALLINT(ERROR_BROKEN_PIPE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2034
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2035
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2036
#ifdef ERROR_GEN_FAILURE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2037
    if (sym == @symbol(ERROR_GEN_FAILURE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2038
	RETURN ( __MKSMALLINT(ERROR_GEN_FAILURE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2039
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2040
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2041
#ifdef ERROR_WRITE_PROTECT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2042
    if (sym == @symbol(ERROR_WRITE_PROTECT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2043
	RETURN ( __MKSMALLINT(ERROR_WRITE_PROTECT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2044
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2045
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2046
#ifdef ERROR_WRITE_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2047
    if (sym == @symbol(ERROR_WRITE_FAULT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2048
	RETURN ( __MKSMALLINT(ERROR_WRITE_FAULT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2049
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2050
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2051
#ifdef ERROR_READ_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2052
    if (sym == @symbol(ERROR_READ_FAULT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2053
	RETURN ( __MKSMALLINT(ERROR_READ_FAULT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2054
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2055
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2056
#ifdef ERROR_HANDLE_DISK_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2057
    if (sym == @symbol(ERROR_HANDLE_DISK_FULL)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2058
	RETURN ( __MKSMALLINT(ERROR_HANDLE_DISK_FULL) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2059
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2060
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2061
#ifdef ERROR_DISK_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2062
    if (sym == @symbol(ERROR_DISK_FULL)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2063
	RETURN ( __MKSMALLINT(ERROR_DISK_FULL) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2064
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2065
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2066
#ifdef ERROR_ERROR_SHARING_VIOLATION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2067
    if (sym == @symbol(ERROR_ERROR_SHARING_VIOLATION)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2068
	RETURN ( __MKSMALLINT(ERROR_ERROR_SHARING_VIOLATION) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2069
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2070
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2071
#ifdef ERROR_LOCK_VIOLATION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2072
    if (sym == @symbol(ERROR_LOCK_VIOLATION)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2073
	RETURN ( __MKSMALLINT(ERROR_LOCK_VIOLATION) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2074
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2075
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2076
#ifdef ERROR_INVALID_PARAMETER
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2077
    if (sym == @symbol(ERROR_INVALID_PARAMETER)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2078
	RETURN ( __MKSMALLINT(ERROR_INVALID_PARAMETER) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2079
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2080
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2081
#ifdef ERROR_NET_WRITE_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2082
    if (sym == @symbol(ERROR_NET_WRITE_FAULT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2083
	RETURN ( __MKSMALLINT(ERROR_NET_WRITE_FAULT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2084
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2085
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2086
#ifdef ERROR_NOT_SUPPORTED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2087
    if (sym == @symbol(ERROR_NOT_SUPPORTED)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2088
	RETURN ( __MKSMALLINT(ERROR_NOT_SUPPORTED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2089
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2090
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2091
#ifdef ERROR_REM_NOT_LIST
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2092
    if (sym == @symbol(ERROR_REM_NOT_LIST)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2093
	RETURN ( __MKSMALLINT(ERROR_REM_NOT_LIST) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2094
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2095
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2096
#ifdef ERROR_NETWORK_ACCESS_DENIED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2097
    if (sym == @symbol(ERROR_NETWORK_ACCESS_DENIED)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2098
	RETURN ( __MKSMALLINT(ERROR_NETWORK_ACCESS_DENIED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2099
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2100
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2101
#ifdef ERROR_DUP_NAME
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2102
    if (sym == @symbol(ERROR_DUP_NAME)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2103
	RETURN ( __MKSMALLINT(ERROR_DUP_NAME) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2104
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2105
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2106
#ifdef ERROR_BAD_NETPATH
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2107
    if (sym == @symbol(ERROR_BAD_NETPATH)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2108
	RETURN ( __MKSMALLINT(ERROR_BAD_NETPATH) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2109
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2110
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2111
#ifdef ERROR_NETWORK_BUSY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2112
    if (sym == @symbol(ERROR_NETWORK_BUSY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2113
	RETURN ( __MKSMALLINT(ERROR_NETWORK_BUSY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2114
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2115
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2116
#ifdef ERROR_DRIVE_LOCKED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2117
    if (sym == @symbol(ERROR_DRIVE_LOCKED)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2118
	RETURN ( __MKSMALLINT(ERROR_DRIVE_LOCKED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2119
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2120
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2121
#ifdef ERROR_INVALID_DRIVE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2122
    if (sym == @symbol(ERROR_INVALID_DRIVE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2123
	RETURN ( __MKSMALLINT(ERROR_INVALID_DRIVE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2124
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2125
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2126
#ifdef ERROR_WRONG_DISK
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2127
    if (sym == @symbol(ERROR_WRONG_DISK)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2128
	RETURN ( __MKSMALLINT(ERROR_WRONG_DISK) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2129
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2130
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2131
#ifdef ERROR_CURRENT_DIRECTORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2132
    if (sym == @symbol(ERROR_CURRENT_DIRECTORY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2133
	RETURN ( __MKSMALLINT(ERROR_CURRENT_DIRECTORY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2134
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2135
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2136
#ifdef ERROR_CANNOT_MAKE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2137
    if (sym == @symbol(ERROR_CANNOT_MAKE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2138
	RETURN ( __MKSMALLINT(ERROR_CANNOT_MAKE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2139
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2140
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2141
#ifdef ERROR_NO_MORE_FILES
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2142
    if (sym == @symbol(ERROR_NO_MORE_FILES)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2143
	RETURN ( __MKSMALLINT(ERROR_NO_MORE_FILES) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2144
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2145
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2146
#ifdef ERROR_NOT_READY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2147
    if (sym == @symbol(ERROR_NOT_READY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2148
	RETURN ( __MKSMALLINT(ERROR_NOT_READY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2149
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2150
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2151
#ifdef ERROR_NOT_DOS_DISK
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2152
    if (sym == @symbol(ERROR_NOT_DOS_DISK)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2153
	RETURN ( __MKSMALLINT(ERROR_NOT_DOS_DISK) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2154
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2155
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2156
#ifdef ERROR_OUT_OF_PAPER
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2157
    if (sym == @symbol(ERROR_OUT_OF_PAPER)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2158
	RETURN ( __MKSMALLINT(ERROR_OUT_OF_PAPER) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2159
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2160
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2161
#ifdef ERROR_PRINTQ_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2162
    if (sym == @symbol(ERROR_PRINTQ_FULL)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2163
	RETURN ( __MKSMALLINT(ERROR_PRINTQ_FULL) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2164
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2165
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2166
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2167
    /*
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2168
     * POSIX errnos - these should be defined
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2169
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2170
#ifdef EPERM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2171
    if (sym == @symbol(EPERM)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2172
	RETURN ( __MKSMALLINT(EPERM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2173
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2174
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2175
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2176
#ifdef ENOENT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2177
    if (sym == @symbol(ENOENT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2178
	RETURN ( __MKSMALLINT(ENOENT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2179
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2180
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2181
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2182
#ifdef ESRCH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2183
    if (sym == @symbol(ESRCH)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2184
	RETURN ( __MKSMALLINT(ESRCH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2185
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2186
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2187
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2188
#ifdef EINTR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2189
    if (sym == @symbol(EINTR)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2190
	RETURN ( __MKSMALLINT(EINTR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2191
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2192
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2193
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2194
#ifdef EIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2195
    if (sym == @symbol(EIO)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2196
	RETURN ( __MKSMALLINT(EIO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2197
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2198
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2199
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2200
#ifdef ENXIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2201
    if (sym == @symbol(ENXIO)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2202
	RETURN ( __MKSMALLINT(ENXIO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2203
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2204
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2205
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2206
#ifdef E2BIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2207
    if (sym == @symbol(E2BIG)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2208
	RETURN ( __MKSMALLINT(E2BIG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2209
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2210
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2211
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2212
#ifdef ENOEXEC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2213
    if (sym == @symbol(ENOEXEC)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2214
	RETURN ( __MKSMALLINT(ENOEXEC) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2215
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2216
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2217
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2218
#ifdef EBADF
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2219
    if (sym == @symbol(EBADF)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2220
	RETURN ( __MKSMALLINT(EBADF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2221
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2222
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2223
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2224
#ifdef ECHILD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2225
    if (sym == @symbol(ECHILD)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2226
	RETURN ( __MKSMALLINT(ECHILD) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2227
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2228
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2229
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2230
#if defined(EAGAIN)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2231
    if (sym == @symbol(EAGAIN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2232
	RETURN ( __MKSMALLINT(EAGAIN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2233
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2234
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2235
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2236
#ifdef ENOMEM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2237
    if (sym == @symbol(ENOMEM)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2238
	RETURN ( __MKSMALLINT(ENOMEM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2239
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2240
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2241
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2242
#ifdef EACCES
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2243
    if (sym == @symbol(EACCES)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2244
	RETURN ( __MKSMALLINT(EACCES) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2245
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2246
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2247
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2248
#ifdef EFAULT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2249
    if (sym == @symbol(EFAULT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2250
	RETURN ( __MKSMALLINT(EFAULT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2251
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2252
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2253
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2254
#ifdef EBUSY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2255
    if (sym == @symbol(EBUSY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2256
	RETURN ( __MKSMALLINT(EBUSY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2257
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2258
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2259
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2260
#ifdef EXDEV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2261
    if (sym == @symbol(EXDEV)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2262
	RETURN ( __MKSMALLINT(EXDEV) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2263
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2264
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2265
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2266
#ifdef ENODEV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2267
    if (sym == @symbol(ENODEV)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2268
	RETURN ( __MKSMALLINT(ENODEV) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2269
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2270
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2271
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2272
#ifdef ENOTDIR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2273
    if (sym == @symbol(ENOTDIR)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2274
	RETURN ( __MKSMALLINT(ENOTDIR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2275
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2276
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2277
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2278
#ifdef EISDIR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2279
    if (sym == @symbol(EISDIR)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2280
	RETURN ( __MKSMALLINT(EISDIR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2281
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2282
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2283
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2284
#ifdef EINVAL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2285
    if (sym == @symbol(EINVAL)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2286
	RETURN ( __MKSMALLINT(EINVAL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2287
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2288
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2289
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2290
#ifdef ENFILE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2291
    if (sym == @symbol(ENFILE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2292
	RETURN ( __MKSMALLINT(ENFILE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2293
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2294
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2295
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2296
#ifdef EMFILE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2297
    if (sym == @symbol(EMFILE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2298
	RETURN ( __MKSMALLINT(EMFILE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2299
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2300
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2301
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2302
#ifdef ENOTTY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2303
    if (sym == @symbol(ENOTTY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2304
	RETURN ( __MKSMALLINT(ENOTTY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2305
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2306
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2307
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2308
#ifdef EFBIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2309
    if (sym == @symbol(EFBIG)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2310
	RETURN ( __MKSMALLINT(EFBIG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2311
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2312
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2313
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2314
#ifdef ENOSPC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2315
    if (sym == @symbol(ENOSPC)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2316
	RETURN ( __MKSMALLINT(ENOSPC) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2317
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2318
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2319
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2320
#ifdef ESPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2321
    if (sym == @symbol(ESPIPE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2322
	RETURN ( __MKSMALLINT(ESPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2323
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2324
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2325
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2326
#ifdef EROFS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2327
    if (sym == @symbol(EROFS)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2328
	RETURN ( __MKSMALLINT(EROFS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2329
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2330
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2331
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2332
#ifdef EMLINK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2333
    if (sym == @symbol(EMLINK)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2334
	RETURN ( __MKSMALLINT(EMLINK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2335
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2336
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2337
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2338
#ifdef EPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2339
    if (sym == @symbol(EPIPE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2340
	RETURN ( __MKSMALLINT(EPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2341
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2342
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2343
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2344
#ifdef EDOM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2345
    if (sym == @symbol(EDOM)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2346
	RETURN ( __MKSMALLINT(EDOM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2347
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2348
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2349
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2350
#ifdef ERANGE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2351
    if (sym == @symbol(ERANGE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2352
	RETURN ( __MKSMALLINT(ERANGE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2353
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2354
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2355
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2356
#ifdef EDEADLK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2357
    if (sym == @symbol(EDEADLK)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2358
	RETURN ( __MKSMALLINT(EDEADLK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2359
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2360
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2361
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2362
#ifdef ENAMETOOLONG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2363
    if (sym == @symbol(ENAMETOOLONG)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2364
	RETURN ( __MKSMALLINT(ENAMETOOLONG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2365
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2366
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2367
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2368
#ifdef ENOLCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2369
    if (sym == @symbol(ENOLCK)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2370
	RETURN ( __MKSMALLINT(ENOLCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2371
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2372
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2373
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2374
#ifdef ENOSYS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2375
    if (sym == @symbol(ENOSYS)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2376
	RETURN ( __MKSMALLINT(ENOSYS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2377
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2378
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2379
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2380
#ifdef ENOTEMPTY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2381
    if (sym == @symbol(ENOTEMPTY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2382
	RETURN ( __MKSMALLINT(ENOTEMPTY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2383
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2384
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2385
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2386
#ifdef EEXIST
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2387
    if (sym == @symbol(EEXIST)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2388
	RETURN ( __MKSMALLINT(EEXIST) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2389
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2390
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2391
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2392
#ifdef EILSEQ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2393
    if (sym == @symbol(EILSEQ)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2394
	RETURN ( __MKSMALLINT(EILSEQ) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2395
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2396
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2397
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2398
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2399
     * XPG3 errnos - defined on most systems
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2400
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2401
#ifdef ENOTBLK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2402
    if (sym == @symbol(ENOTBLK)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2403
	RETURN ( __MKSMALLINT(ENOTBLK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2404
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2405
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2406
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2407
#ifdef ETXTBSY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2408
    if (sym == @symbol(ETXTBSY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2409
	RETURN ( __MKSMALLINT(ETXTBSY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2410
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2411
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2412
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2413
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2414
     * some others
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2415
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2416
#ifdef EWOULDBLOCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2417
    if (sym == @symbol(EWOULDBLOCK)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2418
	RETURN ( __MKSMALLINT(EWOULDBLOCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2419
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2420
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2421
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2422
#ifdef ENOMSG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2423
    if (sym == @symbol(ENOMSG)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2424
	RETURN ( __MKSMALLINT(ENOMSG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2425
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2426
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2427
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2428
#ifdef ELOOP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2429
    if (sym == @symbol(ELOOP)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2430
	RETURN ( __MKSMALLINT(ELOOP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2431
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2432
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2433
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2434
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2435
     * some stream errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2436
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2437
#ifdef ETIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2438
    if (sym == @symbol(ETIME)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2439
	RETURN ( __MKSMALLINT(ETIME) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2440
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2441
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2442
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2443
#ifdef ENOSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2444
    if (sym == @symbol(ENOSR)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2445
	RETURN ( __MKSMALLINT(ENOSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2446
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2447
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2448
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2449
#ifdef ENOSTR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2450
    if (sym == @symbol(ENOSTR)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2451
	RETURN ( __MKSMALLINT(ENOSTR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2452
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2453
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2454
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2455
#ifdef ECOMM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2456
    if (sym == @symbol(ECOMM)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2457
	RETURN ( __MKSMALLINT(ECOMM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2458
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2459
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2460
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2461
#ifdef EPROTO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2462
    if (sym == @symbol(EPROTO)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2463
	RETURN ( __MKSMALLINT(EPROTO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2464
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2465
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2466
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2467
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2468
     * nfs errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2469
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2470
#ifdef ESTALE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2471
    if (sym == @symbol(ESTALE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2472
	RETURN ( __MKSMALLINT(ESTALE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2473
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2474
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2475
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2476
#ifdef EREMOTE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2477
    if (sym == @symbol(EREMOTE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2478
	RETURN ( __MKSMALLINT(EREMOTE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2479
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2480
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2481
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2482
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2483
     * some networking errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2484
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2485
#ifdef EINPROGRESS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2486
    if (sym == @symbol(EINPROGRESS)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2487
	RETURN ( __MKSMALLINT(EINPROGRESS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2488
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2489
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2490
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2491
#ifdef EALREADY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2492
    if (sym == @symbol(EALREADY)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2493
	RETURN ( __MKSMALLINT(EALREADY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2494
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2495
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2496
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2497
#ifdef ENOTSOCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2498
    if (sym == @symbol(ENOTSOCK)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2499
	RETURN ( __MKSMALLINT(ENOTSOCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2500
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2501
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2502
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2503
#ifdef EDESTADDRREQ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2504
    if (sym == @symbol(EDESTADDRREQ)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2505
	RETURN ( __MKSMALLINT(EDESTADDRREQ) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2506
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2507
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2508
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2509
#ifdef EMSGSIZE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2510
    if (sym == @symbol(EMSGSIZE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2511
	RETURN ( __MKSMALLINT(EMSGSIZE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2512
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2513
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2514
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2515
#ifdef EPROTOTYPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2516
    if (sym == @symbol(EPROTOTYPE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2517
	RETURN ( __MKSMALLINT(EPROTOTYPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2518
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2519
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2520
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2521
#ifdef ENOPROTOOPT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2522
    if (sym == @symbol(ENOPROTOOPT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2523
	RETURN ( __MKSMALLINT(ENOPROTOOPT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2524
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2525
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2526
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2527
#ifdef EPROTONOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2528
    if (sym == @symbol(EPROTONOSUPPORT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2529
	RETURN ( __MKSMALLINT(EPROTONOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2530
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2531
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2532
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2533
#ifdef ESOCKTNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2534
    if (sym == @symbol(ESOCKTNOSUPPORT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2535
	RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2536
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2537
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2538
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2539
#ifdef EOPNOTSUPP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2540
    if (sym == @symbol(EOPNOTSUPP)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2541
	RETURN ( __MKSMALLINT(EOPNOTSUPP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2542
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2543
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2544
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2545
#ifdef EPFNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2546
    if (sym == @symbol(EPFNOSUPPORT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2547
	RETURN ( __MKSMALLINT(EPFNOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2548
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2549
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2550
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2551
#ifdef EAFNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2552
    if (sym == @symbol(EAFNOSUPPORT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2553
	RETURN ( __MKSMALLINT(EAFNOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2554
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2555
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2556
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2557
#ifdef EADDRINUSE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2558
    if (sym == @symbol(EADDRINUSE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2559
	RETURN ( __MKSMALLINT(EADDRINUSE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2560
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2561
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2562
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2563
#ifdef EADDRNOTAVAIL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2564
    if (sym == @symbol(EADDRNOTAVAIL)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2565
	RETURN ( __MKSMALLINT(EADDRNOTAVAIL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2566
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2567
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2568
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2569
#ifdef ETIMEDOUT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2570
    if (sym == @symbol(ETIMEDOUT)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2571
	RETURN ( __MKSMALLINT(ETIMEDOUT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2572
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2573
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2574
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2575
#ifdef ECONNREFUSED
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2576
    if (sym == @symbol(ECONNREFUSED)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2577
	RETURN ( __MKSMALLINT(ECONNREFUSED) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2578
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2579
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2580
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2581
#ifdef ENETDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2582
    if (sym == @symbol(ENETDOWN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2583
	RETURN ( __MKSMALLINT(ENETDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2584
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2585
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2586
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2587
#ifdef ENETUNREACH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2588
    if (sym == @symbol(ENETUNREACH)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2589
	RETURN ( __MKSMALLINT(ENETUNREACH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2590
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2591
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2592
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2593
#ifdef ENETRESET
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2594
    if (sym == @symbol(ENETRESET)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2595
	RETURN ( __MKSMALLINT(ENETRESET) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2596
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2597
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2598
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2599
#ifdef ECONNABORTED
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2600
    if (sym == @symbol(ECONNABORTED)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2601
	RETURN ( __MKSMALLINT(ECONNABORTED) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2602
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2603
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2604
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2605
#ifdef ECONNRESET
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2606
    if (sym == @symbol(ECONNRESET)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2607
	RETURN ( __MKSMALLINT(ECONNRESET) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2608
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2609
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2610
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2611
#ifdef EISCONN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2612
    if (sym == @symbol(EISCONN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2613
	RETURN ( __MKSMALLINT(EISCONN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2614
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2615
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2616
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2617
#ifdef ENOTCONN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2618
    if (sym == @symbol(ENOTCONN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2619
	RETURN ( __MKSMALLINT(ENOTCONN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2620
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2621
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2622
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2623
#ifdef ESHUTDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2624
    if (sym == @symbol(ESHUTDOWN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2625
	RETURN ( __MKSMALLINT(ESHUTDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2626
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2627
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2628
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2629
#ifdef EHOSTDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2630
    if (sym == @symbol(EHOSTDOWN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2631
	RETURN ( __MKSMALLINT(EHOSTDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2632
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2633
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2634
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2635
#ifdef EHOSTUNREACH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2636
    if (sym == @symbol(EHOSTUNREACH)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2637
	RETURN ( __MKSMALLINT(EHOSTUNREACH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2638
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2639
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2640
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2641
    ^ -1
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2642
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2643
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2644
!Win32OperatingSystem class methodsFor:'executing OS commands'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2645
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2646
canExecuteCommand:aCommandString
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2647
    "return true, if the OS can execute aCommand."
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2648
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2649
    |fn|
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2650
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2651
    fn := aCommandString asFilename.
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2652
    ( #('com' 'exe') includes:fn suffix) ifFalse:[^ false].
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2653
    ^ super canExecuteCommand:aCommandString
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2654
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2655
    "
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2656
     OperatingSystem canExecuteCommand:'fooBar'  
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2657
     OperatingSystem canExecuteCommand:'ls'     
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2658
     OperatingSystem canExecuteCommand:'cvs'    
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2659
     OperatingSystem canExecuteCommand:'cvs.exe'     
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2660
     OperatingSystem canExecuteCommand:'C:\Dokumente und Einstellungen\penk\work\stx\projects\smalltalk\cvs.exe'  
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2661
     OperatingSystem canExecuteCommand:'C:\Windows\cvs.exe'  
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2662
    "
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2663
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2664
    "Created: 4.11.1995 / 19:13:54 / cg"
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2665
!
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2666
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2667
commandAndArgsForOSCommand:aCommandString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2668
    "get a shell and shell arguments for command execution"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2669
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2670
    |shell args wDir path words hasRedirection|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2671
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2672
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2673
    "/ 'x:\WINNT\System32\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2674
    "/ or 'x:\WINDOWS\System32\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2675
    "/ or 'x:\WINDOWS\System\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2676
    "/ or whatever ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2677
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2678
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2679
    "/ to workaround a bug in win95's command.com 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2680
    "/ (which always returns a 0-exit code 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2681
    "/  - even if the command failed),
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2682
    "/ Here, we see if the command is found along the path and
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2683
    "/ call it directly if found.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2684
    "/ If not found, assume its a builtIn or batch command
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2685
    "/ and pass it to command.com.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2686
    "/ Also use command.com, if any I/O redirection is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2687
    "/ involved, since that is (not yet) handled here.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2688
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2689
    "/ I know: this is a kludge but should work for now...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2690
    "/ ...this will change in an upcoming version to include
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2691
    "/ command.com command-line parsing here (sigh).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2692
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2693
    hasRedirection := false.
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2694
    (aCommandString isNil or:[aCommandString includesAny:'<>|']) ifTrue:[
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2695
        hasRedirection := true
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2696
    ].
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2697
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2698
    self isMSWINDOWSNTlike ifTrue:[
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2699
        hasRedirection ifFalse:[ |size name|
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2700
            "/ test whether the commandString is an executable;
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2701
            "/ than no shell is required
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2702
            name := aCommandString withoutSeparators.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2703
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2704
            name notEmpty ifTrue:[|index file suffix|
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2705
                index := name indexOfSeparatorStartingAt:1.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2706
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2707
                index ~~ 0 ifTrue:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2708
                    name := name copyFrom:1 to:(index -1).
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2709
                ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2710
                file   := name asFilename.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2711
                suffix := file suffix.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2712
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2713
                suffix isEmptyOrNil ifTrue:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2714
                    suffix := 'exe'.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2715
                    file := file withSuffix:suffix.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2716
                ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2717
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2718
                (file exists and:[suffix = 'exe']) ifTrue:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2719
                    "/ is an executable, no shell required
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2720
                    ^ Array with:nil with:aCommandString.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2721
                ]
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2722
            ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2723
        ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2724
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2725
        shell := self getEnvironment:'COMSPEC'.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2726
        shell isNil ifTrue:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2727
            wDir := self getWindowsSystemDirectory asFilename.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2728
            shell := (wDir construct:'cmd.exe').
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2729
            shell exists ifFalse:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2730
                shell := (wDir construct:'command.com').
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2731
                shell exists ifFalse:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2732
                    self error:'no command.com available'.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2733
                ]
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2734
            ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2735
            shell := shell pathName.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2736
        ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2737
        aCommandString isNil ifTrue:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2738
            ^ Array with:nil with:shell
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2739
        ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2740
        ^ Array with:nil with:(shell , ' /c ' , aCommandString)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2741
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2742
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2743
    "/ I/O redirection is not yet handled directly
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2744
    "/ fallBack to command.com (below) to do it.
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2745
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2746
    hasRedirection ifFalse:[
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2747
        words := aCommandString asCollectionOfSubstringsSeparatedBy:Character space.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2748
        args := ' '.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2749
        words from:2 to:(words size) do:[:s | 
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2750
            args := args , (s , ' ').
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2751
        ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2752
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2753
        path := self pathOfCommand:(words at:1).
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2754
        path notNil ifTrue:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2755
            "/ execute the command directly -
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2756
            "/ without going through command.com
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2757
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2758
            self isMSWINDOWSNTlike ifTrue:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2759
                args := path , args.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2760
            ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2761
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2762
            ^ Array with:path with:args
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2763
        ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2764
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2765
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2766
    "/ I/O redirection or no executable was found
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2767
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2768
    shell := self getEnvironment:'COMSPEC'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2769
    shell isNil ifTrue:[
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2770
        wDir := self getWindowsSystemDirectory asFilename.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2771
        shell := (wDir construct:'cmd.exe').
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2772
        shell exists ifFalse:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2773
            shell := (wDir construct:'command.com').
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2774
            shell exists ifFalse:[
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2775
                self error:'no command.com available'.
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2776
            ]
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2777
        ].
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2778
        shell := shell pathName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2779
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2780
    aCommandString isNil ifTrue:[
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2781
        ^ Array with:shell with:shell
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2782
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2783
    ^ Array with:shell with:(shell , ' /c ' , aCommandString)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2784
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2785
    "Modified: / 20.1.1998 / 16:57:19 / md"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2786
    "Modified: / 19.5.1999 / 10:01:24 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2787
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2788
7080
a82683bc1843 Cleanup closeDescriptor handling in exec:withArguments:...
Stefan Vogel <sv@exept.de>
parents: 7077
diff changeset
  2789
exec:aCommandPath withArguments:argString environment:environment fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2790
    "Internal lowLevel entry for combined fork & exec for WIN32
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2791
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2792
     If fork is false (chain a command):
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2793
	 execute the OS command specified by the argument, aCommandPath, with
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2794
	 arguments in argArray (no arguments, if nil).
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2795
	 If successful, this method does not return and smalltalk is gone.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2796
	 If not successful, it does return.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2797
	 Normal use is with forkForCommand.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2798
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2799
     If fork is true (subprocess command execution):
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2800
	fork a child to do the above.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2801
	The process id of the child process is returned; nil if the fork failed.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2802
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2803
     fdArray contains the filedescriptors, to be used for the child (if fork is true).
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2804
	fdArray[1] = 15 -> use fd 15 as stdin.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2805
	If an element of the array is set to nil, the corresponding filedescriptor
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2806
	will be closed for the child.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2807
	fdArray[0] == StdIn for child
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2808
	fdArray[1] == StdOut for child
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2809
	fdArray[2] == StdErr for child
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2810
	on VMS, these must be channels as returned by createMailBox.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2811
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2812
     NOTE that in WIN32 the fds are HANDLES.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2813
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2814
     If newPgrp is true, the subprocess will be established in a new process group.
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2815
	The processgroup will be equal to id.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2816
	newPgrp is not used on WIN32 and VMS systems."
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  2817
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  2818
    |dirPath cmdPath cmdLine rslt|
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2819
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2820
    aDirectory notNil ifTrue:[
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2821
	dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2822
	(dirPath endsWith:':') ifTrue:[
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2823
	    dirPath := dirPath , '\'.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2824
	].
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2825
    ].
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2826
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2827
    self isMSWINDOWSNTlike ifTrue:[
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2828
	cmdPath := aCommandPath.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2829
	cmdLine := argString
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2830
    ] ifFalse:[
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2831
	cmdPath := 'stxspawn.exe'.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2832
	cmdLine := 'stxspawn.exe ' , aCommandPath , ' ' , argString
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2833
    ].
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2834
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  2835
    rslt := self 
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2836
	primExec:cmdPath 
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2837
	commandLine:cmdLine 
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2838
	fileDescriptors:fdArray 
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2839
	fork:doFork 
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2840
	newPgrp:newPgrp 
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2841
	inPath:dirPath
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  2842
	createFlags:nil.
7841
c25e1dc957b8 debugPrint removed
ca
parents: 7840
diff changeset
  2843
c25e1dc957b8 debugPrint removed
ca
parents: 7840
diff changeset
  2844
"/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  2845
    ^ rslt
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2846
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2847
    "Modified: / 31.1.1998 / 10:54:24 / md"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2848
    "Modified: / 15.5.1999 / 18:07:51 / cg"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2849
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2850
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2851
getStatusOfProcess:aProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2852
    "wait for a process to terminate and fetch its exit status.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2853
     This is required to avoid zombie processes."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2854
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2855
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2856
    DWORD endStatus;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2857
    int status = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2858
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  2859
    if (__isExternalAddressLike(aProcessId)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2860
	HANDLE handle = _HANDLEVal(aProcessId);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2861
	if (handle) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2862
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2863
	    do {    
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2864
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2865
		endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, handle, INFINITE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2866
	    } while ((endStatus < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2867
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2868
	    endStatus = WaitForSingleObject(handle , INFINITE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2869
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2870
	    if (endStatus != WAIT_FAILED) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2871
		if (GetExitCodeProcess(handle,&endStatus)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2872
		    status = endStatus;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2873
#ifdef PROCESSDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2874
		    fprintf(stderr, "getexitcode status = %d\n",status);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2875
		} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2876
		    fprintf(stderr, "getexitcode failed.\n");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2877
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2878
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2879
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2880
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2881
	RETURN ( __MKSMALLINT(status));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2882
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2883
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2884
    self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2885
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2886
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2887
pathOfCommand:aCommand
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2888
    "find where aCommand's executable file is;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2889
     return its full pathName if there is such a command, otherwise
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2890
     return nil."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2891
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2892
    |path f fExt|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2893
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2894
    aCommand asFilename isAbsolute ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2895
	aCommand asFilename exists ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2896
	    ^ aCommand
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2897
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2898
	^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2899
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2900
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2901
    path := self getEnvironment:'PATH'.   
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2902
    path notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2903
	(path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2904
	    path isEmpty ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2905
		f := aCommand asFilename
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2906
	    ] ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2907
		f := path asFilename construct:aCommand.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2908
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2909
	    self executableFileExtensions do:[:ext |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2910
		ext notEmpty ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2911
		    fExt := (f pathName , '.' , ext) asFilename.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2912
		] ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2913
		    fExt := f.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2914
		].    
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2915
		fExt isExecutable ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2916
		    ^ fExt pathName
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2917
		].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2918
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  2919
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2920
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2921
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2922
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2923
    "windows:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2924
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2925
     OperatingSystem pathOfCommand:'bcc32'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2926
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2927
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2928
    "Modified: / 10.9.1998 / 17:51:49 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2929
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2930
7080
a82683bc1843 Cleanup closeDescriptor handling in exec:withArguments:...
Stefan Vogel <sv@exept.de>
parents: 7077
diff changeset
  2931
primExec:commandPath commandLine:commandLine fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inPath:dirName createFlags:flagsOrNil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2932
    "Internal lowLevel entry for combined fork & exec for WIN32"
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  2933
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  2934
    |handle|
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  2935
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  2936
    handle := Win32ProcessHandle new.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2937
%{  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2938
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2939
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2940
     * if fork is false, chain to another command (not yet supported)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2941
     * otherwise, spawn a subprocess and let it execute the command.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2942
     * Currently, only the forking version is supported (who chains anyway ?)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2943
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2944
#if 0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2945
    char fullCmdPathBuffer[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2946
    char fullCmdLine[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2947
    char fullDirName[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2948
    char *fullCmdPath = fullCmdPathBuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2949
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2950
    char *cmdPath = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2951
    char *cmdLine = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2952
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2953
    char *dir = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2954
    DWORD               fdwCreate = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2955
    STARTUPINFO         lpsiStartInfo;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2956
    PROCESS_INFORMATION lppiProcInfo;
7070
c84a77aeb893 *** empty log message ***
penk
parents: 7066
diff changeset
  2957
    SECURITY_ATTRIBUTES sa;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2958
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2959
    if (__isString(dirName)) {
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2960
	dir = __stringVal(dirName);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2961
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2962
    if ((__isString(commandPath) || (commandPath == nil))
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2963
     && __isString(commandLine)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2964
#if 0
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2965
	/*
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2966
	 * generate command line (cmd plus args)
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2967
	 */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2968
	if (__isWinNT) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2969
	    char *d;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2970
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2971
	    strcpy(fullCmdPath, __stringVal(aCommandPath));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2972
	    d = strchr(fullCmdPath,' ');
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2973
	    if (d) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2974
		*d++ = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2975
		strcpy(fullCmdLine, d);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2976
	    } else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2977
		fullCmdLine[0] = '\0';
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2978
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2979
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2980
	    //fullCmdPath = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2981
	    strcpy(fullCmdPath,"stxspawn.exe");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2982
	    strcpy(fullCmdLine,"stxspawn.exe ");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2983
	    strcat(fullCmdLine, __stringVal(aCommandPath));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2984
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2985
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2986
	if (__isString(argArray)) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2987
	    if (strlen(fullCmdLine) > 0) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2988
		strcat(fullCmdLine, " ");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2989
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2990
	    strcat(fullCmdLine, __stringVal(argArray));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2991
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2992
	    int i;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2993
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2994
	    for (i=0; i<__arraySize(argArray); i++) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2995
		OBJ arg = __ArrayInstPtr(argArray)->a_element[i];
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2996
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2997
		if (__isString(arg)) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2998
		    strcat(fullCmdLine, " ");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  2999
		    strcat(fullCmdLine, __stringVal(arg));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3000
		} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3001
		    /* ignore */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3002
		    fprintf(stderr, "bad (non-string) arg\n");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3003
		}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3004
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3005
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3006
#endif
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3007
	if (commandPath != nil) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3008
	    cmdPath = __stringVal(commandPath);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3009
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3010
	cmdLine = __stringVal(commandLine);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3011
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3012
	/*
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3013
	 * create descriptors as req'd
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3014
	 */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3015
	sa.nLength = sizeof( sa );
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3016
	sa.lpSecurityDescriptor = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3017
	sa.bInheritHandle = TRUE;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3018
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3019
	memset(&lppiProcInfo, 0, sizeof (lppiProcInfo));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3020
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3021
	memset(&lpsiStartInfo, 0, sizeof (lpsiStartInfo));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3022
	lpsiStartInfo.cb                = sizeof(lpsiStartInfo);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3023
	lpsiStartInfo.lpReserved        = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3024
	lpsiStartInfo.lpDesktop         = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3025
	lpsiStartInfo.lpTitle           = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3026
	lpsiStartInfo.dwX               = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3027
	lpsiStartInfo.dwY               = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3028
	lpsiStartInfo.dwXSize           = 100;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3029
	lpsiStartInfo.dwYSize           = 100;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3030
	lpsiStartInfo.dwXCountChars     = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3031
	lpsiStartInfo.dwYCountChars     = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3032
	lpsiStartInfo.dwFillAttribute   = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3033
	if (0 /*__isWinNT*/) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3034
	    lpsiStartInfo.dwFlags           = STARTF_USESTDHANDLES;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3035
	    lpsiStartInfo.wShowWindow       = SW_SHOWDEFAULT;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3036
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3037
	    lpsiStartInfo.dwFlags           = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES /*| STARTF_USEPOSITION*/;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3038
	    lpsiStartInfo.wShowWindow       = SW_HIDE /*SW_SHOWDEFAULT*/;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3039
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3040
	lpsiStartInfo.cbReserved2       = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3041
	lpsiStartInfo.lpReserved2       = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3042
	lpsiStartInfo.hStdInput         = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3043
	lpsiStartInfo.hStdOutput        = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3044
	lpsiStartInfo.hStdError         = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3045
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3046
	/* 
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3047
	 * set create process flags 
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3048
	 * if the flags arg is nil, use common defaults;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3049
	 * if non-nil, it must be a positive integer containing the fdwCreate bits.
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3050
	 */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3051
	if (flagsOrNil != nil) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3052
	    fdwCreate = __longIntVal(flagsOrNil);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3053
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3054
	    if (0 /* __isWinNT */)
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3055
		fdwCreate = 0; //IDLE_PRIORITY_CLASS;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3056
	    else
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3057
		fdwCreate = CREATE_NEW_CONSOLE; //|IDLE_PRIORITY_CLASS; // DETACHED_PROCESS; // NORMAL_PRIORITY_CLASS ;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3058
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3059
	    if (newPgrp == true) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3060
		fdwCreate |= CREATE_NEW_PROCESS_GROUP;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3061
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3062
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3063
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3064
	if (fdArray == nil) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3065
	    lpsiStartInfo.hStdInput  = (HANDLE) _get_osfhandle (0);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3066
	    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (1);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3067
	    lpsiStartInfo.hStdError  = (HANDLE) _get_osfhandle (2);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3068
	} else if (__isArray(fdArray) && (__arraySize(fdArray) >= 3)) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3069
	    if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3070
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[0])) {
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3071
		    lpsiStartInfo.hStdInput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3072
		} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3073
		    lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3074
		}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3075
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3076
	    if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3077
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[1])) {
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3078
		    lpsiStartInfo.hStdOutput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3079
		} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3080
		    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3081
		}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3082
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3083
	    if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3084
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[2])) {
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3085
		    lpsiStartInfo.hStdError  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3086
		} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3087
		    lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3088
		}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3089
	    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3090
#ifdef PROCESSDEBUGWIN32
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3091
	    fprintf(stderr, "stdin %x\n", lpsiStartInfo.hStdInput);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3092
	    fprintf(stderr, "stdout %x\n",lpsiStartInfo.hStdOutput);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3093
	    fprintf(stderr, "stderr %x\n",lpsiStartInfo.hStdError);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3094
#endif
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3095
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3096
	    fprintf(stderr, "Win32OS: bad fd arg in createProcess\n");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3097
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3098
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3099
	if (doFork == true) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3100
#ifdef PROCESSDEBUGWIN32
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3101
	    fprintf(stderr, "create process cmdPath:<%s> cmdLine:<%s> in <%s>\n", cmdPath, cmdLine, dir);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3102
#endif
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3103
	    if (CreateProcess(  cmdPath,
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3104
				cmdLine,
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3105
				&sa, &sa,           /* sec-attribs */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3106
				sa.bInheritHandle,  /* inherit handles */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3107
				fdwCreate,
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3108
				NULL,               /* env */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3109
				dir,
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3110
				&lpsiStartInfo,
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3111
				&lppiProcInfo ))
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3112
	    {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3113
		CloseHandle(lppiProcInfo.hThread);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3114
#ifdef PROCESSDEBUGWIN32
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3115
		fprintf(stderr, "created process hProcess=%x\n", lppiProcInfo.hProcess);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3116
#endif
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3117
		__externalAddressVal(handle) = lppiProcInfo.hProcess;
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3118
		RETURN (handle);
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3119
	    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3120
#ifdef PROCESSDEBUGWIN32
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3121
	    fprintf(stderr, "created process error %d\n", GetLastError());
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3122
#endif
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3123
	    RETURN (nil);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3124
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3125
	    ; /* should never be called that way */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3126
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3127
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3128
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3129
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3130
     path-argument not string
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3131
     or argArray not an array/nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3132
     or malloc failed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3133
     or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3134
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3135
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3136
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3137
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3138
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream 
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3139
    errorTo:anExternalErrStream auxFrom:anAuxiliaryStream 
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3140
    environment:anEvironmentDictionary inDirectory:dir
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3141
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3142
    "start executing the OS command as specified by the argument, aCommandString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3143
     as a separate process; do not wait for the command to finish.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3144
     The commandString is passed to a shell for execution - see the description of
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3145
     'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3146
     The command gets stdIn, stdOut and stdErr assigned from the arguments;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3147
     each may be nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3148
     Return the processId if successful, nil otherwise.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3149
     Use #monitorPid:action: for synchronization and exec status return,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3150
     or #killProcess: to stop it."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3151
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3152
    |nullStream in out err shellAndArgs rslt auxFd|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3153
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3154
    aCommandString isNil ifTrue:[^ nil].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3155
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3156
    (in := anExternalInStream) isNil ifTrue:[
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3157
	nullStream := Filename nullDevice readWriteStream.
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3158
	in := nullStream. 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3159
    ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3160
    (out := anExternalOutStream) isNil ifTrue:[
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3161
	nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3162
	out := nullStream.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3163
    ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3164
    (err := anExternalErrStream) isNil ifTrue:[
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3165
	err := out
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3166
    ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3167
    anAuxiliaryStream notNil ifTrue:[
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3168
	auxFd := anAuxiliaryStream fileDescriptor
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  3169
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3170
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3171
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3172
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3173
    rslt := self
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3174
	exec:(shellAndArgs at:1)
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3175
	withArguments:(shellAndArgs at:2)
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3176
	environment:anEvironmentDictionary
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3177
	fileDescriptors:(Array with:in fileDescriptor
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3178
			       with:out fileDescriptor
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3179
			       with:err fileDescriptor
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3180
			       with:auxFd)
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3181
	fork:true
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3182
	newPgrp:true "/ false
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3183
	inDirectory:dir.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3184
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3185
    nullStream notNil ifTrue:[
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3186
	nullStream close.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3187
    ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3188
    ^ rslt
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3189
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3190
    "blocking at current prio (i.e. only higher prio threads execute):
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3191
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3192
     OperatingSystem executeCommand:'ls -l > out'.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3193
    "
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3194
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3195
    "non-blocking (lower prio threads continue):
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3196
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3197
     |in out err pid sema|
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3198
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3199
     in := 'out' asFilename readStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3200
     out := 'out2' asFilename writeStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3201
     err := 'err' asFilename writeStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3202
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3203
     sema := Semaphore new.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3204
     pid := OperatingSystem startProcess:'sleep 10; grep drw' inputFrom:in outputTo:out errorTo:err.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3205
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3206
     The following will no longer work. monitorPid has disappeared 
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3207
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3208
     pid notNil ifTrue:[
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3209
	 Processor monitorPid:pid action:[:OSstatus | sema signal ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3210
     ].
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3211
     in close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3212
     out close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3213
     err close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3214
     sema wait.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3215
     Transcript showCR:'finished'
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3216
    "
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3217
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3218
    "Modified: / 21.3.1997 / 10:04:35 / dq"
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3219
    "Modified: / 15.7.1997 / 16:03:51 / stefan"
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3220
    "Modified: / 5.6.1998 / 19:03:51 / cg"
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3221
    "Created: / 12.11.1998 / 14:39:20 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3222
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3223
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3224
!Win32OperatingSystem class methodsFor:'file access'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3225
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3226
closeFd:anIntegerOrHandle
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3227
    "low level close of a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3228
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3229
%{
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3230
    if (__isExternalAddressLike(anIntegerOrHandle) ) {
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3231
       if( !CloseHandle( anIntegerOrHandle ) ) {
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3232
	   fprintf( stderr, "Could not close handle : %x\n", anIntegerOrHandle);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3233
       }
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3234
       RETURN(self);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3235
    }
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3236
    if (__isSmallInteger(anIntegerOrHandle)) {
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3237
	close(__intVal(anIntegerOrHandle));
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3238
	RETURN(self);
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3239
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3240
%}.
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3241
    ^ self primitiveFailed.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3242
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3243
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3244
createDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3245
    "create a new directory with name 'aPathName', which may be an absolute
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3246
     path, or relative to the current directory.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3247
     Return true if successful (or the directory existed already), false if failed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3248
     This is a low-level entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3249
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3250
    "/ if it already exists this is ok
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3251
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3252
    (self isDirectory:aPathName) ifTrue:[^ true].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3253
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3254
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3255
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3256
	int ret;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3257
	SECURITY_ATTRIBUTES sa;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3258
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3259
	sa.nLength = sizeof( sa );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3260
	sa.lpSecurityDescriptor = NULL;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3261
	sa.bInheritHandle = TRUE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3262
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3263
	ret = CreateDirectory(__stringVal(aPathName), &sa);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3264
	if (ret != TRUE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3265
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3266
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3267
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3268
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3269
	RETURN (true);
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  3270
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3271
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3272
    self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3273
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3274
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3275
     OperatingSystem createDirectory:'foo'  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3276
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3277
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3278
    "Modified: 20.12.1995 / 11:24:13 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3279
    "Modified: 29.6.1996 / 14:06:54 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3280
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3281
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3282
createFileForReadAppend:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3283
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3284
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3285
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3286
createFileForReadWrite:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3287
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE' #'CREATE_ALWAYS')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3288
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3289
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3290
linkFile:oldPath to:newPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3291
    "link the file 'oldPath' to 'newPath'. The link will be a hard link.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3292
     Return true if successful, false if not."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3293
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3294
    (oldPath isString not or:[newPath isString not]) ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3295
	"/
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3296
	"/ bad argument(s) given
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3297
	"/
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3298
	^ self primitiveFailed 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3299
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3300
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3301
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3302
    "/ this OperatingSystem does not support links
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3303
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3304
    ^ UnsupportedOperationSignal raise
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3305
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3306
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3307
     OperatingSystem linkFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3308
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3309
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3310
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3311
openFile:pathName attributes:attributeSpec
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3312
    "non public internal helper.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3313
     open a file, return an os specific fileHandle. 
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3314
     attributes is a collection of symbols specifying how the file is
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3315
     to be opened."
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3316
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3317
    |fileHandle errorNumber argumentError|
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3318
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3319
    fileHandle := Win32Handle new.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3320
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3321
%{
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3322
    HANDLE h;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3323
    char *name;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3324
    OBJ *ap = __ArrayInstPtr(attributeSpec)->a_element;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3325
    int numAttrib = __arraySize(attributeSpec);
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3326
    int i;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3327
    DWORD access, share, create, attr;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3328
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3329
    if (! __isString(pathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3330
	fileHandle = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3331
	argumentError = @symbol(badPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3332
	goto badArgument;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3333
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3334
    if (! __isArray(attributeSpec)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3335
	fileHandle = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3336
	argumentError = @symbol(badAttributeSpec);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3337
	goto badArgument;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3338
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3339
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3340
    name = __stringVal(pathName);    
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3341
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3342
    share = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3343
    access = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3344
    create = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3345
    attr = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3346
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3347
    for (i=0; i<numAttrib;i++) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3348
	OBJ attrSym = ap[i];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3349
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3350
	if (attrSym == @symbol(FILE_SHARE_READ)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3351
	    share |= FILE_SHARE_READ;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3352
	} else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3353
	    share |= FILE_SHARE_WRITE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3354
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3355
	} else if (attrSym == @symbol(GENERIC_READ)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3356
	    access |= GENERIC_READ;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3357
	} else if (attrSym == @symbol(GENERIC_WRITE)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3358
	    access |= GENERIC_WRITE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3359
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3360
	} else if (attrSym == @symbol(CREATE_NEW)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3361
	    create |= CREATE_NEW;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3362
	} else if (attrSym == @symbol(CREATE_ALWAYS)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3363
	    create |= CREATE_ALWAYS;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3364
	} else if (attrSym == @symbol(OPEN_EXISTING)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3365
	    create |= OPEN_EXISTING;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3366
	} else if (attrSym == @symbol(OPEN_ALWAYS)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3367
	    create |= OPEN_ALWAYS;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3368
	} else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3369
	    create |= TRUNCATE_EXISTING;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3370
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3371
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3372
	    attr |= FILE_ATTRIBUTE_HIDDEN;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3373
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3374
	    attr |= FILE_ATTRIBUTE_READONLY;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3375
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3376
	    attr |= FILE_ATTRIBUTE_READONLY;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3377
	} else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3378
	    attr |= FILE_FLAG_WRITE_THROUGH;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3379
	} else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3380
	    attr |= FILE_FLAG_SEQUENTIAL_SCAN;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3381
	} else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3382
	    attr |= FILE_FLAG_DELETE_ON_CLOSE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3383
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3384
	    fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3385
	}
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3386
    }
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3387
    if (create == 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3388
	fileHandle = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3389
	argumentError = @symbol(missingCreateMode);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3390
	goto badArgument;
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3391
    }
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3392
fprintf(stderr, "name:<%s> access:%x share:%x create:%x attr:%x\n",
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3393
		name, access, share, create, attr);
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3394
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3395
    h = CreateFile(name, access, share, 0 /* sa */, create, attr, 0 /* hTempl */);
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3396
    if (h != INVALID_HANDLE_VALUE) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3397
	__externalAddressVal(fileHandle) = (void *)h;  
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3398
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3399
	fileHandle = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3400
	errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3401
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3402
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3403
badArgument: ;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3404
%}.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3405
    fileHandle notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3406
	fileHandle registerForFinalization.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3407
	^ fileHandle.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3408
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3409
    errorNumber isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3410
	self error:'invalid argument(s): ', argumentError.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3411
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3412
	(self errorHolderForNumber:errorNumber) reportError
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3413
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3414
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3415
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3416
openFileForAppend:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3417
     ^ self halt
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3418
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3419
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3420
openFileForRead:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3421
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3422
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3423
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3424
openFileForReadAppend:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3425
     ^ self halt
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3426
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3427
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3428
openFileForReadWrite:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3429
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3430
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3431
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3432
openFileForWrite:pathName
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  3433
     ^ self openFile:pathName attributes:#(#'GENERIC_WRITE' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3434
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3435
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3436
recursiveCopyDirectory:sourcePathName to:destination
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3437
    "copy the directory named 'sourcePathName' and all contained files/directories to 'destination'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3438
     Return true if successful."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3439
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3440
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3441
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3442
    "Modified: / 4.6.1998 / 04:29:49 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3443
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3444
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3445
removeDirectory:fullPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3446
    "remove the directory named 'fullPathName'. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3447
     The directory must be empty and you must have appropriate access rights.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3448
     Return true if successful, false if directory is not empty or no permission.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3449
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3450
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3451
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3452
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3453
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3454
    if (__isString(fullPathName)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3455
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3456
	{
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3457
	    char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3458
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3459
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3460
	    do {    
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3461
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3462
		ret = STX_API_CALL1( "RemoveDirectory", RemoveDirectory, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3463
	    } while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3464
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3465
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3466
	ret = RemoveDirectory((char *)__stringVal(fullPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3467
	__threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3468
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3469
	if (ret != TRUE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3470
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3471
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3472
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3473
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3474
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3475
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3476
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3477
    "/ either not a string argument,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3478
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3479
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3480
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3481
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3482
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3483
     OperatingSystem createDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3484
     OperatingSystem removeDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3485
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3486
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3487
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3488
removeFile:fullPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3489
    "remove the file named 'fullPathName'; return true if successful.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3490
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3491
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3492
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3493
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3494
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3495
    if (__isString(fullPathName)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3496
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3497
	{
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3498
	    char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3499
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3500
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3501
	    do {    
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3502
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3503
		ret = STX_API_CALL1( "DeleteFile", DeleteFile, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3504
	    } while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3505
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3506
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3507
	ret = DeleteFile((char *)__stringVal(fullPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3508
	__threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3509
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3510
	if (ret != TRUE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3511
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3512
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3513
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3514
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3515
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3516
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3517
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3518
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3519
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3520
renameFile:oldPath to:newPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3521
    "rename the file 'oldPath' to 'newPath'. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3522
     Someone else has to care for the names to be correct and 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3523
     correct for the OS used - therefore, this should not be called
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3524
     directlt. Instead, use Filename protocol to rename; this cares for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3525
     any invalid names.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3526
     Returns true if successful, false if not"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3527
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3528
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3529
    int ret, eno;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3530
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3531
    if (__isString(oldPath) && __isString(newPath)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3532
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3533
	char _oldPath[MAXPATHLEN], _newPath[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3534
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3535
	strncpy(_oldPath, __stringVal(oldPath), MAXPATHLEN-1); _oldPath[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3536
	strncpy(_newPath, __stringVal(newPath), MAXPATHLEN-1); _newPath[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3537
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3538
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3539
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3540
	    ret = STX_C_CALL2( "rename", rename, _oldPath, _newPath);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3541
	} while ((ret < 0) && (__threadErrno == EINTR));
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  3542
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3543
	__BEGIN_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3544
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3545
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3546
	    ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3547
	} while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3548
	__END_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3549
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3550
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3551
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3552
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3553
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3554
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3555
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3556
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3557
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3558
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3559
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3560
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3561
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3562
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3563
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3564
     OperatingSystem renameFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3565
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3566
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3567
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3568
truncateFile:aPathName to:newSize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3569
    "change a files size return true on success, false on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3570
     This may not be supported on all architectures.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3571
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3572
     This is a low-level entry - use Filename protocol."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3573
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3574
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3575
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3576
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3577
!Win32OperatingSystem class methodsFor:'file access rights'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3578
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3579
accessMaskFor:aSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3580
    "return the access bits mask for numbers as returned by 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3581
     OperatingSystem>>accessModeOf:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3582
     and expected by OperatingSystem>>changeAccessModeOf:to:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3583
     Since these numbers are OS dependent, always use the mask
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3584
     (never hardcode 8rxxx into your code)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3585
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3586
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3587
    /* posix systems should define these ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3588
#   ifndef S_IRUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3589
#    define S_IRUSR 0400
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3590
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3591
#   ifndef S_IWUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3592
#    define S_IWUSR 0200
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3593
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3594
#   ifndef S_IXUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3595
#    define S_IXUSR 0100
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3596
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3597
#   ifndef S_IRGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3598
#    define S_IRGRP 0040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3599
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3600
#   ifndef S_IWGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3601
#    define S_IWGRP 0020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3602
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3603
#   ifndef S_IXGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3604
#    define S_IXGRP 0010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3605
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3606
#   ifndef S_IROTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3607
#    define S_IROTH 0004
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3608
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3609
#   ifndef S_IWOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3610
#    define S_IWOTH 0002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3611
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3612
#   ifndef S_IXOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3613
#    define S_IXOTH 0001
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3614
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3615
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3616
    if (aSymbol == @symbol(readUser)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3617
	RETURN ( __MKSMALLINT(S_IRUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3618
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3619
    if (aSymbol == @symbol(writeUser)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3620
	RETURN ( __MKSMALLINT(S_IWUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3621
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3622
    if (aSymbol == @symbol(executeUser)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3623
	RETURN ( __MKSMALLINT(S_IXUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3624
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3625
    if (aSymbol == @symbol(readGroup)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3626
	RETURN ( __MKSMALLINT(S_IRGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3627
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3628
    if (aSymbol == @symbol(writeGroup)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3629
	RETURN ( __MKSMALLINT(S_IWGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3630
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3631
    if (aSymbol == @symbol(executeGroup)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3632
	RETURN ( __MKSMALLINT(S_IXGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3633
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3634
    if (aSymbol == @symbol(readOthers)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3635
	RETURN ( __MKSMALLINT(S_IROTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3636
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3637
    if (aSymbol == @symbol(writeOthers)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3638
	RETURN ( __MKSMALLINT(S_IWOTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3639
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3640
    if (aSymbol == @symbol(executeOthers)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3641
	RETURN ( __MKSMALLINT(S_IXOTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3642
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3643
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3644
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3645
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3646
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3647
     OperatingSystem accessMaskFor:#readUser
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3648
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3649
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3650
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3651
accessModeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3652
    "return a number representing access rights rwxrwxrwx for owner,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3653
     group and others. Return nil if such a file does not exist.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3654
     Notice that the returned number is OS dependent - use the 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3655
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3656
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3657
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3658
     this could have been implemented as:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3659
	(self infoOf:aPathName) at:#mode
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3660
     but for huge directory searches the code below is faster
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3661
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3662
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3663
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3664
    struct stat buf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3665
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3666
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3667
    if (__isString(aPathName)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3668
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3669
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3670
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3671
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3672
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3673
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3674
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3675
	    ret = STX_C_CALL2( "stat", stat, _aPathName, &buf);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3676
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3677
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3678
	__BEGIN_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3679
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3680
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3681
	    ret = stat( (char *)__stringVal(aPathName), &buf);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3682
	} while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3683
	__END_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3684
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3685
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3686
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3687
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3688
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3689
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3690
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3691
	    RETURN ( nil );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3692
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3693
	RETURN ( __MKSMALLINT(buf.st_mode & 0777) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3694
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3695
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3696
   ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3697
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3698
   "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3699
    (OperatingSystem accessModeOf:'/') printStringRadix:8
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3700
   "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3701
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3702
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3703
changeAccessModeOf:aPathName to:modeBits
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3704
    "change the access rights of aPathName to the OS dependent modeBits.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3705
     You should construct this mask using accessMaskFor, to be OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3706
     independent. Return true if changed, 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3707
     false if such a file does not exist or change was not allowd."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3708
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3709
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3710
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3711
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3712
    if (__isString(aPathName) && __isSmallInteger(modeBits)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3713
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3714
	int chmod();
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3715
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3716
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3717
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3718
	do { 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3719
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3720
	    ret = STX_C_CALL2( "chmod", chmod, _aPathName, __intVal(modeBits));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3721
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3722
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3723
	__BEGIN_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3724
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3725
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3726
	    ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3727
	} while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3728
	__END_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3729
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3730
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3731
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3732
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3733
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3734
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3735
	    RETURN ( false );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3736
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3737
	RETURN ( true );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3738
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3739
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3740
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3741
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3742
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3743
!Win32OperatingSystem class methodsFor:'file queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3744
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3745
caseSensitiveFilenames
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3746
    "return true, if the OS has caseSensitive file naming.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3747
     On MSDOS, this will return false; 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3748
     on a real OS, we return true."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3749
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3750
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3751
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3752
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3753
compressPath:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3754
    "return the pathName compressed - that is, remove all ..-entries
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3755
     and . entries. This does not always (in case of symbolic links)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3756
     return the true pathName and is therefore used as a fallback
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3757
     if realPath and popen failed."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3758
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3759
    |names n "{ Class: SmallInteger }" |
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3760
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3761
    names := pathName 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3762
		asCollectionOfSubstringsSeparatedBy:self fileSeparator.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3763
    names := names asOrderedCollection.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3764
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3765
     cut off initial double-slashes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3766
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3767
    [names startsWith:#('' '')] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3768
	names removeFirst.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3769
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3770
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3771
     cut off double-slashes at end
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3772
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3773
    [names endsWith:#('')] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3774
	names removeLast.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3775
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3776
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3777
     cut off current-dir at beginning
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3778
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3779
    n := names size.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3780
    [(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3781
	names removeFirst.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3782
	n := n - 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3783
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3784
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3785
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3786
     cut off parent-dirs at end
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3787
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3788
    [(n > 2) 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3789
     and:[(names endsWith:#('..'))
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3790
     and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3791
	names removeLast; removeLast.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3792
	n := n - 2.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3793
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3794
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3795
    ^ names asStringWith:self fileSeparator 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3796
		    from:1
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3797
		    to:n
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3798
		    compressTabs:false final:nil 
7077
e9103f7f3b6d change example comments from / to \
penk
parents: 7070
diff changeset
  3799
e9103f7f3b6d change example comments from / to \
penk
parents: 7070
diff changeset
  3800
    "
e9103f7f3b6d change example comments from / to \
penk
parents: 7070
diff changeset
  3801
     OperatingSystem compressPath:'.\..'    
e9103f7f3b6d change example comments from / to \
penk
parents: 7070
diff changeset
  3802
     OperatingSystem compressPath:'\foo\bar\baz\..'  
7102
415388639cdd changes claus
penk
parents: 7080
diff changeset
  3803
     OperatingSystem compressPath:'foo\bar\baz\..'  
7077
e9103f7f3b6d change example comments from / to \
penk
parents: 7070
diff changeset
  3804
     OperatingSystem compressPath:'foo\bar\baz\..\'  
e9103f7f3b6d change example comments from / to \
penk
parents: 7070
diff changeset
  3805
     OperatingSystem compressPath:'foo\bar\baz\..\\\' 
e9103f7f3b6d change example comments from / to \
penk
parents: 7070
diff changeset
  3806
     OperatingSystem compressPath:'\\\foo\bar\baz\..\\\' 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3807
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3808
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3809
    "Modified: 1.11.1996 / 20:13:48 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3810
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3811
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3812
fileSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3813
    "return the character used to separate names in a path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3814
     This character differs for MSDOS and other systems,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3815
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3816
      preparation for the future)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3817
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3818
    ^ $\
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3819
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3820
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3821
getDiskInfoOf:aVolumeName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3822
    "returns a dictionary filled with any of:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3823
	freeBytes
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3824
	totalBytes
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3825
     and possibly additional (OS-specific) information"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3826
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3827
    |info ok sectorsPerCluster bytesPerSector freeClusters totalClusters
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3828
     type|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3829
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3830
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3831
    DWORD __sectorsPerCluster, __bytesPerSector, __freeClusters, __totalClusters;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3832
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3833
    if (__isString(aVolumeName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3834
	if (GetDiskFreeSpace(__stringVal(aVolumeName),
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3835
			     &__sectorsPerCluster,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3836
			     &__bytesPerSector,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3837
			     &__freeClusters, 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3838
			     &__totalClusters) == TRUE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3839
	    sectorsPerCluster = __MKUINT(__sectorsPerCluster);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3840
	    bytesPerSector = __MKUINT(__bytesPerSector);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3841
	    freeClusters = __MKUINT(__freeClusters);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3842
	    totalClusters = __MKUINT(__totalClusters);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3843
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3844
	    switch (GetDriveType(__stringVal(aVolumeName))) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3845
		case DRIVE_REMOVABLE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3846
		    type = @symbol(removable); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3847
		case DRIVE_FIXED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3848
		    type = @symbol(fixed); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3849
		case DRIVE_REMOTE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3850
		    type = @symbol(network); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3851
		case DRIVE_CDROM:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3852
		    type = @symbol(cdrom); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3853
		case DRIVE_RAMDISK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3854
		    type = @symbol(ramdisk); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3855
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3856
	    ok = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3857
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3858
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3859
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3860
    ok == true ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3861
	info := IdentityDictionary new.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3862
	info at:#sectorsPerCluster put:sectorsPerCluster.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3863
	info at:#bytesPerSector put:bytesPerSector.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3864
	info at:#freeClusters put:freeClusters.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3865
	info at:#totalClusters put:totalClusters.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3866
	info at:#freeBytes put:(freeClusters * sectorsPerCluster * bytesPerSector).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3867
	info at:#totalBytes put:(totalClusters * sectorsPerCluster * bytesPerSector).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3868
	type notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3869
	    info at:#type put:type
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3870
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3871
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3872
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3873
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3874
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3875
     self getDiskInfoOf:'c:\'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3876
     self getDiskInfoOf:'d:\'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3877
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3878
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3879
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3880
getDriveList
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3881
    "return a list of volumes in the system. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3882
     On unix, no such thing like a volume exists 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3883
     - there, a syntetic list with root, home & current is returned. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3884
     On MSDOS, a list of drive letters is (eventually) returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3885
     On VMS, a list of volumes is (eventually) returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3886
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3887
    |list|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3888
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3889
    list := OrderedCollection new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3890
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3891
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3892
     * add drive letters as strings to list ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3893
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3894
    char buffer[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3895
    char *cp;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3896
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3897
    GetLogicalDriveStrings(1023, buffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3898
    for (cp=buffer; *cp; ) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3899
      __SSEND1(list, @symbol(add:), 0, __MKSTRING(cp));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3900
      cp += strlen(cp) + 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3901
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3902
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3903
    ^ list
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3904
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3905
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3906
getFileVersionInfoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3907
    "retrieves the versionData from an executable or dll.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3908
     The returned value is either a byteArray, which should be
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3909
     processed further with extractVersionValue (VerQueryValue),
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3910
     or nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3911
     This is a WIN32 specific entry, not for common usage."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3912
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3913
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3914
	int sz;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3915
	DWORD dummy;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3916
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3917
	sz = GetFileVersionInfoSize(__stringVal(aPathName), &dummy);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3918
	if (sz > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3919
	    OBJ versionData;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3920
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3921
	    versionData = __BYTEARRAY_UNINITIALIZED_NEW_INT(sz);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3922
	    if (versionData == nil) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3923
		RETURN (nil);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3924
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3925
	    if (GetFileVersionInfo(__stringVal(aPathName), 0, sz, __ByteArrayInstPtr(versionData)->ba_element) == FALSE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3926
		RETURN (nil);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3927
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3928
	    RETURN (versionData);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3929
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3930
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3931
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3932
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3933
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3934
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3935
getNullDevice
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3936
    "get the name of the null-device."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3937
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3938
    ^ 'nul'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3939
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3940
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3941
infoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3942
    "return some object filled with info for the file 'aPathName';
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3943
     the info (for which corresponding access methods are understood by
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3944
     the returned object) is:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3945
	 type            - a symbol giving the files type
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3946
	 mode            - numeric access mode 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3947
	 uid             - owners user id
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3948
	 gid             - owners group id
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3949
	 size            - files size
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3950
	 id              - files number (i.e. inode number)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3951
	 accessed        - last access time (as Timestamp)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3952
	 modified        - last modification time (as Timestamp)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3953
	 statusChanged   - last status change time (as Timestamp)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3954
	 alternativeName - (windows only:) the MSDOS name of the file
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3955
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3956
     Some of the fields may be returned as nil on systems which do not provide
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3957
     all of the information.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3958
     Return nil if such a file does not exist. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3959
     For symbolic links (if supported by the OS), 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3960
     the info of the pointed-to-file (i.e. the target) is returned;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3961
     use #linkInfoOf: to get info about the link itself.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3962
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3963
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3964
    |info type mode uid gid size id 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3965
     atime mtime ctime 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3966
     aYr aMon aDay aHr aMin aSec aMS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3967
     mYr mMon mDay mHr mMin mSec mMS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3968
     cYr cMon cDay cHr cMin cSec cMS
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3969
     fileName alternativeName|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3970
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3971
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3972
    struct stat buf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3973
    int ret;
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3974
    char alternativeFileNameBuffer[15];
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3975
    char fileNameBuffer[MAX_PATH+1];
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3976
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3977
    unsigned INT ino;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3978
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3979
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3980
	HANDLE hFile;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3981
	SYSTEMTIME creationTime;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3982
	SYSTEMTIME accessTime;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3983
	SYSTEMTIME modificationTime;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3984
	int modeBits = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3985
	WIN32_FIND_DATA findStruct;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3986
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3987
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3988
	{
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3989
	    char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3990
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3991
	    strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3992
	    do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3993
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3994
		hFile = STX_API_CALL2( "FindFirstFile", FindFirstFile, _aPathName, &findStruct);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3995
	    } while ((hFile < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3996
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3997
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3998
	hFile = FindFirstFile(__stringVal(aPathName), &findStruct);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3999
	if (hFile < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4000
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4001
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4002
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4003
	if (! hFile || (hFile == (HANDLE)(-1)) || (hFile == INVALID_HANDLE_VALUE)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4004
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4005
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4006
	    FindClose(hFile);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4007
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4008
	    id = __MKSMALLINT(0);   /* could get it by opening ... */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4009
	    size = __MKLARGEINT64(1, findStruct.nFileSizeLow, findStruct.nFileSizeHigh);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4010
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4011
	    if (findStruct.cFileName[0] != '\0') {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4012
		bcopy(findStruct.cFileName, fileNameBuffer, MAX_PATH);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4013
		fileNameBuffer[MAX_PATH] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4014
		fileName = __MKSTRING(fileNameBuffer);             /* FULL name */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4015
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4016
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4017
	    if (findStruct.cAlternateFileName[0] != '\0') {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4018
		bcopy(findStruct.cAlternateFileName, alternativeFileNameBuffer, 14);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4019
		alternativeFileNameBuffer[14] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4020
		alternativeName = __MKSTRING(alternativeFileNameBuffer); /* DOS name */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4021
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4022
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4023
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4024
	     * simulate access bits
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4025
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4026
	    if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4027
		modeBits = 0444;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4028
	    } else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4029
		modeBits = 0666;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4030
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4031
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4032
	    if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4033
		type = @symbol(directory);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4034
		modeBits |= 0111;   /* executable */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4035
	    } else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4036
		type = @symbol(regular);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4037
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4038
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4039
	    mode = __MKSMALLINT(modeBits);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4040
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4041
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4042
	     * sigh - convert from stupid time to useful time
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4043
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4044
	    FileTimeToSystemTime(&(findStruct.ftCreationTime), &creationTime);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4045
	    FileTimeToSystemTime(&(findStruct.ftLastAccessTime), &accessTime);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4046
	    FileTimeToSystemTime(&(findStruct.ftLastWriteTime), &modificationTime);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4047
	    aYr  = __MKSMALLINT(accessTime.wYear);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4048
	    aMon = __MKSMALLINT(accessTime.wMonth);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4049
	    aDay = __MKSMALLINT(accessTime.wDay);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4050
	    aHr  = __MKSMALLINT(accessTime.wHour);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4051
	    aMin = __MKSMALLINT(accessTime.wMinute);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4052
	    aSec = __MKSMALLINT(accessTime.wSecond);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4053
	    aMS  = __MKSMALLINT(accessTime.wMilliseconds);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4054
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4055
	    mYr  = __MKSMALLINT(modificationTime.wYear);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4056
	    mMon = __MKSMALLINT(modificationTime.wMonth);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4057
	    mDay = __MKSMALLINT(modificationTime.wDay);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4058
	    mHr  = __MKSMALLINT(modificationTime.wHour);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4059
	    mMin = __MKSMALLINT(modificationTime.wMinute);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4060
	    mSec = __MKSMALLINT(modificationTime.wSecond);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4061
	    mMS  = __MKSMALLINT(modificationTime.wMilliseconds);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4062
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4063
	    cYr  = __MKSMALLINT(creationTime.wYear);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4064
	    cMon = __MKSMALLINT(creationTime.wMonth);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4065
	    cDay = __MKSMALLINT(creationTime.wDay);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4066
	    cHr  = __MKSMALLINT(creationTime.wHour);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4067
	    cMin = __MKSMALLINT(creationTime.wMinute);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4068
	    cSec = __MKSMALLINT(creationTime.wSecond);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4069
	    cMS  = __MKSMALLINT(creationTime.wMilliseconds);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4070
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4071
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4072
%}.
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4073
    mode isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4074
	(self isDirectory:aPathName) ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4075
	    "/ the code above fails for root directories (these do not exist).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4076
	    "/ simulate
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4077
	    mode := 8r777.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4078
	    type := #directory.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4079
	    uid := gid := 0.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4080
	    size := 0.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4081
	    id := 0.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4082
	    atime := mtime := ctime := AbsoluteTime now.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4083
	].
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4084
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4085
    mode notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4086
	atime isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4087
	    atime := AbsoluteTime day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4088
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4089
	mtime isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4090
	    mtime := AbsoluteTime day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4091
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4092
	ctime isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4093
	    ctime := AbsoluteTime day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4094
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4095
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4096
	info := FileStatusInfo
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4097
		    type:type 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4098
		    mode:mode 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4099
		    uid:uid 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4100
		    gid:gid 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4101
		    size:size 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4102
		    id:id 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4103
		    accessed:atime 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4104
		    modified:mtime 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4105
		    created:ctime
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4106
		    path:nil            
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4107
		    fullName:fileName    
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4108
		    alternativeName:alternativeName.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4109
	^ info
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4110
   ].
6726
3447154f8aa4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6543
diff changeset
  4111
   ^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4112
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4113
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4114
    OperatingSystem infoOf:'c:\windows'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4115
    OperatingSystem infoOf:'stx.exe'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4116
    (OperatingSystem infoOf:'/') uid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4117
    (OperatingSystem infoOf:'/') accessed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4118
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4119
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4120
    "Modified: / 4.2.2002 / 17:15:08 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4121
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4122
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4123
isDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4124
    "return true, if 'aPathName' is a valid directory path name.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4125
     (i.e. exists and is a directory).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4126
     This also returns true for symbolic links pointing to a directory;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4127
     if you need to check for this, use #linkInfo:."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4129
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4130
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4131
	int ret;
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  4132
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4133
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4134
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4135
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4136
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4137
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4138
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4139
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4140
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4141
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4142
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4143
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4144
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4145
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4146
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4147
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4148
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4149
	    RETURN ( false );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4150
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4151
	RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4152
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4153
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4154
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4155
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4156
    "an alternative implementation would be:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4157
	^ (self infoOf:aPathName) type == #directory
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4158
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4159
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4160
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4161
isExecutable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4162
    "return true, if the given file is executable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4163
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4164
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4165
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4166
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4167
	int ret;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4168
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4169
	/*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4170
	 * under windows, there is no executable attribute ... 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4171
	 * so, only check for the files existence here.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4172
	 */
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  4173
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4174
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4175
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4176
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4177
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4178
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4179
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4180
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4181
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4182
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4183
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4184
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4185
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4186
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4187
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4188
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4189
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4190
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4191
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4192
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4193
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4194
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4195
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4196
isReadable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4197
    "return true, if the file/dir 'aPathName' is readable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4198
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4199
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4200
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4201
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4202
	int ret;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4203
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4204
	/*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4205
	 * under windows, all files are readable ... 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4206
	 * so, only check for the files existence here.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4207
	 */
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  4208
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4209
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4210
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4211
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4212
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4213
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4214
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4215
	} while ((ret < 0) && (__threadErrno == EINTR));
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  4216
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4217
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4218
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4219
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4220
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4221
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4222
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4223
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4224
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4225
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4226
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4227
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4228
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4229
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4230
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4231
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4232
isSymbolicLink:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4233
    "return true, if the given file is a symbolic link"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4234
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4235
    ^ (self linkInfoOf:aPathName) notNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4236
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4237
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4238
     OperatingSystem isSymbolicLink:'Make.proto'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4239
     OperatingSystem isSymbolicLink:'Makefile' 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4240
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4241
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4242
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4243
isValidPath:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4244
    "return true, if 'aPathName' is a valid path name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4245
     (i.e. the file or directory exists)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4246
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4247
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4248
    struct stat buf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4249
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4250
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4251
    if (__isString(aPathName) || __isSymbol(aPathName) ) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4252
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4253
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4254
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4255
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4256
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4257
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4258
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4259
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4260
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4261
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4262
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4263
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4264
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4265
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4266
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4267
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4268
	    RETURN ( false );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4269
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4270
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4271
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4272
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4273
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4274
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4275
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4276
isWritable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4277
    "return true, if the given file is writable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4278
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4279
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4280
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4281
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4282
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4283
    if (__isString(aPathName)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4284
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4285
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4286
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4287
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4288
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4289
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4290
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4291
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4292
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4293
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4294
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4295
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4296
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4297
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4298
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4299
	    @global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4300
	    RETURN ( false );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4301
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4302
	RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4303
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4304
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4305
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4306
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4307
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4308
linkInfoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4309
    "return a dictionary filled with info for the file 'aPathName',
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4310
     IFF aPathName is a symbolic link. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4311
     If aPathName is invalid, or its NOT a symbolic link, nil is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4312
     (which means, that systems like VMS or MSDOS always return nil here.)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4313
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4314
     The contents of the dictionary gives info about the link itself,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4315
     on contrast to #infoOf:, which returns the info of the pointed to file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4316
     in case of a symbolic link."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4317
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4318
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4319
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4320
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4321
mimeTypeForSuffix:aFileSuffix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4322
    "given a file suffix, return a corresponding mimeType.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4323
     Here, the Registry is consulted.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4324
     Returns nil if no mimeType for the given suffix is known."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4325
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4326
    ^ RegistryEntry 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4327
	stringValueFor:'Content Type'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4328
	atKey:('HKEY_CLASSES_ROOT\.' , aFileSuffix)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4329
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4330
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4331
     self mimeTypeForSuffix:'au'  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4332
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4333
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4334
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4335
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4336
parentDirectoryName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4337
    "return the name used to refer to parent directories.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4338
     In MSDOS, Unix and other systems this is '..', but maybe different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4339
     for other systems.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4340
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4341
      preparation for the future)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4342
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4343
    ^ '..'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4344
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4345
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4346
pathNameOf:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4347
    "return the pathName of the argument, aPathString,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4348
     - thats the full pathname of the directory, starting at '/'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4349
     This method needs the path to be valid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4350
     (i.e. all directories must exist, be readable and executable).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4351
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4352
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4353
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4354
    |p path|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4355
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4356
    "some systems have a convenient function for this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4357
    path := self primPathNameOf:pathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4358
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4359
    path isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4360
	(self isValidPath:pathName) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4361
	    p := pathName.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4362
	    [(p size > 1)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4363
	     and:[p endsWith:(self fileSeparator)]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4364
	    ] whileTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4365
		p := p copyWithoutLast:1.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4366
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4367
	    ^ p
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4368
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4369
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4370
	"/
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4371
	"/ return the original - there is nothing else can we do
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4372
	"/
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4373
	path := self compressPath:pathName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4374
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4375
    ^ path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4376
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4377
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4378
     OperatingSystem pathNameOf:'.'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4379
     OperatingSystem pathNameOf:'../smalltalk/../smalltalk'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4380
     OperatingSystem pathNameOf:'../../..'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4381
     OperatingSystem pathNameOf:'..'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4382
     OperatingSystem pathNameOf:'/tmp////' 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4383
     OperatingSystem pathNameOf:'/foo/bar' 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4384
     OperatingSystem pathNameOf:'/foo/bar/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4385
     OperatingSystem pathNameOf:'/foo/bar//'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4386
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4387
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4388
    "Modified: 29.11.1996 / 18:02:12 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4389
    "Modified: 10.1.1997 / 19:10:42 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4390
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4391
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4392
primIdOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4393
    "the actual code to return the fileNumber (i.e. inode number) of a file."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4394
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4395
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4396
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4397
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4398
primPathNameOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4399
    "return the pathName of the argument, aPathString,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4400
     - thats the full pathname of the directory, starting at '/'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4401
     This method here returns nil, if the OS does not provide a
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4402
     realPath library function.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4403
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4404
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4405
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4406
%{  /* xxSTACK: 16000 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4407
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4408
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4409
	char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4410
	char *pFinal;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4411
	int rslt;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4412
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4413
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4414
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4415
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4416
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4417
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4418
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4419
	    rslt = STX_API_CALL4( "GetFullPathName", GetFullPathName, _aPathName, sizeof(nameBuffer), nameBuffer, &pFinal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4420
	} while ((rslt < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4421
	if (rslt > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4422
	    do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4423
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4424
		rslt = STX_API_CALL3( "GetLongPathName", GetLongPathName, nameBuffer, nameBuffer, sizeof(nameBuffer));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4425
	    } while ((rslt < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4426
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4427
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4428
	rslt = GetFullPathName(__stringVal(aPathName), sizeof(nameBuffer), nameBuffer, &pFinal);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4429
	if (rslt > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4430
	    rslt = GetLongPathName(nameBuffer, nameBuffer, sizeof(nameBuffer));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4431
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4432
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4433
	if (rslt > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4434
	    RETURN ( __MKSTRING(nameBuffer) );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4435
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4436
	__threadErrno = __WIN32_ERR(GetLastError());
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4437
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4438
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4439
    ^ nil
7102
415388639cdd changes claus
penk
parents: 7080
diff changeset
  4440
"
415388639cdd changes claus
penk
parents: 7080
diff changeset
  4441
self primPathNameOf:'.'   
415388639cdd changes claus
penk
parents: 7080
diff changeset
  4442
"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4443
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4444
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4445
timeOfLastAccess:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4446
    "return the time, when the file was last accessed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4447
     For nonexistent files, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4448
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4449
    "could be implemented as:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4450
	(self infoOf:aPathName) accessed 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4451
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4452
    | i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4453
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4454
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  4455
    i notNil ifTrue:[^ i accessTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4456
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4457
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4458
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4459
     OperatingSystem timeOfLastAccess:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4460
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4461
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4462
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4463
timeOfLastChange:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4464
    "return the time, when the file was last changed. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4465
     For nonexistent files, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4466
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4467
    "could be implemented as:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4468
	(self infoOf:aPathName) modified
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4469
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4470
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4471
    | i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4472
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4473
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  4474
    i notNil ifTrue:[^ i modificationTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4475
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4476
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4477
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4478
     OperatingSystem timeOfLastChange:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4479
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4480
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4481
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4482
typeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4483
    "return the type of a file as a symbol; for nonexistent files,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4484
     nil is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4485
     Notice: for symbolic links, the type of the pointed-to file is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4486
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4487
    |i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4488
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4489
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4490
     this could have been implemented as:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4491
	(self infoOf:aPathName) type 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4492
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4493
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4494
    i := self infoOf:aPathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4495
    i notNil ifTrue:[^ i type].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4496
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4497
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4498
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4499
     OperatingSystem typeOf:'/'   
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4500
     OperatingSystem typeOf:'.'   
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4501
     OperatingSystem typeOf:'Make.proto' 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4502
     OperatingSystem typeOf:'resources/motif.style' 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4503
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4504
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4505
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4506
volumeNameOf:aPathString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4507
    "return the volumeName of the argument, aPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4508
     - thats the name of the volume where aPath is.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4509
     Not all OperatingSystem support/use volumes; on unix,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4510
     this always returns an empty string."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4511
7102
415388639cdd changes claus
penk
parents: 7080
diff changeset
  4512
    aPathString size < 2 ifTrue:[^ ''].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4513
    (aPathString at:2) == $: ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4514
	^ (aPathString at:1) asString.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4515
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4516
    ^ ''
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4517
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4518
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4519
!Win32OperatingSystem class methodsFor:'interrupts & signals'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4520
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4521
blockingTest
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4522
    "this is a test method;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4523
     For testing double CTRL-C in blocking primitives"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4524
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4525
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4526
    while(1) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4527
	printf("blocking...");
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4528
	Sleep(50);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4529
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4530
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4531
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4532
     OperatingSystem blockingTest 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4533
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4534
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4535
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4536
blockingTest2
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4537
    "this is a test method;
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4538
     For testing double CTRL-C in blocking primitives"
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4539
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4540
%{
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4541
    while(1) {
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4542
	printf("blocking...");
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4543
	STX_API_CALL1("Sleep", Sleep, 50);
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4544
    }
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4545
%}.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4546
    "
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4547
     OperatingSystem blockingTest2 
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4548
    "
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4549
!
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4550
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4551
defaultSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4552
    "revert to the default action on arrival of a (Unix-)signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4553
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4554
     WARNING: for some signals, it is no good idea to revert to default;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4555
     for example, the default for SIGINT (i.e. ^C) is to exit; while the
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4556
     default for SIGQUIT (^ \) is to dump core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4557
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4558
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4559
     a signal."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4560
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4561
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4562
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4563
    if (__isSmallInteger(signalNumber)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4564
#ifdef SIG_DFL
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4565
	signal(__intVal(signalNumber), SIG_DFL);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4566
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4567
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4568
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4569
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4570
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4571
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4572
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4573
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4574
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4575
    "you better save a snapshot image before trying this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4576
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4577
     'if you hit ^C now, Smalltalk will exit immediately' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4578
     OperatingSystem defaultSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4579
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4580
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4581
     'normal ^C handling again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4582
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4583
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4584
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4585
disableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4586
    "turn off IO interrupts for a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4587
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4588
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4589
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4590
     or if the OS does not support IO interrupts.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4591
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4592
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4593
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4594
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4595
disableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4596
    "disable (Unix-) signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4597
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4598
     WARNING: for some signals, it is no good idea to disable
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4599
     them; for example, disabling the SIGINT signal turns off ^C
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4600
     handling.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4601
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4602
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4603
     a signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4604
     Use only for fully debugged stand alone applications."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4605
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4606
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4607
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4608
    if (__isSmallInteger(signalNumber)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4609
	int sigNo = __intVal(signalNumber);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4610
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4611
	if (sigNo == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4612
	    RETURN (self);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4613
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4614
#ifdef SIG_IGN
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4615
	signal(sigNo, SIG_IGN);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4616
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4617
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4618
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4619
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4620
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4621
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4622
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4623
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4624
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4625
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4626
     'now, ^C is totally ignored ...' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4627
     OperatingSystem disableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4628
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4629
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4630
     '^C handled again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4631
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4632
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4633
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4634
disableTimer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4635
    "disable timer interrupts.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4636
     WARNING: 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4637
	the system will not operate correctly with timer interrupts
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4638
	disabled, because no scheduling or timeouts are possible."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4639
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4640
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4641
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4642
    extern void __win32ClearTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4643
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4644
    __win32ClearTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4645
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4646
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4647
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4648
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4649
enableChildSignalInterrupts
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4650
    "enable childSignal interrupts 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4651
     (SIGCHLD, if the architecture supports it).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4652
     After enabling, these signals will send the message 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4653
     'childSignalInterrupt' to the ChildSignalInterruptHandler object."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4654
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4655
    self enableSignal:(self sigCHLD)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4656
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4657
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4658
enableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4659
    "turn on IO interrupts for a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4660
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4661
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4662
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4663
     or if the system does not support SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4664
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4665
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4666
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4667
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4668
enableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4669
    "enable (Unix-)signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4670
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4671
     The signal will be delivered to one of the standard handlers
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4672
     (SIGINT, SIGQUIT, etc) or to a general handler, which
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4673
     sends #signalInterrupt:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4674
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4675
     NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4676
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4677
     a signal."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4678
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4679
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4680
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4681
#ifdef NSIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4682
# define SIG_LIMIT NSIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4683
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4684
# ifdef SIGUSR2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4685
#  define SIG_LIMIT SIGUSR2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4686
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4687
#  ifdef SIGUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4688
#   define SIG_LIMIT SIGUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4689
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4690
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4691
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4692
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4693
#if defined(SIGPOLL) && !defined(SIGIO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4694
# define SIGIO SIGPOLL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4695
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4696
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4697
#ifdef SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4698
# define CHILD_SIGNAL   SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4699
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4700
# ifdef SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4701
#  define CHILD_SIGNAL  SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4702
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4703
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4704
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4705
    int sigNr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4706
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4707
#if defined(SIGINT) || defined(SIGQUIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4708
# ifndef __signalUserInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4709
    extern void __signalUserInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4710
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4711
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4712
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4713
#ifdef SIGFPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4714
# ifndef __signalFpExceptionInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4715
    extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4716
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4717
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4718
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4719
#ifdef SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4720
# ifndef __signalIoInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4721
    extern void __signalIoInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4722
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4723
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4724
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4725
#ifdef CHILD_SIGNAL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4726
# ifndef __signalChildInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4727
    extern void __signalChildInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4728
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4729
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4730
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4731
#ifdef SIGPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4732
# ifndef __signalPIPEInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4733
    extern void __signalPIPEInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4734
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4735
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4736
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4737
#ifdef SIGBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4738
# ifndef __signalBUSInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4739
    extern void __signalBUSInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4740
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4741
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4742
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4743
#ifdef SIGSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4744
# ifndef __signalSEGVInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4745
    extern void __signalSEGVInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4746
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4747
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4748
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4749
#if defined(SIGILL) || defined(SIGEMT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4750
# ifndef __signalTrapInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4751
    extern void __signalTrapInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4752
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4753
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4754
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4755
#ifdef SIGALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4756
# ifndef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4757
#  ifndef __signalTimerInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4758
    extern void __signalTimerInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4759
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4760
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4761
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4762
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4763
#ifndef __signalInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4764
    extern void __signalInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4765
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4766
    void (*handler)(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4767
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4768
    if (__isSmallInteger(signalNumber)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4769
     && ((sigNr = __intVal(signalNumber)) >= 0)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4770
#ifdef SIG_LIMIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4771
     &&  (sigNr <= SIG_LIMIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4772
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4773
    ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4774
	/*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4775
	 * standard signals are forced into standard handlers
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4776
	 * - all others go into general signalInterrupt
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4777
	 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4778
#if defined(SIGPOLL) && defined(SIGIO)
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4779
	if (sigNr == SIGPOLL)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4780
	    sigNr = SIGIO;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4781
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4782
	switch (sigNr) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4783
	    case 0:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4784
		/* enabling a non-supported signal */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4785
		RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4786
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4787
#ifdef SIGBREAK
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4788
	    case SIGBREAK:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4789
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4790
#ifdef SIGINT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4791
	    case SIGINT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4792
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4793
#ifdef SIGQUIT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4794
	    case SIGQUIT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4795
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4796
#ifdef SIGNALDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4797
		printf("ConsoleSignal %d\n",sigNr);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4798
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4799
		SetConsoleCtrlHandler((PHANDLER_ROUTINE)__signalUserInterruptWIN32,TRUE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4800
		RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4801
#ifdef SIGFPE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4802
	    case SIGFPE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4803
		handler = __signalFpExceptionInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4804
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4805
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4806
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4807
#ifdef SIGPIPE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4808
	    case SIGPIPE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4809
		handler = __signalPIPEInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4810
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4811
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4812
#ifdef SIGBUS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4813
	    case SIGBUS:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4814
		handler = __signalBUSInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4815
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4816
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4817
#ifdef SIGSEGV
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4818
	    case SIGSEGV:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4819
		handler = __signalSEGVInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4820
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4821
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4822
#ifdef SIGILL
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4823
	    case SIGILL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4824
		handler = __signalTrapInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4825
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4826
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4827
#ifdef SIGEMT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4828
	    case SIGEMT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4829
		handler = __signalTrapInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4830
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4831
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4832
#ifdef SIGIO
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4833
	    case SIGIO:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4834
		handler = __signalIoInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4835
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4836
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4837
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4838
#ifdef CHILD_SIGNAL
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4839
	    case CHILD_SIGNAL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4840
		handler = __signalChildInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4841
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4842
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4843
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4844
	    default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4845
		handler = __signalInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4846
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4847
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4848
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4849
	{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4850
#ifdef HAS_SIGACTION
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4851
	    struct sigaction act;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4852
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4853
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4854
	     * Do not add SA_RESTART here. A signal can cause a
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4855
	     * thread switch, another thread can do a garbage collect
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4856
	     * and restarted system calls may write into old
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4857
	     * (collected) addresses.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4858
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4859
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4860
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4861
	    sigemptyset(&act.sa_mask);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4862
	    act.sa_handler = handler;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4863
	    sigaction(sigNr, &act, 0);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4864
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4865
# ifdef HAS_SIGVEC
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4866
	    struct sigvec vec;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4867
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4868
	    vec.sv_flags = SV_INTERRUPT;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4869
	    sigemptyset(&vec.sv_mask);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4870
	    vec.sv_handler = handler;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4871
	    sigvec(sigNr, &vec, NULL);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4872
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4873
#  ifdef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4874
#   ifdef SIGNALDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4875
	    printf("signal %d can't change handler\n",sigNr);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4876
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4877
#  else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4878
	    (void) signal(sigNr, handler);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4879
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4880
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4881
#endif
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4882
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4883
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4884
	/*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4885
	 * maybe, we should Return the old enable-status
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4886
	 * as boolean here ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4887
	 */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4888
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4889
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4890
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4891
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4892
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4893
     this error is triggered on non-integer argument, or
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4894
     if the signal number is not in the valid range (1..NSIG)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4895
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4896
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4897
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4898
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4899
enableTimer:milliSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4900
    "setup for a timerInterrupt, to be signalled after some (real) time."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4901
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4902
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4903
    extern void __win32SetTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4904
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4905
    if (__isSmallInteger(milliSeconds)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4906
	__win32SetTimer( __intVal(milliSeconds) );
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4907
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4908
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4909
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4910
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4911
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4912
6535
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  4913
isFatalSignal:aNumber
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  4914
   "return true if a signal with number aNumber is a fatal signal,
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  4915
    i.e. some severe internal error occured"
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  4916
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  4917
   ^ (aNumber == self sigSEGV)
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  4918
     or:[aNumber == self sigILL
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  4919
     or:[aNumber == self sigBUS]]
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  4920
!
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  4921
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4922
killProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4923
    "kill a process.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4924
     The process terminates immediately and has no chance to perform any cleanup actions.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4925
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4926
     WARNING: in order to avoid zombie processes (on unix),
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4927
	      you have to fetch the processes exitstatus with
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4928
	      OperatingSystem>>getStatusOfProcess:aProcessId."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4929
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4930
    self terminateProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4931
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4932
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4933
sendSignal:signalNumber to:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4934
    "send a unix signal to some process (maybe myself).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4935
     Returns false if any error occurred, true otherwise.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4936
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4937
     Do not confuse UNIX signals with Smalltalk-Signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4938
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4939
     WARNING: in order to avoid zombie processes (on unix),
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4940
	      you may have to fetch the processes exitstatus with
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4941
	      OperatingSystem>>getStatusOfProcess:aProcessId
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4942
	      if the signal terminates that process."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4943
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4944
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4945
    "/ either invalid argument (non-integers)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4946
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4947
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4948
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4949
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4950
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4951
terminateProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4952
    "terminate a process.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4953
     The process has a chance to do some cleanup.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4954
     WIN32:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4955
	 Under unix, we have terminateProcess, which does a soft
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4956
	 terminate (giving the process a chance to cleanup) and
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4957
	 killProcess, which does a hard terminate.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4958
	 Under WIN32, both (currently) use the TerminateProcess
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4959
	 function, which unconditionally causes a process to exit.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4960
	 I.e. under WIN32, the process has no chance to perform cleanup.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4961
	 Use it only in extreme circumstances. The state of
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4962
	 global data maintained by dynamic-link libraries (DLLs)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4963
	 may be compromised if TerminateProcess is used.
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  4964
     TODO: send it a WM_QUIT instead, to allow for proper shutdown."
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  4965
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  4966
    self terminateProcess:processId exitCode:0
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  4967
!
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  4968
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  4969
terminateProcess:processId exitCode:exitCode
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  4970
    "terminate a process.
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  4971
     The process should have a chance to do some cleanup.
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  4972
     WIN32:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4973
	 Under unix, we have terminateProcess, which does a soft
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4974
	 terminate (giving the process a chance to cleanup) and
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4975
	 killProcess, which does a hard terminate.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4976
	 Under WIN32, both (currently) use the TerminateProcess
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4977
	 function, which unconditionally causes a process to exit.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4978
	 I.e. under WIN32, the process has no chance to perform cleanup.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4979
	 Use it only in extreme circumstances. The state of
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4980
	 global data maintained by dynamic-link libraries (DLLs)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4981
	 may be compromised if TerminateProcess is used.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4982
     TODO: send it a WM_QUIT instead, to allow for proper shutdown."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4983
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4984
%{  
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  4985
    if (__isExternalAddressLike(processId) ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4986
	HANDLE __pid = _HANDLEVal(processId);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4987
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4988
#ifdef PROCESS1DEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4989
	printf("Terminate ProcessHandle %x\n", __pid);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4990
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4991
	if (__pid != 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4992
	    TerminateProcess(__pid, __intVal(exitCode));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4993
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4994
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4995
#ifdef PROCESS1DEBUGWIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4996
    else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4997
	printf("Terminate wrong ProcessHandle\n");
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4998
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4999
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5000
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5001
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5002
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5003
    "Modified: / 27.1.1998 / 20:05:47 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5004
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5005
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5006
terminateProcessGroup:processGroupId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5007
    "terminate a process group.
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  5008
     The processes should have a chance to do some cleanup.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5009
     WIN32:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5010
	 The TerminateProcess function is used to unconditionally cause
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5011
	 a process to exit. 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5012
	 Use it only in extreme circumstances. The state of
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5013
	 global data maintained by dynamic-link libraries (DLLs)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5014
	 may be compromised if TerminateProcess is used.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5015
     Not implemented - TODO: enumerate all sub-processes and terminate them all ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5016
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5017
%{  
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5018
    if (__isExternalAddressLike(processGroupId) ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5019
	HANDLE __pgid = _HANDLEVal(processGroupId);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5021
#ifdef PROCESS1DEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5022
	printf("primTerminateProcessGroup ProcessHandle %x not yet implemented.\n", __pgid);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5023
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5024
	if (__pgid != 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5025
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5026
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5027
#ifdef PROCESS1DEBUGWIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5028
    else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5029
	printf("primTerminateProcessGroup wrong ProcessGroupHandle\n");
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5030
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5031
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5032
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5033
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5034
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5035
!Win32OperatingSystem class methodsFor:'ipc support'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5036
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5037
makePipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5038
    "make a pipe, return array with two filedescriptors on success,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5039
     nil on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5040
     This is a lowLevel entry, not for public use.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5041
     See ExternalStream>>makePipe for a more user-friendly, public interface."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5042
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5043
    |fd1 fd2|    
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5044
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5045
%{       
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5046
    HANDLE   pipeRead  = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5047
    HANDLE   pipeWrite = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5048
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5049
    SECURITY_ATTRIBUTES  process;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5050
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5051
    process.nLength = sizeof( process );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5052
    process.lpSecurityDescriptor = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5053
    process.bInheritHandle = TRUE;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5054
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5055
    if( ! CreatePipe( &pipeRead, &pipeWrite, &process, 0 ) ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5056
	@global(LastErrorNumber) = __MKSMALLINT( __WIN32_ERR(GetLastError()) );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5057
	RETURN ( nil );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5058
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5059
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5060
#ifdef USE_HANDLES
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5061
    fd1 = __MKEXTERNALADDRESS(pipeRead);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5062
    fd2 = __MKEXTERNALADDRESS(pipeWrite);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5063
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5064
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5065
     * make fileDescriptors from handles
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5066
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5067
# ifdef PROCESSDEBUGWIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5068
    printf("piperead %x\n",pipeRead);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5069
    printf("pipewrite %x\n",pipeWrite);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5070
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5071
    fd1 = __MKSMALLINT(_open_osfhandle(pipeRead, O_BINARY));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5072
    fd2 = __MKSMALLINT(_open_osfhandle(pipeWrite, O_BINARY));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5073
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5074
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5075
    fd1 notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5076
	^ Array with:fd1 with:fd2.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5077
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5078
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5079
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5080
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5081
!Win32OperatingSystem class methodsFor:'misc'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5082
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5083
closePid:pid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5084
    "free pid resource"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5085
%{
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5086
    if (__isExternalAddressLike(pid) ) {
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5087
	HANDLE __pid = _HANDLEVal(pid);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5088
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5089
	if (__pid != 0) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5090
#ifdef PROCESSDEBUGWIN32
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5091
	    printf("Close ProcessHandle %x\n", __pid);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5092
#endif
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5093
	    CloseHandle(__pid);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5094
	    _HANDLEVal(pid) = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5095
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5096
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5097
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5098
    ^ true.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5099
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5100
    "Created: 28.1.1998 / 14:23:04 / md"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5101
    "Modified: 28.1.1998 / 14:27:18 / md"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5102
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5103
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5104
!Win32OperatingSystem class methodsFor:'os queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5105
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5106
executableFileExtensions
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5107
    "return a collection of extensions for executable program files.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5108
     Only req'd for msdos like systems ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5109
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5110
    ^ #('com' 'exe')
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5111
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5112
    "Created: 2.5.1997 / 11:42:29 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5113
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5114
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5115
getDomainName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5116
    "return the domain this host is in.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5117
     Notice:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5118
	not all systems support this; on some, 'unknown' is returned."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5119
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5120
    |name idx hostName k|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5121
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5122
    DomainName notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5123
	^ DomainName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5124
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5125
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5126
    name := self getEnvironment:'DOMAIN'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5127
    name isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5128
	name := self getEnvironment:'DOMAINNAME'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5129
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5130
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5131
    name isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5132
	"/ sometimes, we can extract the domainName from the hostName ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5133
	hostName := self getHostName.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5134
	hostName notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5135
	    idx := hostName indexOf:$..
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5136
	    idx ~~ 0 ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5137
		name := hostName copyFrom:idx+1.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5138
	    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5139
	]. 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5140
	name isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5141
	    "/ ok, search the registry ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5142
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5143
	    "/ under NT, it is found there ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5144
	    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5145
	    k notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5146
		k subKeysDo:[:subKey |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5147
		    subKey subKeysDo:[:subSubKey |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5148
			|tcp params|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5149
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5150
			(subSubKey path asLowercase endsWith:'services') ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5151
			    tcp := subSubKey subKeyNamed:'tcpip'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5152
			    tcp notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5153
				params := tcp subKeyNamed:'parameters'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5154
				params notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5155
				    name := params valueNamed:'Domain'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5156
				    params close.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5157
				].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5158
				tcp close.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5159
			    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5160
			]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5161
		    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5162
		]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5163
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5164
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5165
	name isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5166
	    "/ under Win95/Win98, it is found there ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5167
	    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5168
	    k notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5169
		name := k valueNamed:'Domain'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5170
		k close.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5171
	    ]        
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5172
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5173
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5174
	name isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5175
	    'Win32OperatingSystem [warning]: cannot find out domainname' errorPrintCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5176
	    name := 'unknown'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5177
	]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5178
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5179
    DomainName := name.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5180
    ^ name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5181
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5182
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5183
     DomainName := nil. OperatingSystem getDomainName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5184
     OperatingSystem getHostName 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5185
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5186
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5187
    "Modified: 26.4.1996 / 10:04:54 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5188
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5189
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5190
getEnvironment:aStringOrSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5191
    "get an environment string"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5192
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5193
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5194
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5195
    char *env;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5196
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5197
    if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5198
	char buff[512];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5200
	env = NULL;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5201
	if (GetEnvironmentVariable(__stringVal(aStringOrSymbol),
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5202
				   buff,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5203
				   sizeof(buff)-1)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5204
	    env = buff;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5205
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5206
	if (env) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5207
	    RETURN ( __MKSTRING(env) );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5208
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5209
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5210
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5211
.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5212
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5213
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5214
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5215
     OperatingSystem getEnvironment:'LANG'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5216
     OperatingSystem getEnvironment:'LOGIN'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5217
     OperatingSystem getEnvironment:'HOME'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5218
     OperatingSystem getEnvironment:'NNTPSERVER'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5219
     OperatingSystem getEnvironment:'MAIL'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5220
     OperatingSystem getEnvironment:'PATH'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5221
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5222
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5223
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5224
getHostName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5225
    "return the hostname we are running on - if there is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5226
     a HOST environment variable, we are much faster here ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5227
     Notice:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5228
	not all systems support this; on some, 'unknown' is returned."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5229
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5230
    |name idx|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5231
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5232
    HostName notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5233
	^ HostName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5234
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5235
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5236
%{  /* STACK: 2048 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5237
#if defined(HAS_GETHOSTNAME)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5238
    char buffer[256];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5239
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5240
    if (gethostname(buffer, sizeof(buffer)) == 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5241
	name = __MKSTRING(buffer);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5242
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5243
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5244
    char buffer[128];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5245
    int buffSize = sizeof(buffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5246
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5247
    if (GetComputerName(buffer, &buffSize) == TRUE) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5248
	name = __MKSTRING(buffer);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5249
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5250
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5251
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5252
    name isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5253
	name := self getEnvironment:'HOST'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5254
	name isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5255
	    name := self getEnvironment:'HOSTNAME'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5256
	]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5257
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5258
    name isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5259
	'Win32OperatingSystem [warning]: cannot find out hostname' errorPrintCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5260
	name := 'unknown'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5261
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5262
	"/ on some systems, the hostname already contains the domain.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5263
	"/ decompose it here.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5264
	idx := name indexOf:$..
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5265
	idx ~~ 0 ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5266
	    DomainName := name copyFrom:(idx+1).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5267
	    name := name copyTo:(idx-1).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5268
	]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5269
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5270
    HostName := name.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5271
    ^ name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5272
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5273
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5274
     OperatingSystem getHostName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5275
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5276
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5277
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5278
getLanguage
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5279
    "return the domain this host is in.
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5280
     Notice:
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5281
	not all systems support this; on some, 'unknown' is returned."
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  5282
    
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  5283
    |name|
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5284
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5285
    name := self getEnvironment:'LANG'.
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5286
    name isNil ifTrue:[
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5287
	"/ ok, search the registry ...
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5288
	"/ under XP, it is found there ...
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5289
	name := RegistryEntry 
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5290
		    stringValueFor:'sLanguage'
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5291
		    atKey:'HKEY_CURRENT_USER\Control Panel\International'.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5292
	name notNil ifTrue:[
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5293
	    name := self mapLanguage:name.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5294
	].
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5295
    ].
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5296
    ^ name
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5297
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5298
    "
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5299
     OperatingSystem getLanguage
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5300
    "
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5301
    "Modified: 26.4.1996 / 10:04:54 / stefan"
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5302
!
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5303
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5304
getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5305
    "return a dictionary filled with values from the locale information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5306
     Not all fields may be present, depending on the OS's setup and capabilities.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5307
     Possible fields are:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5308
	decimalPoint                    <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5309
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5310
	thousandsSep                    <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5311
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5312
	internationalCurrencySymbol     <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5313
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5314
	currencySymbol                  <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5315
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5316
	monetaryDecimalPoint            <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5317
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5318
	monetaryThousandsSeparator      <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5319
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5320
	positiveSign                    <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5321
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5322
	negativeSign                    <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5323
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5324
	internationalFractionalDigits   <Integer>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5325
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5326
	fractionalDigits                <Integer>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5327
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5328
	positiveSignPrecedesCurrencySymbol      <Boolean>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5329
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5330
	negativeSignPrecedesCurrencySymbol      <Boolean>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5331
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5332
	positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5333
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5334
	negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5335
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5336
	positiveSignPosition                            <Symbol>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5337
							one of: #parenthesesAround, 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5338
								#signPrecedes, 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5339
								#signSuceeds, 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5340
								#signPrecedesCurrencySymbol,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5341
								#signSuceedsCurrencySymbol
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5342
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5343
	negativeSignPosition                            <like above>
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5344
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5345
     it is up to the application to deal with undefined values.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5346
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5347
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5348
     it should be used by applications as required.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5349
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5350
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5351
    |info val|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5352
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5353
    LocaleInfo notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5354
	"/ return the internal info; useful on systems which do not
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5355
	"/ support this.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5356
	^ LocaleInfo
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5357
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5358
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5359
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5360
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5361
    char *decimalPoint;         /* something like "." (US) or "," (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5362
    char *thousandsSep;         /* something like "," (US) or "." (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5363
    char *intCurrencySymbol;    /* international currency symbol; something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5364
    char *currencySymbol;       /* local currency symbol;         something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5365
    char *monDecimalPoint;      /* money: decimal point */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5366
    char *monThousandsSep;      /* money: thousands sep */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5367
    char *positiveSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5368
    char *negativeSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5369
    int   intFractDigits;       /* money: international digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5370
    int   fractDigits;          /* money: local digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5371
    int   csPosPrecedes;        /* money: 1 if currency symbol precedes a positive value; 0 if it sceeds */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5372
    int   csNegPrecedes;        /* money: 1 if currency symbol precedes a negative value; 0 if it sceeds */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5373
    int   csPosSepBySpace;      /* money: 1 if currency symbol should be separated by a space from a positive value; 0 if no space */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5374
    int   csNegSepBySpace;      /* money: 1 if currency symbol should be separated by a space from a negative value; 0 if no space */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5375
    int   csPosSignPosition;    /* money: 0: ()'s around the value & currency symbol */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5376
    int   csNegSignPosition;    /*        1: sign precedes the value & currency symbol */
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5377
				/*        2: sign succeeds the value & currency symbol */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5378
				/*        3: sign immediately precedes the currency symbol */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5379
				/*        4: sign immediately suceeds the currency symbol */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5380
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5381
#if defined(HAS_LOCALECONV)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5382
    struct lconv *conf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5383
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5384
    conf = localeconv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5385
    if (conf) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5386
	decimalPoint = conf->decimal_point;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5387
	thousandsSep = conf->thousands_sep;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5388
	intCurrencySymbol = conf->int_curr_symbol;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5389
	currencySymbol = conf->currency_symbol;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5390
	monDecimalPoint = conf->mon_decimal_point;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5391
	monThousandsSep = conf->mon_thousands_sep;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5392
	positiveSign = conf->positive_sign;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5393
	negativeSign = conf->negative_sign;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5394
	intFractDigits = conf->int_frac_digits;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5395
	fractDigits = conf->frac_digits;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5396
	csPosPrecedes = conf->p_cs_precedes; 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5397
	csNegPrecedes = conf->n_cs_precedes; 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5398
	csPosSepBySpace = conf->p_sep_by_space; 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5399
	csNegSepBySpace = conf->n_sep_by_space; 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5400
	csPosSignPosition = conf->p_sign_posn;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5401
	csNegSignPosition = conf->n_sign_posn;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5402
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5403
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5404
    decimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5405
    thousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5406
    intCurrencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5407
    currencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5408
    monDecimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5409
    monThousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5410
    positiveSign =  (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5411
    negativeSign =(char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5412
    intFractDigits = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5413
    fractDigits = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5414
    csPosPrecedes = -1; 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5415
    csNegPrecedes = -1; 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5416
    csPosSepBySpace = -1; 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5417
    csNegSepBySpace = -1; 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5418
    csPosSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5419
    csNegSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5420
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5421
    if (decimalPoint) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5422
	val = __MKSTRING(decimalPoint);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5423
	__AT_PUT_(info, @symbol(decimalPoint), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5424
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5425
    if (thousandsSep) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5426
	val = __MKSTRING(thousandsSep);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5427
	__AT_PUT_(info, @symbol(thousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5428
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5429
    if (intCurrencySymbol) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5430
	val = __MKSTRING(intCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5431
	__AT_PUT_(info, @symbol(internationCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5432
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5433
    if (currencySymbol) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5434
	val = __MKSTRING(currencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5435
	__AT_PUT_(info, @symbol(currencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5436
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5437
    if (monDecimalPoint) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5438
	val = __MKSTRING(monDecimalPoint);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5439
	__AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5440
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5441
    if (monThousandsSep) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5442
	val = __MKSTRING(monThousandsSep);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5443
	__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5444
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5445
    if (positiveSign) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5446
	val = __MKSTRING(positiveSign);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5447
	__AT_PUT_(info, @symbol(positiveSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5448
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5449
    if (negativeSign) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5450
	val = __MKSTRING(negativeSign);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5451
	__AT_PUT_(info, @symbol(negativeSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5452
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5453
    if (intFractDigits >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5454
	__AT_PUT_(info, @symbol(internationalFractionalDigits),  __MKSMALLINT(intFractDigits));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5455
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5456
    if (fractDigits >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5457
	__AT_PUT_(info, @symbol(fractionalDigits),  __MKSMALLINT(fractDigits));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5458
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5459
    if (csPosPrecedes >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5460
	if (csPosPrecedes == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5461
	    val = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5462
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5463
	    val = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5464
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5465
	__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5466
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5467
    if (csNegPrecedes >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5468
	if (csNegPrecedes == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5469
	    val = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5470
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5471
	    val = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5472
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5473
	__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5474
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5475
    if (csPosSepBySpace >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5476
	if (csPosSepBySpace == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5477
	    val = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5478
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5479
	    val = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5480
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5481
	__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5482
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5483
    if (csNegSepBySpace >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5484
	if (csNegSepBySpace == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5485
	    val = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5486
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5487
	    val = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5488
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5489
	__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5490
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5491
    switch (csPosSignPosition) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5492
	case 0:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5493
	    val = @symbol(parenthesesAround);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5494
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5495
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5496
	case 1:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5497
	    val = @symbol(signPrecedes);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5498
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5499
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5500
	case 2:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5501
	    val = @symbol(signSuceeds);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5502
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5503
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5504
	case 3:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5505
	    val = @symbol(signPrecedesCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5506
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5507
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5508
	case 4:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5509
	    val = @symbol(signSuceedsCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5510
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5511
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5512
	default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5513
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5514
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5515
    if (val != nil) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5516
	__AT_PUT_(info, @symbol(positiveSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5517
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5518
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5519
    switch (csNegSignPosition) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5520
	case 0:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5521
	    val = @symbol(parenthesesAround);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5522
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5523
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5524
	case 1:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5525
	    val = @symbol(signPrecedes);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5526
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5527
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5528
	case 2:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5529
	    val = @symbol(signSuceeds);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5530
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5531
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5532
	case 3:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5533
	    val = @symbol(signPrecedesCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5534
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5535
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5536
	case 4:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5537
	    val = @symbol(signSuceedsCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5538
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5539
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5540
	default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5541
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5542
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5543
    if (val != nil) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5544
	__AT_PUT_(info, @symbol(negativeSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5545
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5546
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5547
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5548
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5549
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5550
     OperatingSystem getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5551
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5552
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5553
    "Created: 23.12.1995 / 14:19:20 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5554
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5555
7287
b10efc6c9407 Fix spelling (getNetworkMACAddresses)
Stefan Vogel <sv@exept.de>
parents: 7199
diff changeset
  5556
getNetworkMACAddresses
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5557
    "return a dictionary filled with 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5558
	key -> name of interface 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5559
	value -> the MAC adress (as ByteArray)
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5560
     for each interface 
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5561
    "
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5562
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5563
    |info nAdapters rawData entry
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5564
     name description macAddress ipAddress ipAddressMask|
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5565
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5566
    rawData := Array new:50.
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5567
%{
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
  5568
#ifndef NO_GETADAPTERSINFO
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5569
    IP_ADAPTER_INFO AdapterInfo[32];
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5570
    DWORD dwBufLen = sizeof(AdapterInfo);
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5571
    DWORD dwStatus;
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5572
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5573
    dwStatus = GetAdaptersInfo(      
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5574
				AdapterInfo,                 // [out] buffer to receive data
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5575
				&dwBufLen);                  // [in] size of receive data buffer
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5576
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5577
    if (dwStatus == ERROR_SUCCESS) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5578
	PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5579
	unsigned char *bP;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5580
	int nA = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5581
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5582
	bP = __byteArrayVal(rawData);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5583
	do {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5584
/*
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5585
 * temporary undef String to avoid a #define-conflict
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5586
 * between ST/X's String and Windows String typedef
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5587
 */
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5588
# undef String
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5589
	    name = __MKSTRING(pAdapterInfo->AdapterName);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5590
	    description = __MKSTRING(pAdapterInfo->Description);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5591
	    macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5592
	    ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5593
	    ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5594
	    entry = __ARRAY_NEW_INT(5);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5595
/*
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5596
 * back to ST/X's String definition
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5597
 */
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5598
# ifdef __DEF_String
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5599
#  define String __DEF_String
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5600
# endif
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5601
	    __ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5602
	    __ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5603
	    __ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5604
	    __ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5605
	    __ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5606
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5607
	    __ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5608
	    nA++;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5609
	    pAdapterInfo = pAdapterInfo->Next;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5610
	} while(pAdapterInfo);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5611
	nAdapters = __mkSmallInteger(nA);
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5612
    }
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
  5613
#endif /* not NO_GETADAPTERSINFO */
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5614
%}.
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5615
    nAdapters isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5616
	self primitiveFailed.
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5617
    ].
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5618
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5619
    info := Dictionary new.
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5620
    1 to:nAdapters do:[:i |
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5621
	|entry name macAddr|
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5622
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5623
	entry := rawData at:i.
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5624
	name := entry at:1.
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5625
	macAddr := entry at:3.
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5626
	info at:name put:macAddr.
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5627
    ].
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5628
    ^ info
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5629
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5630
    "
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5631
     OperatingSystem getNetworkMACAddresses
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5632
    "
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5633
!
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5634
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5635
getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5636
    "return the (unix-)processId"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5637
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5638
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5639
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5640
    int pid = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5641
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5642
    pid = GetCurrentProcessId() & 0x3FFFFFFF;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5643
    RETURN ( __MKSMALLINT(pid) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5644
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5645
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5646
     OperatingSystem getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5647
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5648
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5649
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5650
getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5651
    "if supported by the OS, return the systemID;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5652
     a unique per machine identification.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5653
     WARNING:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5654
	not all systems support this; on some, 'unknown' is returned."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5655
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5656
%{  /* NO_CONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5657
#if defined(HAS_GETHOSTID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5658
    int runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5659
    OBJ arr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5660
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5661
    runningId = gethostid();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5662
    arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5663
    *(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5664
    RETURN (arr);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5665
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5666
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5667
    {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5668
	char buffer[128];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5669
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5670
	buffer[0] = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5671
	if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5672
	    buffer[127] = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5673
	    if (strlen(buffer) > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5674
		RETURN(__MKSTRING(buffer));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5675
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5676
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5677
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5678
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5679
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5680
    ^ 'unknown'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5681
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5682
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5683
     OperatingSystem getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5684
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5685
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5686
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5687
getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5688
    "return info on the system weare running on.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5689
     If the system supports the uname system call, that info is returned;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5690
     otherwise, some simulated info is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5691
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5692
     WARNING:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5693
       Do not depend on the amount and contents of the returned information, some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5694
       systems may return more/less than others. Also, the contents depends on the
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5695
       OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5696
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5697
       This method is mainly provided to augment error reports with some system
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5698
       information. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5699
       (in case of system/version specific OS errors, conditional workarounds and patches
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5700
	may be based upon this info).
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5701
       Your application should NOT depend upon this in any way.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5702
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5703
     The returned info may (or may not) contain:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5704
	#system -> some operating system identification (irix, Linux, nt, win32s ...) 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5705
	#version -> OS version (some os version identification)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5706
	#release -> OS release (3.5, 1.2.1 ...)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5707
	#node   -> some host identification (hostname)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5708
	#domain  -> domain name (hosts domain)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5709
	#machine -> type of machine (i586, mips ...)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5710
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5711
     win32:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5712
	#physicalRam -> total amount of physical memory        
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5713
	#freeRam -> amount of free memory        
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5714
	#swapSize -> size of swapSpace (page file)        
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5715
	#freeSwap -> free bytes in swapSpace        
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5716
	#virtualRam -> total amount of virtual memory        
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5717
	#freeVirtual -> amount of free virtual memory        
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5718
	#memoryLoad -> percentage of memory usage (useless)
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5719
    "
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5720
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5721
    |sys node rel ver mach dom info arch
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5722
     physicalRam freeRam swapSize freeSwap
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  5723
     virtualRam freeVirtual memoryLoad numberOfCPUs|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5724
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5725
%{  /* STACK: 4096 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5726
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5727
    char vsnBuffer[32];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5728
    char *s;
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5729
    int winVer, verMinor, verMajor;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5730
    DWORD vsn;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5731
    SYSTEM_INFO sysInfo;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5732
    MEMORYSTATUS memStatus;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5733
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5734
    vsn = GetVersion();
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5735
    winVer = LOWORD(vsn);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5736
    verMinor = HIBYTE(winVer);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5737
    verMajor = LOBYTE(winVer);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5738
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5739
    if (HIWORD(vsn) & 0x8000) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5740
	s = "win95";
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5741
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5742
	if ((verMajor > 5) 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5743
	 || ((verMajor == 5) && (verMinor >= 1))) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5744
	    s = "xp";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5745
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5746
	    s = "nt";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5747
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5748
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5749
    sys = __MKSTRING(s);
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5750
    sprintf(vsnBuffer, "%d.%d", verMajor, verMinor);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5751
    rel = __MKSTRING(vsnBuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5752
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5753
    GetSystemInfo(&sysInfo);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5754
    memStatus.dwLength = sizeof(memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5755
    GlobalMemoryStatus(&memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5756
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5757
    memoryLoad = __MKUINT(memStatus.dwMemoryLoad);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5758
    physicalRam = __MKUINT(memStatus.dwTotalPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5759
    freeRam = __MKUINT(memStatus.dwAvailPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5760
    swapSize = __MKUINT(memStatus.dwTotalPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5761
    freeSwap = __MKUINT(memStatus.dwAvailPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5762
    virtualRam = __MKUINT(memStatus.dwTotalVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5763
    freeVirtual = __MKUINT(memStatus.dwAvailVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5764
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5765
#if defined(__BORLANDC__) && (__BORLANDC__ <= 1339)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5766
    /* BorlandC3 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5767
    switch (sysInfo.u.s.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5768
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5769
    /* MSC, BorlandC4 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5770
    switch (sysInfo.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5771
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5772
    {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5773
#ifdef PROCESSOR_ARCHITECTURE_INTEL
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5774
	case PROCESSOR_ARCHITECTURE_INTEL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5775
	    s = "intel";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5776
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5777
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5778
#ifdef PROCESSOR_ARCHITECTURE_MIPS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5779
	case PROCESSOR_ARCHITECTURE_MIPS:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5780
	    s = "mips";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5781
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5782
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5783
#ifdef PROCESSOR_ARCHITECTURE_ALPHA
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5784
	case PROCESSOR_ARCHITECTURE_ALPHA:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5785
	    s = "alpha";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5786
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5787
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5788
#ifdef PROCESSOR_ARCHITECTURE_PPC
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5789
	case PROCESSOR_ARCHITECTURE_PPC:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5790
	    s = "ppc";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5791
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5792
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5793
#ifdef PROCESSOR_ARCHITECTURE_ARM
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5794
	case PROCESSOR_ARCHITECTURE_ARM:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5795
	    s = "arm";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5796
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5797
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5798
	default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5799
	    s = "unknown";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5800
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5801
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5802
    arch = __MKSTRING(s);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5803
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5804
    switch (sysInfo.dwProcessorType) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5805
#ifdef PROCESSOR_INTEL_386
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5806
	case PROCESSOR_INTEL_386:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5807
	    s = "i386";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5808
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5809
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5810
#ifdef PROCESSOR_INTEL_486
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5811
	case PROCESSOR_INTEL_486:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5812
	    s = "i486";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5813
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5814
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5815
#ifdef PROCESSOR_INTEL_PENTIUM
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5816
	case PROCESSOR_INTEL_PENTIUM:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5817
	    s = "i586";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5818
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5819
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5820
#ifdef PROCESSOR_INTEL_860
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5821
	case PROCESSOR_INTEL_860:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5822
	    s = "i860";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5823
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5824
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5825
#ifdef PROCESSOR_MIPS_R2000
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5826
	case PROCESSOR_MIPS_R2000:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5827
	    s = "r2000";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5828
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5829
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5830
#ifdef PROCESSOR_MIPS_R3000
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5831
	case PROCESSOR_MIPS_R3000:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5832
	    s = "r3000";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5833
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5834
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5835
#ifdef PROCESSOR_MIPS_R4000
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5836
	case PROCESSOR_MIPS_R4000:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5837
	    s = "r4000";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5838
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5839
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5840
#ifdef PROCESSOR_ALPHA_21064
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5841
	case PROCESSOR_ALPHA_21064:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5842
	    s = "alpha21064";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5843
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5844
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5845
#ifdef PROCESSOR_ARM_7TDMI
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5846
	case PROCESSOR_ARM_7TDMI:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5847
	    s = "arm70001";
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5848
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5849
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5850
	default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5851
	    sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5852
	    s = vsnBuffer;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5853
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5854
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5855
    mach = __MKSTRING(s);
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  5856
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  5857
    numberOfCPUs = __MKUINT(sysInfo.dwNumberOfProcessors);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5858
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5859
    sys isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5860
	sys := self getSystemType.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5861
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5862
    node isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5863
	node := self getHostName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5864
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5865
    dom isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5866
	dom := self getDomainName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5867
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5868
    mach isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5869
	mach := self getCPUType.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5870
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5871
    arch isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5872
	arch := 'unknown'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5873
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5874
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5875
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5876
    info at:#system put:sys.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5877
    info at:#node put:node.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5878
    rel notNil ifTrue:[info at:#release put:rel].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5879
    ver notNil ifTrue:[info at:#version put:ver].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  5880
    mach notNil ifTrue:[info at:#machine put:mach. info at:#cpuType put:mach].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5881
    arch notNil ifTrue:[info at:#architecture put:arch].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5882
    dom notNil ifTrue:[info at:#domain put:dom].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  5883
    numberOfCPUs notNil ifTrue:[info at:#numberOfCPUs put:numberOfCPUs].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5884
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5885
    info at:#memoryLoad put:memoryLoad.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5886
    info at:#physicalRam put:physicalRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5887
    info at:#freeRam put:freeRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5888
    info at:#swapSize put:swapSize.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5889
    info at:#freeSwap put:freeSwap.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5890
    info at:#virtualRam put:virtualRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5891
    info at:#freeVirtual put:freeVirtual.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5892
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5893
    info at:#osType put:(self getOSType).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5894
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5895
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5896
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5897
     OperatingSystem getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5898
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5899
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5900
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5901
getSystemType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5902
    "return a string giving the type of system we're running on.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5903
     This is almost the same as getOSType, but the returned string
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5904
     is slightly different for some systems (i.e. iris vs. irix).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5905
     Dont depend on this - use getOSType. I dont really see a point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5906
     here ... 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5907
     (except for slight differences between next/mach and other machs)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5908
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5909
    ^ 'win32'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5910
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5911
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5912
     OperatingSystem getSystemType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5913
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5914
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5915
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5916
getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5917
    "internal interface - only for Windows based systems.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5918
     Return the windows directory 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5919
     (which - depending on the system - may be \WINNT, \WINDOWS or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5920
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5921
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5922
%{  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5923
    char buffer[MAXPATHLEN];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5924
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5925
    if (GetWindowsDirectory(buffer, MAXPATHLEN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5926
	RETURN (__MKSTRING(buffer));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5927
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5928
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5929
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5930
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5931
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5932
     OperatingSystem getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5933
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5934
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5935
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5936
getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5937
    "internal interface - only for Windows based systems.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5938
     Return the windows system directory 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5939
     (which - depending on the system - may be \WINNT\SYSTEM32, 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5940
      \WINDOWS\SYSTEM or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5941
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5942
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5943
%{  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5944
    char buffer[MAXPATHLEN];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5945
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5946
    if (GetSystemDirectory(buffer, MAXPATHLEN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5947
	RETURN (__MKSTRING(buffer));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5948
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5949
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5950
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5951
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5952
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5953
     OperatingSystem getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5954
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5955
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5956
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5957
hasConsole
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5958
    "return true, if there is some kind of console available
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5959
     (i.e. for proper stdIn, stdOut and stdErr handling).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5960
     This only returns false when running únder windows, and
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5961
     the system is running as a pure windows application.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5962
     If false, the miniDebugger is useless and not used."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5963
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5964
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5965
    extern int __getNoConsoleFlag();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5966
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5967
    RETURN ( __getNoConsoleFlag() ? false : true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5968
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5969
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5970
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5971
isMSDOSlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5972
    "return true, if the OS we're running on is msdos like 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5973
     (in contrast to unix-like or vms-like).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5974
     This returns true for any of msdos, win32s, win95,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5975
     winNT and os/2."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5976
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5977
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5978
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5979
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5980
isMSWINDOWSNTlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5981
    "This returns true if running in a Windows-NT system."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5982
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5983
%{   /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5984
     if (__isWinNT)
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5985
	RETURN(true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5986
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5987
     ^ false.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5988
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5989
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5990
isMSWINDOWSlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5991
    "return true, if running on a MS-Windows like system.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5992
     This returns true for any of win32s, win95 and winNT."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5993
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5994
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5995
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5996
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5997
maxFileNameLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5998
    "return the max number of characters in a filename.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5999
     CAVEAT:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6000
	 Actually, the following is somewhat wrong - some systems
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6001
	 support different sizes, depending on the volume.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6002
	 We return a somewhat conservative number here.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6003
	 Another entry, to query for volume specific max
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6004
	 will be added in the future."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6005
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6006
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6007
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6008
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6009
     * TODO: newer systems provide a query function for this ... use it
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6010
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6011
     /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6012
      * mhmh - depends on the filesystem type
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6013
      */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6014
     RETURN ( __MKSMALLINT(MAXFILELEN) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6015
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6016
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6017
     OperatingSystem maxFileNameLength   
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6018
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6019
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6021
maxPathLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6022
    "return the max number of characters in a pathName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6023
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6024
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6025
    RETURN ( __MKSMALLINT(MAXPATHLEN) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6026
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6027
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6028
     OperatingSystem maxPathLength   
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6029
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6030
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6031
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6032
pathSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6033
    "return the character which separates items in the PATH variable"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6034
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6035
    ^ $;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6036
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6037
    "Created: 2.5.1997 / 11:36:47 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6038
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6039
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6040
platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6041
    "return a string describing the OS platform very we're running on.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6042
     This returns #unix for all unix derivatives,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6043
     #os2, #win32, #vms or #mac for the others.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6044
     I.e. it is much less specific than getOSType or getSystemType."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6045
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6046
    ^ #win32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6047
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6048
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6049
     OperatingSystem platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6050
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6051
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6052
    "Modified: 20.6.1997 / 17:37:26 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6053
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6054
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6055
primGetDomainName
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6056
%{
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6057
#if 0   /* not needed */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6058
    HINSTANCE hNetApi32 = LoadLibrary("netapi32.dll");
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6059
    DWORD (__stdcall *pfnNetApiBufferFree)(LPVOID Buffer);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6060
    DWORD (__stdcall *pfnNetWkstaGetInfo)(LPWSTR servername, DWORD level, void *bufptr);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6061
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6062
    if (hNetApi32) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6063
	pfnNetApiBufferFree = (DWORD (__stdcall *)(void *)) GetProcAddress(hNetApi32, "NetApiBufferFree");
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6064
	pfnNetWkstaGetInfo = (DWORD (__stdcall *)(LPWSTR, DWORD, void *)) GetProcAddress(hNetApi32, "NetWkstaGetInfo");
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6065
    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6066
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6067
    if (hNetApi32 && pfnNetWkstaGetInfo && pfnNetApiBufferFree) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6068
	/* this way is more reliable, in case user has a local account. */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6069
	char dname[256];
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6070
	DWORD dnamelen = sizeof(dname);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6071
	struct {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6072
	    DWORD   wki100_platform_id;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6073
	    LPWSTR  wki100_computername;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6074
	    LPWSTR  wki100_langroup;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6075
	    DWORD   wki100_ver_major;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6076
	    DWORD   wki100_ver_minor;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6077
	} *pwi;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6078
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6079
	/* NERR_Success *is* 0*/
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6080
	if (0 == pfnNetWkstaGetInfo(NULL, 100, &pwi)) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6081
	    if (pwi->wki100_langroup && *(pwi->wki100_langroup)) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6082
		WideCharToMultiByte(CP_ACP, NULL, pwi->wki100_langroup,
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6083
				    -1, (LPSTR)dname, dnamelen, NULL, NULL);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6084
	    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6085
	    else {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6086
		WideCharToMultiByte(CP_ACP, NULL, pwi->wki100_computername,
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6087
				    -1, (LPSTR)dname, dnamelen, NULL, NULL);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6088
	    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6089
	    pfnNetApiBufferFree(pwi);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6090
	    FreeLibrary(hNetApi32);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6091
	    RETURN (__MKSTRING(dname));
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6092
	}
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6093
	FreeLibrary(hNetApi32);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6094
    } else {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6095
	/* Win95 doesn't have NetWksta*(), so do it the old way */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6096
	char name[256];
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6097
	DWORD size = sizeof(name);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6098
	if (hNetApi32)
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6099
	    FreeLibrary(hNetApi32);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6100
	if (GetUserName(name,&size)) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6101
	    char sid[1024];
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6102
	    DWORD sidlen = sizeof(sid);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6103
	    char dname[256];
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6104
	    DWORD dnamelen = sizeof(dname);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6105
	    SID_NAME_USE snu;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6106
	    if (LookupAccountName(NULL, name, (PSID)&sid, &sidlen,
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6107
				  dname, &dnamelen, &snu)) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6108
		RETURN (__MKSTRING(dname));             /* all that for this */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6109
	    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6110
	}
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6111
    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6112
#endif /* not needed */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6113
%}.
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6114
    ^ nil
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6115
!
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6116
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6117
setLocaleInfo:anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6118
    "set the locale information; if set, this oerrides the OS's settings.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6119
     (internal in ST/X only - the OS's settings remain unaffected)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6120
     See description of fields in #getLocaleInfo.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6121
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6122
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6123
     it should be used by applications as required."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6124
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6125
    LocaleInfo := anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6126
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6127
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6128
     |d|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6129
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6130
     d := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6131
     d at:#decimalPoint                 put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6132
     d at:#thousandsSeparator           put:','         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6133
     d at:#currencySymbol               put:'USD'       .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6134
     d at:#monetaryDecimalPoint         put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6135
     d at:#monetaryThousandsSeparator   put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6136
     d at:#fractionalDigits             put:2           .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6137
     d at:#positiveSign                 put:'+'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6138
     d at:#negativeSign                 put:'-'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6139
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6140
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6141
     OperatingSystem setLocaleInfo:d
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6142
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6143
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6144
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6145
supportsChildInterrupts
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6146
    "return true, if the OS supports childProcess termination signalling
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6147
     through interrupts (i.e. SIGCHILD)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6148
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6149
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6150
#if defined(SIGCHLD) || defined(SIGCLD) 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6151
    RETURN (true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6152
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6153
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6154
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6155
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6156
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6157
     OperatingSystem supportsChildInterrupts 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6158
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6159
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6160
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6161
supportsFileOwnerGroups
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6162
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6163
     group ownership - all OS's except windows do"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6164
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6165
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6166
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6167
    "Created: / 10.9.1998 / 17:57:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6168
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6169
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6170
supportsFileOwners
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6171
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6172
     ownership - all OS's except windows do"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6173
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6174
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6175
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6176
    "Created: / 10.9.1998 / 17:55:16 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6177
    "Modified: / 10.9.1998 / 17:57:11 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6178
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6179
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6180
supportsIOInterrupts
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6181
    "return true, if the OS supports IO availability interrupts 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6182
     (i.e. SIGPOLL/SIGIO).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6183
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6184
     Currently, this mechanism does not work on all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6185
     systems ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6186
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6187
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6188
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6189
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6190
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6191
     OperatingSystem supportsIOInterrupts 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6192
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6193
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6194
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6195
supportsNonBlockingIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6196
    "return true, if the OS supports nonblocking IO."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6197
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6198
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6199
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6200
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6201
     OperatingSystem supportsNonBlockingIO  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6202
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6203
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6204
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6205
supportsSelect
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6206
    "return true, if the OS supports selecting on multiple
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6207
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6208
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6209
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6210
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6211
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6212
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6213
# if defined(WIN32S)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6214
    RETURN (false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6215
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6216
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6217
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6218
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6219
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6220
     OperatingSystem supportsSelect
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6221
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6222
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6223
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6224
supportsSelectOnPipes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6225
    "return true, if the OS supports selecting on pipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6226
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6227
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6228
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6229
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6230
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6231
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6232
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6233
     OperatingSystem supportsSelectOnPipes 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6234
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6235
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6236
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6237
    "Created: / 14.12.1999 / 19:43:13 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6238
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6239
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6240
supportsSelectOnSockets
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6241
    "return true, if the OS supports selecting on socket
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6242
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6243
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6244
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6245
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6246
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6247
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6248
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6249
     OperatingSystem supportsSelectOnSockets 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6250
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6251
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6252
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6253
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6254
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6255
supportsVolumes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6256
    "return true, if the OS supports disk volumes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6257
     False is returned for UNIX, true for MSDOS and VMS"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6258
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6259
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6260
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6261
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6262
!Win32OperatingSystem class methodsFor:'path queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6263
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6264
defaultPackagePath
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6265
    |pPath pkgDirPath dirs p|
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6266
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6267
    pPath := super defaultPackagePath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6268
    pkgDirPath := self stxPackageDirPath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6269
    pkgDirPath notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6270
	"/ and also add the packageDirPath from the registry ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6271
	dirs := pkgDirPath asCollectionOfSubstringsSeparatedBy:$;.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6272
	dirs do:[:aDir |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6273
	    (pPath includes:aDir) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6274
		pPath add:aDir.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6275
	    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6276
	]
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6277
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6278
	#(
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6279
	    '\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6280
	    '\programme\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6281
	    '\programme\eXept\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6282
	    '\programs\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6283
	    '\programs\eXept\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6284
	) do:[:d | |dd|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6285
	    dd := d asFilename constructString:'packages'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6286
	    (pPath includes:dd) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6287
		pPath add:dd.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6288
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6289
	    dd := (d asFilename construct:Smalltalk versionString) constructString:'packages'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6290
	    (pPath includes:dd) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6291
		pPath add:dd.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6292
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6293
	].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6294
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6295
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6296
    "/ under windows, the commandName includes the path - good.
5922
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  6297
    p := Smalltalk commandName.
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  6298
    p notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6299
	p := p asFilename directory constructString:'packages'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6300
	(pPath includes:p) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6301
	    pPath add:p.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6302
	]
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6303
    ].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6304
    pPath := pPath select:[:p | p asFilename exists].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6305
    ^ pPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6306
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6307
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6308
     self defaultPackagePath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6309
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6310
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6311
    "Created: / 24.12.1999 / 00:10:41 / cg"
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6312
    "Modified: / 24.12.1999 / 00:33:26 / cg"
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6313
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6314
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6315
defaultSystemPath
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6316
    |sysPath libDirPath p|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6317
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6318
    sysPath := super defaultSystemPath.
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  6319
    libDirPath := self stxLibDirPath.
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  6320
    libDirPath notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6321
	"/ and also add the libDirPath from the registry ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6322
	(sysPath includes:libDirPath) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6323
	    sysPath add:libDirPath
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6324
	].
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  6325
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6326
	#(
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6327
	    '\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6328
	    '\programme\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6329
	    '\programme\eXept\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6330
	    '\programs\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6331
	    '\programs\eXept\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6332
	) do:[:d | |dd|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6333
	    (d asFilename isDirectory) ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6334
		(sysPath includes:d) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6335
		    sysPath add:d.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6336
		].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6337
		dd := d , '\' , Smalltalk versionString.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6338
		(sysPath includes:dd) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6339
		    sysPath add:dd.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6340
		]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6341
	    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6342
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6343
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6344
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6345
    "/ under windows, the commandName includes the path - good.
5918
0d8bc97e7106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5908
diff changeset
  6346
    p := Smalltalk commandName.
0d8bc97e7106 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5908
diff changeset
  6347
    p notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6348
	p := p asFilename directoryName.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6349
	(sysPath includes:p) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6350
	    sysPath add:p.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6351
	]
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6352
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6353
    ^ sysPath
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  6354
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6355
    "Modified: / 24.12.1999 / 00:29:18 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6356
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6357
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6358
stxBinDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6359
    "ask the registry for the binary directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6360
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6361
    |k p|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6362
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6363
    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6364
    k notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6365
	p := k valueNamed:'BinDir'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6366
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6367
    ^ p
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6368
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6369
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6370
     OperatingSystem stxBinDirPath 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6371
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6372
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6373
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6374
stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6375
    "ask the registry for the lib directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6376
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6377
    |k p|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6378
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6379
    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6380
    k notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6381
	p := k valueNamed:'LibDir'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6382
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6383
    ^ p
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6384
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6385
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6386
     OperatingSystem stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6387
    "
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6388
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6389
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6390
stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6391
    "ask the registry for the package directory"
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6392
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6393
    |k p|
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6394
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6395
    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6396
    k notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6397
	p := k valueNamed:'PackageDirPath'.
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6398
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6399
    ^ p
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6400
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6401
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6402
     OperatingSystem stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6403
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6404
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6405
    "Created: / 24.12.1999 / 00:11:12 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6406
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6407
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6408
!Win32OperatingSystem class methodsFor:'private'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6409
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6410
mapLanguage:aWindowsLanguageString
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6411
    "map a windows language string to ISO languageCode_languageTerritory
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6412
     format"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6413
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6414
    |windowsLanguageString|
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6415
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6416
    windowsLanguageString := aWindowsLanguageString asUppercase.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6417
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6418
    #('DEU'     'de_DE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6419
      'DES'     'de_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6420
      'DEA'     'de_AT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6421
      'DAN'     'da_DA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6422
      'ENA'     'en_AU'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6423
      'ENC'     'en_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6424
      'ENG'     'en_GB'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6425
      'ENI'     'en_IR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6426
      'ENU'     'en_US'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6427
      'ENZ'     'en_NZ'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6428
      'FRA'     'fr_FR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6429
      'FRB'     'fr_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6430
      'FRC'     'fr_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6431
      'FRS'     'fr_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6432
      'ITA'     'it_IT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6433
      'ITS'     'it_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6434
      'ESM'     'es_MX'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6435
      'ESN'     'es_ES'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6436
      'ESP'     'es'            "Castillian"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6437
      'NLB'     'nl_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6438
      'NLD'     'nl_NL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6439
      'CSY'     'cs_CS'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6440
      'ELL'     'el_EL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6441
      'NON'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6442
      'NOR'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6443
     ) pairWiseDo:[:key :mappedValue|
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6444
	key = windowsLanguageString ifTrue:[
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6445
	    ^ mappedValue
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6446
	]
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6447
    ].
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6448
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6449
    "no mapping"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6450
    ^ windowsLanguageString.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6451
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6452
    "
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6453
	self mapLanguage:'DEU'
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6454
    "
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6455
!
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6456
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6457
osProcessStatusClass
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6458
    ^ OSProcessStatus
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6459
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6460
    "Created: / 12.6.1998 / 16:30:43 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6461
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6462
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6463
!Win32OperatingSystem class methodsFor:'system management'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6464
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6465
exitWindows
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6466
    "do not use - may be removed without notice"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6467
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6468
    self exitWindows:#shutdown confirm:'Do you really want to shutdown the system'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6469
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6470
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6471
exitWindows:how confirm:confirmationMessageOrNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6472
    "this method is temporary -
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6473
     since my windows system menu crashes so often
7850
087b4ca01736 comment & unneeded method removed
ca
parents: 7841
diff changeset
  6474
     (even CTRL-ALT-DEL does no longer function, but ST/X is still alive),
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6475
     I added this in order to be able to shutdown w95 cleanly"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6476
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6477
    confirmationMessageOrNil notNil ifTrue:[
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6478
	(Dialog confirm:confirmationMessageOrNil) ifFalse:[
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6479
	    ^ false
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6480
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6481
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6482
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6483
    int flag;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6484
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6485
    if (how == @symbol(shutdown)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6486
	flag = EWX_SHUTDOWN;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6487
    } else if (how == @symbol(reboot)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6488
	flag = EWX_REBOOT;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6489
    } else if (how == @symbol(logoff)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6490
	flag = EWX_LOGOFF;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6491
    } else if (how == @symbol(forceShutdown)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6492
	flag = EWX_SHUTDOWN | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6493
    } else if (how == @symbol(forceReboot)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6494
	flag = EWX_REBOOT | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6495
    } else if (how == @symbol(forceLogoff)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6496
	flag = EWX_LOGOFF | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6497
    } else {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6498
	RETURN (false);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6499
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6500
    RETURN ((ExitWindowsEx(flag, 0) == TRUE) ? true : false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6501
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6502
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6503
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6504
!Win32OperatingSystem class methodsFor:'time and date'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6505
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6506
computeDatePartsOf:osTime for:aBlock
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6507
    "compute year, month and day from the OS time, osTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6508
     and evaluate the argument, a 3-arg block with these.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6509
     Conversion is to localtime including any daylight saving adjustments."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6510
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6511
    |year month day osSeconds|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6512
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6513
    osSeconds := osTime // 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6514
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6515
    struct tm* tmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6516
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6517
    TIME_T tt;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6518
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6519
    t = __longIntVal(osSeconds);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6520
    tt = (TIME_T)t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6521
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6522
    tmPtr = localtime(&tt);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6523
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6524
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6525
    day = __MKSMALLINT(tmPtr->tm_mday);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6526
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6527
    aBlock value:year value:month value:day
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6528
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6529
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6530
     OperatingSystem computeDatePartsOf:0 for:[:y :m :d |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6531
	y printCR. m printCR. d printCR
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6532
     ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6533
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6534
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6535
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6536
computeOSTimeFromYear:y month:m day:d hour:h minute:min seconds:s millis:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6537
    "return the OS-dependent time for the given time and day. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6538
     The arguments are assumed to be in localtime including
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6539
     any daylight saving adjustings."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6540
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6541
    |osSeconds|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6542
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6543
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6544
    struct tm tm;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6545
    TIME_T t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6546
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6547
    if (__bothSmallInteger(y, m) 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6548
     && __bothSmallInteger(d, h)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6549
     && __bothSmallInteger(min, s)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6550
	tm.tm_hour = __intVal(h);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6551
	tm.tm_min = __intVal(min);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6552
	tm.tm_sec = __intVal(s);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6553
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6554
	tm.tm_year = __intVal(y) - 1900;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6555
	tm.tm_mon = __intVal(m) - 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6556
	tm.tm_mday = __intVal(d);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6557
	tm.tm_isdst = -1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6558
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6559
	t = mktime(&tm);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6560
	osSeconds = __MKUINT((INT)t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6561
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6562
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6563
    osSeconds notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6564
	^ osSeconds * 1000 + millis
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6565
    ].    
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6566
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6567
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6568
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6569
     OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6570
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6571
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6572
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6573
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6574
computeTimePartsOf:osTime for:aBlock
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6575
    "compute hours, minutes, seconds and milliseconds from the osTime 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6576
     and evaluate the argument, a 4-arg block with these.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6577
     Conversion is to localtime including any daylight saving adjustments."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6578
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6579
    |hours minutes seconds millis osSeconds|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6580
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6581
    osSeconds := osTime // 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6582
    millis := osTime \\ 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6583
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6584
    struct tm *tmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6585
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6586
    TIME_T tt;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6587
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6588
    t = __longIntVal(osSeconds);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6589
    tt = (TIME_T)t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6590
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6591
    tmPtr = localtime(&tt);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6592
    hours = __MKSMALLINT(tmPtr->tm_hour);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6593
    minutes = __MKSMALLINT(tmPtr->tm_min);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6594
    seconds = __MKSMALLINT(tmPtr->tm_sec);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6595
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6596
    aBlock value:hours value:minutes value:seconds value:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6597
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6598
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6599
     OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6600
	h printCR. m printCR. s printCR. millis printCR
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6601
     ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6602
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6603
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6604
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6605
computeUTCTimeAndDateFrom:osTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6606
    "given an OS-dependent time in osTime, return an Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6607
     containing year, month, day, hour, minute and seconds,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6608
     offset to UTC, daylight savings time flag, milliseconds,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6609
     dayInYear (1..) and dayInWeek (1..).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6610
     Conversion is to UTC."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6611
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6612
    |low hi year month day hours minutes seconds millis utcOffset 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6613
     dst yDay wDay osSeconds ret|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6614
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6615
    millis := osTime \\ 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6616
    osSeconds := osTime // 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6617
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6618
    struct tm *tmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6619
    struct tm *gmTmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6620
    long t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6621
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6622
    t = __longIntVal(osSeconds);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6623
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6624
    tmPtr = gmtime(&t);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6625
    hours = __MKSMALLINT(tmPtr->tm_hour);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6626
    minutes = __MKSMALLINT(tmPtr->tm_min);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6627
    seconds = __MKSMALLINT(tmPtr->tm_sec);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6628
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6629
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6630
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6631
    day = __MKSMALLINT(tmPtr->tm_mday);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6632
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6633
    yDay = __MKSMALLINT(tmPtr->tm_yday + 1);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6634
    wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6635
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6636
    if (tmPtr->tm_isdst == 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6637
	dst = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6638
	utcOffset = __MKINT(TIMEZONE(tmPtr));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6639
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6640
	dst = true;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6641
#ifdef HAS_ALTZONE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6642
	utcOffset = __MKINT(altzone);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6643
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6644
	utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6645
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6646
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6647
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6648
    "I would love to have SELF-like inline objects ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6649
    ret := Array new:11.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6650
    ret at:1 put:year.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6651
    ret at:2 put:month.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6652
    ret at:3 put:day.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6653
    ret at:4 put:hours.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6654
    ret at:5 put:minutes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6655
    ret at:6 put:seconds.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6656
    ret at:7 put:utcOffset.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6657
    ret at:8 put:dst.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6658
    ret at:9 put:millis.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6659
    ret at:10 put:yDay.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6660
    ret at:11 put:wDay.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6661
    ^ ret
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6662
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6663
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6664
     OperatingSystem computeUTCTimeAndDateFrom:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6665
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6666
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6667
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6668
computeUTCTimePartsOf:osTime for:aBlock
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6669
    "compute hours, minutes, seconds and milliseconds from the osTime 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6670
     and evaluate the argument, a 4-arg block with these.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6671
     Conversion is to UTC."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6672
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6673
    |hours minutes seconds millis osSeconds|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6674
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6675
    osSeconds := osTime // 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6676
    millis := osTime \\ 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6677
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6678
    struct tm *tmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6679
    long t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6680
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6681
    t = __longIntVal(osSeconds);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6682
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6683
    tmPtr = gmtime(&t);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6684
    hours = __MKSMALLINT(tmPtr->tm_hour);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6685
    minutes = __MKSMALLINT(tmPtr->tm_min);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6686
    seconds = __MKSMALLINT(tmPtr->tm_sec);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6687
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6688
    aBlock value:hours value:minutes value:seconds value:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6689
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6690
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6691
     OperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6692
	h printCR. m printCR. s printCR. milli printCR
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6693
     ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6694
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6695
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6696
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6697
getMillisecondTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6698
    "This returns the millisecond timers value. 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6699
     The range is limited to 0..1fffffff (i.e. the SmallInteger range) to avoid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6700
     LargeInteger arithmetic when doing timeouts and delays.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6701
     Since this value is wrapping around in regular intervals, this can only be used for 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6702
     short relative time deltas.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6703
     Use the millisecondTimeXXX:-methods to compare and add time deltas - these know about the wrap.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6704
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6705
     BAD DESIGN:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6706
	This should be changed to return some instance of RelativeTime,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6707
	and these computations moved there.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6708
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6709
     Dont use this method in application code since it is an internal (private)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6710
     interface. For compatibility with ST-80, use Time millisecondClockValue.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6711
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6712
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6713
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6714
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6715
    long t = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6716
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6717
#if !defined(HAS_GETTIMEOFDAY)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6718
# if defined(HAS_FTIME)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6719
    struct timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6720
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6721
    ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6722
    t = (timebuffer.time * 1000) + timebuffer.millitm;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6723
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6724
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6725
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6726
# ifndef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6727
#  ifdef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6728
    t = GetTickCount();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6729
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6730
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6731
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6732
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6733
# ifndef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6734
#  ifdef MSDOS_LIKE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6735
#   ifdef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6736
    struct timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6737
    ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6738
#   else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6739
    struct _timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6740
    _ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6741
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6742
    t = (timebuffer.time * 1000) + timebuffer.millitm;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6743
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6744
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6745
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6746
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6747
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6748
#ifndef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6749
    /* assume HAS_GETTIMEOFDAY 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6750
     * - will result in a linkage error
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6751
     * if not fixed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6752
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6753
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6754
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6755
     * bsd time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6756
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6757
    struct timeval tb;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6758
    struct timezone tzb;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6759
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6760
    gettimeofday(&tb, &tzb);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6761
    t = tb.tv_sec*1000 + tb.tv_usec/1000;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6762
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6763
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6764
#undef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6765
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6766
    RETURN ( __MKSMALLINT(t & 0x1FFFFFFF) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6767
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6768
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6769
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6770
getOSTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6771
    "This returns the OS time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6772
     The base of the returned value is not consistent across
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6773
     different OS's - some return the number of millis since jan, 1st 1970;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6774
     others since 1900. The Time classes are prepared for this, and 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6775
     converts as appropriate (by using my fromOSTime: conversion methods).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6776
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6777
     Dont use this method in application code since it is an internal (private)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6778
     interface. For compatibility with ST-80, use Time>>millisecondClockValue.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6779
     or use instances of Time, Date or AbsoluteTime to work with.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6780
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6781
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6782
    |seconds millis|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6783
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6784
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6785
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6786
    long t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6787
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6788
#if !defined(HAS_GETTIMEOFDAY) 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6789
# if defined(HAS_FTIME)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6790
    struct timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6791
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6792
    ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6793
    seconds = __MKUINT(timebuffer.time);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6794
    millis = __MKUINT(timebuffer.millitm);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6795
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6796
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6797
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6798
# ifndef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6799
#  ifdef MSDOS_LIKE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6800
#   ifdef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6801
    struct timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6802
    ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6803
#   else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6804
    struct _timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6805
    _ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6806
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6807
    seconds = __MKUINT(timebuffer.time);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6808
    millis = __MKUINT(timebuffer.millitm);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6809
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6810
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6811
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6812
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6813
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6814
#ifndef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6815
    /* assume HAS_GETTIMEOFDAY 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6816
     * - will result in a linkage error
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6817
     * if not fixed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6818
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6819
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6820
     * bsd time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6821
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6822
    struct timeval tb;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6823
    struct timezone tzb;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6824
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6825
    gettimeofday(&tb, &tzb);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6826
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6827
    seconds = __MKUINT(tb.tv_sec);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6828
    millis = __MKUINT(tb.tv_usec / 1000);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6829
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6830
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6831
#undef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6832
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6833
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6834
    ^ (seconds * 1000) + millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6835
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6836
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6837
     OperatingSystem getOSTime printCR.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6838
     Delay waitForSeconds:0.2.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6839
     OperatingSystem getOSTime printCR.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6840
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6841
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6842
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6843
sleep:numberOfSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6844
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6845
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6846
    "cease ANY action for some time. This suspends the whole smalltalk
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6847
     (unix-) process for some time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6848
     Not really useful since not even low-prio processes and interrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6849
     handling will run during the sleep.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6850
     Use either OperatingSystem>>millisecondDelay: (which makes all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6851
     threads sleep, but handles interrupts) or use a Delay (which makes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6852
     only the calling thread sleep)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6853
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6854
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6855
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6856
    if (__isSmallInteger(numberOfSeconds)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6857
	sleep(__intVal(numberOfSeconds));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6858
	RETURN ( self );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6859
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6860
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6861
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6862
     argument not integer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6863
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6864
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6865
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6866
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6867
     OperatingSystem sleep:2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6868
    "
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6869
!
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6870
7749
abfd41c7d264 missing method for windows
Stefan Vogel <sv@exept.de>
parents: 7720
diff changeset
  6871
timeInfoFromSeconds:osSeconds milliseconds:osMilliSeconds localTime:isLocalTime
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6872
    "return a timeInfo structure containing values for the given
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6873
     OS-second value.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6874
     An internal helper"
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6875
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6876
    |low hi year month day hours minutes seconds utcOffset 
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6877
     dst yDay wDay info|
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6878
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6879
%{
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6880
    struct tm *tmPtr;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6881
    struct tm *gmTmPtr;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6882
    INT t;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6883
    TIME_T tt;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6884
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6885
    t = __longIntVal(osSeconds);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6886
    tt = (TIME_T)t;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6887
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6888
    tmPtr = localtime(&tt);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6889
    hours = __MKSMALLINT(tmPtr->tm_hour);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6890
    minutes = __MKSMALLINT(tmPtr->tm_min);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6891
    seconds = __MKSMALLINT(tmPtr->tm_sec);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6892
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6893
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6894
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6895
    day = __MKSMALLINT(tmPtr->tm_mday);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6896
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6897
    yDay = __MKSMALLINT(tmPtr->tm_yday+1);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6898
    wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6899
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6900
    if (tmPtr->tm_isdst == 0) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6901
	dst = false;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6902
	utcOffset = __MKINT(TIMEZONE(tmPtr));
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6903
    } else {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6904
	dst = true;
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6905
#ifdef HAS_ALTZONE
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6906
	utcOffset = __MKINT(altzone);
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6907
#else
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6908
	utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6909
#endif
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6910
    }
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6911
%}.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6912
    info := self timeInfoClass new.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6913
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6914
    info
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6915
	year:year
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6916
	month:month
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6917
	day:day
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6918
	hours:hours
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6919
	minutes:minutes
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6920
	seconds:seconds
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6921
	milliseconds:osMilliSeconds
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6922
	utcOffset:utcOffset
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6923
	dst:dst
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6924
	dayInYear:yDay
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  6925
	dayInWeek:wDay.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6926
    ^ info
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6927
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6928
    "
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6929
     OperatingSystem timeInfoFromSeconds:0 localTime:false
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  6930
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6931
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6932
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6933
!Win32OperatingSystem class methodsFor:'users & groups'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6934
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6935
getEffectiveGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6936
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6937
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6938
    "return the current users (thats you) effective numeric group id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6939
     This is only different from getGroupID, if you have ST/X running
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6940
     as a setuid program (of which you should think about twice)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6941
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6942
    ^ self getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6943
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6944
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6945
     OperatingSystem getEffectiveGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6946
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6947
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6948
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6949
getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6950
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6951
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6952
    "return the current users (thats you) effective numeric user id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6953
     This is only different from getUserID, if you have ST/X running
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6954
     as a setuid program (of which you should think about twice)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6955
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6956
    ^ self getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6957
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6958
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6959
     OperatingSystem getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6960
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6961
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6962
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6963
getFullUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6964
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6965
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6966
    "return a string with the users full name - if available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6967
     If not, return the login name as a fallBack."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6968
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6969
    |info gecos|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6970
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6971
    info := self userInfoOf:userID.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6972
    (info notNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6973
    and:[info includesKey:#gecos]) ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6974
	gecos := info at:#gecos.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6975
	(gecos includes:$,) ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6976
	    ^ gecos copyTo:(gecos indexOf:$,) - 1
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6977
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6978
	^ gecos
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6979
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6980
    ^ self getUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6981
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6982
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6983
     OperatingSystem getFullUserNameFromID:0 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6984
     OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID)  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6985
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6986
     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6987
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6988
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6989
    "Modified: 15.7.1996 / 12:44:21 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6990
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6991
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6992
getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6993
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6994
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6995
    "return the current users (thats you) numeric group id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6996
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6997
    ^ 1 "just a dummy for systems which do not have groupIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6998
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6999
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7000
     OperatingSystem getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7001
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7002
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7003
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7004
getGroupNameFromID:aNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7005
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7006
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7007
    "return the group-name-string for a given numeric group-id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7008
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7009
    ^ '???' "just a dummy for systems which do not have groupIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7011
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7012
     OperatingSystem getGroupNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7013
     OperatingSystem getGroupNameFromID:10
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7014
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7015
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7016
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7017
getHomeDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7018
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7019
5264
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
  7020
    "return the name of the users home directory (i.e. yours).
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
  7021
     This uses the value of the HOME environment variable,
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
  7022
     or HOMEDRIVE:HOMEPATH as a fallBack.
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
  7023
     If not set, return the current directory."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7024
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7025
    |dir drv path|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7026
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7027
    dir := self getEnvironment:'HOME'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7028
    dir isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7029
	"/ for NT users:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7030
	"/ if HOME is nil, try HOMEDRIVE and HOMEPATH
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7031
	"/
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7032
	((drv := self getEnvironment:'HOMEDRIVE') notNil
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7033
	and:[(path := self getEnvironment:'HOMEPATH') notNil]) ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7034
	    dir := drv , path
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7035
	] ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7036
	    dir := '.'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7037
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7038
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7039
    ^ dir
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7041
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7042
     OperatingSystem getHomeDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7043
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7044
5264
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
  7045
    "Modified: / 16.2.2000 / 09:17:55 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7046
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7047
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7048
getLoginName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7049
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7050
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7051
    "return a string with the users login name (thats yours)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7052
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7053
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7054
    static char cachedName[64];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7055
    static firstCall = 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7056
#ifndef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7057
    extern char *getenv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7058
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7059
    char *name = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7060
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7061
    if (firstCall) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7062
	int nameSize = sizeof(cachedName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7063
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7064
	if (GetUserName(cachedName, &nameSize) == TRUE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7065
	    name = cachedName;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7066
	    firstCall = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7067
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7068
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7069
	name = cachedName;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7070
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7071
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7072
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7073
     * try a few common environment variables ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7074
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7075
    if (! name || (name[0] == 0) ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7076
	name = getenv("LOGIN");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7077
	if (! name || (name[0] == 0) ) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7078
	    name = getenv("LOGNAME");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7079
	    if (! name || (name[0] == 0) ) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7080
		name = getenv("USER");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7081
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7082
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7083
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7084
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7085
     * nope - I really font know who you are.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7086
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7087
    if (! name || (name[0] == 0) ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7088
	name = "you";
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7089
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7090
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7091
    RETURN ( __MKSTRING(name) );
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7092
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7093
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7094
     OperatingSystem getLoginName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7095
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7096
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7097
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7098
getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7099
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7100
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7101
    "return the current users (thats you) numeric user id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7102
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7103
    ^ 1 "just a dummy for systems which do not have userIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7104
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7105
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7106
     OperatingSystem getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7107
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7108
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7109
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7110
getUserNameFromID:aNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7111
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7112
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7113
    "return the user-name-string for a given numeric user-id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7114
     This is the login name, not the fullName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7115
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7116
    aNumber == self getUserID ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7117
	^ self getLoginName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7118
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7119
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7120
    ^ '? (' , aNumber printString , ')'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7121
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7122
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7123
     OperatingSystem getUserNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7124
     OperatingSystem getUserNameFromID:100
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7125
     OperatingSystem getUserNameFromID:9991 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7126
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7127
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7129
userInfoOf:aNameOrID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7130
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7131
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7132
    "return a dictionary filled with userinfo. The argument can be either
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7133
     a string with the users name or its numeric id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7134
     Notice, that DOS systems only provide a very limited set of information.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7135
     Portable applications may want to check the systemType and NOT depend
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7136
     on all keys to be present in the returned dictionary."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7137
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7138
    |info name uid gid dir|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7139
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7140
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7141
    name isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7142
	aNameOrID == self getUserID ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7143
	    name := self getLoginName
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7144
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7145
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7146
    name notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7147
	info at:#name put:name.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7148
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7149
	info at:#name put:'unknown'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7150
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7151
    dir isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7152
	aNameOrID == self getUserID ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7153
	    dir := self getHomeDirectory
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7154
	]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7155
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7156
    dir notNil ifTrue:[info at:#dir put:dir].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7157
    "/ uid notNil ifTrue:[info at:#uid put:uid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7158
    "/ gid  notNil ifTrue:[info at:#gid put:gid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7159
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7160
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7161
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7162
     OperatingSystem userInfoOf:'root'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7163
     OperatingSystem userInfoOf:1      
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7164
     OperatingSystem userInfoOf:'claus' 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7165
     OperatingSystem userInfoOf:'fooBar' 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7166
     OperatingSystem userInfoOf:(OperatingSystem getUserID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7167
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7168
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7169
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7170
!Win32OperatingSystem class methodsFor:'waiting for events'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7171
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7172
blockingChildProcessWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7173
     "return true, if childProcessWait: blocks, if no children are ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7174
      On those systems, we must be somewhat careful when looking out for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7175
      a subprocesses status (to avoid blocking)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7176
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7177
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7178
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7179
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7180
childProcessWait:blocking pid:pidToWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7181
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7182
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7183
    "get status changes from child processes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7184
     Return an OSProcessStatus or nil, if no process has terminated.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7185
     If blocking is true, we wait until a process changed state, 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7186
     otherwise we return immediately.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7187
     Note that win32 needs to know the HANDLE of the process on which 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7188
     it waits.  In case of an error, THIS ALWAYS WAITS and then times out."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7189
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7190
    |pid status code core|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7191
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7192
    DWORD endStatus;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7193
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  7194
    if (__isExternalAddressLike(pidToWait) ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7195
	HANDLE __pidToWait = _HANDLEVal(pidToWait);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7196
	int t;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7197
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7198
#ifdef PROCESS1DEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7199
	printf("childProcessWait %x b %d\n",__pidToWait,blocking==true); 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7200
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7201
	t = blocking==true ? INFINITE : 0;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7202
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7203
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7204
	do {    
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7205
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7206
	    endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, __pidToWait, t);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7207
	} while ((endStatus < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7208
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7209
	endStatus = WaitForSingleObject(__pidToWait, t);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7210
	if (endStatus < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7211
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7212
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7213
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7214
	if ( endStatus == WAIT_TIMEOUT ) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7215
	    if (blocking==true)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7216
		status = @symbol(timeout);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7217
	    else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7218
		status = @symbol(continue);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7219
#ifdef PROCESS1DEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7220
		printf("ret nil\n");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7221
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7222
		RETURN(nil);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7223
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7224
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7225
	    status = @symbol(exit);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7226
#ifdef PROCESS1DEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7227
	    printf("exit\n");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7228
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7229
	    if (endStatus == WAIT_OBJECT_0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7230
		if (GetExitCodeProcess(__pidToWait, &endStatus)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7231
		    if (endStatus == STILL_ACTIVE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7232
			RETURN(nil); 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7233
		    }   
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7234
#ifdef PROCESS1DEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7235
		    printf("exit %d\n",endStatus);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7236
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7237
		    code = __MKSMALLINT(endStatus);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7238
		} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7239
		    code = __MKSMALLINT(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7240
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7241
	    } else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7242
		code = __MKSMALLINT(-1);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7243
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7244
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7245
	core = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7246
	pid = pidToWait;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7247
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7248
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7249
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7250
    (status isNil or:[pid isNil]) ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7251
	^ self primitiveFailed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7252
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7253
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7254
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7255
"/ show:' code: '; show:code; show:' core:'; showCR:core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7256
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7257
    ^ OSProcessStatus pid:pid status:status code:code core:core
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7258
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7259
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7260
     OperatingSystem childProcessWait:false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7261
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7262
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7263
    "Created: 5.1.1996 / 16:39:14 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7264
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7265
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7266
numAvailableForReadOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7267
    "return the number of bytes available for reading, without blocking."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7268
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7269
    ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7270
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7271
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7272
readCheck:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7273
    "return true, if data is available on a filedescriptor
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7274
     (i.e. read is possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7275
     This depends on a working select or FIONREAD to be provided by the OS."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7276
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7277
    ^ super readCheck:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7278
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7279
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7280
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7281
    "wait for any fd in readFdArray (an Array of integers) to become ready for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7282
     reading, writeFdArray to become ready for writing, or exceptFdArray to
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7283
     arrive exceptional data (i.e. out-of-band data).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7284
     Timeout after t milliseconds or, if the timeout time is 0, immediately..
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7285
     Empty fd-sets will always wait. Zero time can be used to poll file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7286
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7287
     Return first ready fd if I/O ok, nil if timed-out or interrupted."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7288
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7289
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7290
#define MAXHANDLE 128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7291
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7292
    int i;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7293
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7294
    OBJ fd, retFd;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7295
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7296
    int numHandles = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7297
    DWORD res;
7865
67ea99d5edcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7860
diff changeset
  7298
    HANDLE hArray[MAXHANDLE+1];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7299
    int    retArray[MAXHANDLE];
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7300
    int    readCount;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7301
    int    writeCount;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7302
    int    exceptCount;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7303
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7304
    if (__isNonNilObject(readFdArray)) {
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7305
	if (! __isArray(readFdArray)) goto fail;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7306
	readCount = __arraySize(readFdArray);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7307
    } else {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7308
	readCount = 0;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7309
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7310
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7311
    if (__isNonNilObject(writeFdArray)) {
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7312
	if (! __isArray(writeFdArray)) goto fail;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7313
	writeCount = __arraySize(writeFdArray);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7314
    } else {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7315
	writeCount = 0;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7316
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7317
    
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7318
    if (__isNonNilObject(exceptFdArray)) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7319
	if (! __isArray(exceptFdArray)) goto fail;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7320
	exceptCount = __arraySize(exceptFdArray);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7321
    } else {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7322
	exceptCount = 0;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7323
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7324
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7325
    for (i = 0; (i < readCount) && (numHandles < MAXHANDLE);i++) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7326
	fd = __ArrayInstPtr(readFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7327
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7328
	if (fd != nil) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7329
	    if (__isExternalAddressLike(fd)) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7330
		hArray  [numHandles] = _HANDLEVal(fd);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7331
		retArray[numHandles] = i;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7332
		++numHandles;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7333
	    } else {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7334
		if (_canReadWithoutBlocking (__intVal(fd) ) ) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7335
		    RETURN (fd);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7336
		}
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7337
	    }
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7338
	}
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7339
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7340
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7341
    for (i = 0; (i < writeCount) && (numHandles < MAXHANDLE);i++) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7342
	fd = __ArrayInstPtr(writeFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7343
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7344
	if (fd != nil) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7345
	    if (__isExternalAddressLike(fd)) {
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7346
		hArray  [numHandles] = _HANDLEVal(fd);
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7347
		retArray[numHandles] = i + 10000;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7348
		++numHandles;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7349
	    } else {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7350
		if (_canWriteWithoutBlocking (__intVal(fd) ) ) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7351
		    RETURN (fd);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7352
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7353
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7354
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7355
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7356
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7357
    for (i = 0; (i < exceptCount) && (numHandles < MAXHANDLE);i++) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7358
	fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7359
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7360
	if (fd != nil) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7361
	    if (__isExternalAddressLike(fd)) {
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7362
		hArray  [numHandles] = _HANDLEVal(fd);
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7363
		retArray[numHandles] = i + 20000;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7364
		++numHandles;
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7365
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7366
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7367
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7368
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7369
    if (__isSmallInteger(millis)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7370
	t = __intVal(millis);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7371
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7372
	if (t <= 0 && numHandles == 0) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7373
	    RETURN (nil);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7374
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7375
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7376
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7377
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7378
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7379
#ifdef SELECT3DEBUGWIN32
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7380
    printf("wait Handles = %d timeout = %d\n",numHandles, t);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7381
#endif
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7382
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7383
    res = __vmWait (numHandles, hArray, MAXHANDLE, t);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7384
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7385
    if (numHandles) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7386
	if (res == WAIT_FAILED) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7387
#ifdef SELECT2DEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7388
	    printf("- error %d; ret nil\n",GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7389
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7390
	    if (__threadErrno == EINTR) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7391
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7392
		@global(LastErrorNumber) = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7393
	    } else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7394
		__threadErrno = EBADF; 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7395
		if (@global(InfoPrinting) == true) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7396
		    fprintf(stderr, "OS [info]: select errno = %d\n", __threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7397
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7398
		@global(LastErrorNumber) = __MKSMALLINT(__threadErrno);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7399
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7400
	    RETURN ( nil );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7401
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7402
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7403
	if (res == WAIT_TIMEOUT) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7404
#ifdef SELECT3DEBUGWIN32
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7405
	    printf("- timeOut; ret nil\n" );
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7406
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7407
	    goto polling;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7408
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7409
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7410
	if ((res < 0) || (res >= numHandles)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7411
#ifdef SELECTDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7412
	    printf("- res=%d error1 %d\n", res, GetLastError());
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7413
#endif                                                            
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7414
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7415
	    @global(LastErrorNumber) = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7416
	    RETURN ( nil );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7417
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7418
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7419
	ret = res;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7420
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7421
	if (ret < numHandles) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7422
	    int fd = retArray[ret];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7423
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7424
	    @global(LastErrorNumber) = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7425
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7426
#ifdef SELECTDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7427
	    if (ret) printf("wait Handles %d %d ret\n", ret, fd);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7428
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7429
	    if (fd < 10000) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7430
		RETURN ( __ArrayInstPtr(readFdArray)->a_element[fd] );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7431
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7432
	    if (fd < 20000) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7433
		RETURN ( __ArrayInstPtr(writeFdArray)->a_element[fd-10000] );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7434
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7435
	    RETURN ( __ArrayInstPtr(exceptFdArray)->a_element[fd-20000] );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7436
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7437
	printf("wait Handles ret = %d error2 %d\n", ret, GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7438
	goto fail;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7439
    } else {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7440
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7441
polling:
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7442
        
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7443
	for (i=0; i < readCount;i++) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7444
	    fd = __ArrayInstPtr(readFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7445
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7446
	    if (fd != nil) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7447
		if (! __isExternalAddressLike(fd)) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7448
		    if (_canReadWithoutBlocking (__intVal(fd)) ) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7449
			RETURN (fd);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7450
		    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7451
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7452
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7453
	}
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7454
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7455
	for (i=0; i < writeCount;i++) {
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7456
	    fd = __ArrayInstPtr(writeFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7457
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7458
	    if (fd != nil) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7459
		if (! __isExternalAddressLike(fd)) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7460
		    if (_canWriteWithoutBlocking (__intVal(fd)) ) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7461
			RETURN (fd);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7462
		    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7463
		}
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7464
	    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7465
	}
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7466
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7467
	@global(LastErrorNumber) = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7468
	RETURN ( nil );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7469
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7470
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7471
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7472
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7473
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7474
     timeout argument not integer,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7475
     or any fd-array nonNil and not an array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7476
     or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7477
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7478
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7479
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7480
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7481
setBlocking:aBoolean on:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7482
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7483
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7484
    "set/clear the blocking attribute - if set (which is the default)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7485
     a read on the fileDescriptor will block until data is available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7486
     If cleared, a read operation will immediately return with a value of
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7487
     nil."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7488
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7489
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7490
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7491
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7492
waitForMultipleObjects:fdOrHandleArray withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7493
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7494
     Timeout after t milliseconds or, if the timeout time is 0, immediately..
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7495
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7496
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7497
     Return the fd if I/O ok, nil if timed-out or interrupted."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7498
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7499
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7500
#ifndef MAXHANDLE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7501
# define MAXHANDLE 128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7502
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7503
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7504
    DWORD res;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7505
    HANDLE hArray[MAXHANDLE];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7506
    INT i, count;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7507
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7508
    if (! __isArray(fdOrHandleArray)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7509
	goto fail;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7510
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7511
    count = __arraySize(fdOrHandleArray);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7512
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7513
    for (i=0; i<count; i++) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7514
	OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7515
	HANDLE h;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7516
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  7517
	if (__isExternalAddressLike(fdOrHandle)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7518
	    h = _HANDLEVal(fdOrHandle);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7519
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7520
	    if (__isSmallInteger(fdOrHandle)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7521
		h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7522
	    } else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7523
		goto fail;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7524
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7525
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7526
	hArray[i] = h;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7527
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7528
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7529
    if (__isSmallInteger(millis)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7530
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7531
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7532
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7533
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7534
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7535
#ifdef DO_WRAP_CALLS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7536
    do {    
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7537
	__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7538
	res = STX_API_CALL4( "WaitForMultipleObjects", WaitForMultipleObjects, count, hArray, FALSE, t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7539
    } while ((res < 0) && (__threadErrno == EINTR));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7540
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7541
    res = WaitForMultipleObjects(count, hArray, FALSE, t);
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  7542
    if (res < 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7543
	__threadErrno = __WIN32_ERR(GetLastError());
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  7544
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7545
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7546
    if (res == WAIT_FAILED) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7547
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7548
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7549
    if (res == WAIT_TIMEOUT) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7550
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7551
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7552
    if ((res >= WAIT_OBJECT_0) && (res < (WAIT_OBJECT_0+count))) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7553
	RETURN (__ArrayInstPtr(fdOrHandleArray)->a_element[res-WAIT_OBJECT_0]);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7554
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7555
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7556
    RETURN (nil);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7557
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7558
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7559
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7560
     invalid arg,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7561
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7562
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7563
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7564
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7565
waitForSingleObject:fdOrHandle withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7566
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7567
     Timeout after t milliseconds or, if the timeout time is 0, immediately..
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7568
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7569
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7570
     Return the fd if I/O ok, nil if timed-out or interrupted."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7571
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7572
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7573
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7574
    DWORD res;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7575
    HANDLE h = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7576
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  7577
    if (__isExternalAddressLike(fdOrHandle)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7578
	h = _HANDLEVal(fdOrHandle);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7579
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7580
	if (__isSmallInteger(fdOrHandle)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7581
	    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7582
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7583
	    goto fail;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7584
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7585
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7586
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7587
    if (__isSmallInteger(millis)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7588
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7589
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7590
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7591
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7592
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7593
#ifdef DO_WRAP_CALLS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7594
    do {    
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7595
	__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7596
	res = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, h,  t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7597
    } while ((res < 0) && (__threadErrno == EINTR));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7598
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7599
    res = WaitForSingleObject(h, t);
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  7600
    if (res < 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7601
	__threadErrno = __WIN32_ERR(GetLastError());
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  7602
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7603
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7604
    if (res == WAIT_FAILED) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7605
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7606
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7607
    if (res == WAIT_TIMEOUT) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7608
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7609
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7610
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7611
    RETURN (fdOrHandle);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7612
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7613
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7614
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7615
     invalid arg,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7616
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7617
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7618
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7619
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7620
!Win32OperatingSystem::FileStatusInfo class methodsFor:'instance creation'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7621
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7622
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT created:cT path:lP alternativeName:name2
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7623
    ^ self basicNew
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7624
	type:t mode:m uid:u gid:g size:s 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7625
	id:i accessed:aT modified:mT created:cT 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7626
	path:lP alternativeName:name2
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7627
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7628
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7629
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT created:cT path:lP fullName:fullName alternativeName:name2
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7630
    ^ self basicNew
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7631
	type:t mode:m uid:u gid:g size:s 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7632
	id:i accessed:aT modified:mT created:cT 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7633
	path:lP 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7634
	fullName:fullName
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7635
	alternativeName:name2
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7636
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7637
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7638
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7639
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7640
accessTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7641
    "return accessed"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7642
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7643
    ^ accessed
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7644
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7645
    "Created: / 1.2.2002 / 11:05:49 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7646
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7647
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7648
alternativeName
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7649
    "return the files other name (DOS name on windows).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7650
     Nil if there is no other name"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7651
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7652
    ^ alternativeName
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7653
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7654
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7655
creationTime
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7656
    ^ created
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7657
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7658
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7659
fileSize
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7660
    "return size"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7661
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7662
    ^ size
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7663
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7664
    "Created: / 1.2.2002 / 11:06:15 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7665
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7666
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7667
fixedHeaderSize
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7668
    "return the fixedHeaderSize (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7669
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7670
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7671
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7672
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7673
fullName
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7674
    "return the files real name (non-DOS name on windows).
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7675
     Nil if there is no other name"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7676
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7677
    ^ fullName
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7678
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7679
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7680
gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7681
    "return gid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7682
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7683
    ^ gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7684
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7685
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7686
id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7687
    "return id"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7688
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7689
    ^ id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7690
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7691
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7692
mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7693
    "return mode"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7694
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7695
    ^ mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7696
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7697
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7698
modificationTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7699
    "return modified"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7700
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7701
    ^ modified
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7702
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7703
    "Created: / 1.2.2002 / 11:06:33 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7704
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7705
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7706
numLinks
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7707
    "DOS has no hardLinks - return 1"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7708
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7709
    ^ 1
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7710
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7711
    "Created: / 1.2.2002 / 11:07:04 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7712
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7713
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7714
path
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7715
    "for symbolic links only: return the path where the symbolic link points to"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7716
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7717
    ^ path
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7718
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7719
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7720
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7721
recordAttributes
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7722
    "return the recordAttributes (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7723
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7724
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7725
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7726
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7727
recordFormat
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7728
    "return the recordFormat (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7729
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7730
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7731
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7732
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7733
recordFormatNumeric
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7734
    "return the recordFormat as numeric (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7735
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7736
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7737
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7738
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7739
recordSize
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7740
    "return the recordSize (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7741
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7742
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7743
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7744
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7745
size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7746
    "return size"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7747
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7748
    ^ size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7749
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7750
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7751
statusChangeTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7752
    "return statusChanged"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7753
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7754
    ^ statusChanged ? modified
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7755
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7756
    "Created: / 1.2.2002 / 11:07:27 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7757
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  7758
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7759
type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7760
    "return type"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7761
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7762
    ^ type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7763
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7764
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7765
uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7766
    "return uid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7767
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7768
    ^ uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7769
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7770
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7771
!Win32OperatingSystem::FileStatusInfo methodsFor:'backward compatibility'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7772
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7773
accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7774
    "return accessed"
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7775
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7776
    self obsoleteMethodWarning:'use #accessTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7777
    ^ accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7778
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7779
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7780
at:key
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7781
    "backward compatibility access: in previous releases, IdentityDictionaries
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7782
     were used to hold my information. Allow access via key messages.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7783
     This method will vanish - use the proper access protocol."
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7784
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7785
    ^ self perform:key
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7786
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7787
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7788
modified
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7789
    "return modified"
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7790
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7791
    self obsoleteMethodWarning:'use #modificationTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7792
    ^ modified
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7793
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7794
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7795
statusChanged
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7796
    "return statusChanged"
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7797
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7798
    self obsoleteMethodWarning:'use #statusChangeTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7799
    ^ statusChanged
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7800
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7801
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7802
!Win32OperatingSystem::FileStatusInfo methodsFor:'private accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7803
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7804
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT created:cT path:lP alternativeName:name2
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7805
    type := t.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7806
    mode := m.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7807
    uid := u.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7808
    gid := g.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7809
    size := s.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7810
    id := i.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7811
    accessed := aT.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7812
    modified := mT.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  7813
    created := cT.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7814
    path := lP.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7815
    alternativeName := name2.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7816
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7817
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7818
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT created:cT path:lP fullName:name1 alternativeName:name2
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7819
    type := t.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7820
    mode := m.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7821
    uid := u.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7822
    gid := g.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7823
    size := s.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7824
    id := i.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7825
    accessed := aT.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7826
    modified := mT.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7827
    created := cT.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7828
    path := lP.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7829
    fullName := name1.    
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  7830
    alternativeName := name2.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7831
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7832
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7833
!Win32OperatingSystem::FileStatusInfo methodsFor:'queries'!
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7834
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7835
isDirectory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7836
    ^ type == #directory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7837
!
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7838
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7839
isSymbolicLink
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7840
    ^ type == #symbolicLink
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7841
! !
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  7842
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7843
!Win32OperatingSystem::OSProcessStatus class methodsFor:'documentation'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7844
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7845
documentation
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7846
"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7847
    This is an auxillary class, that holds information about status changes of
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7848
    operating system processes (these are no smalltalk processes!!).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7849
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7850
    [Instance variables:]
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7851
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7852
	pid     <Integer>       OS-Process identifier
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7853
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7854
	status  <Symbol>        either #exit #signal #stop #continue
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7855
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7856
	code    <Integer>       either exitcode or signalnumber
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7857
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7858
	core    <Boolean>       true if core has been dumped
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7859
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7860
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7861
    [author:]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7862
	Stefan Vogel
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7863
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7864
    [see also:]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7865
	OperatingSystem
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7866
"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7867
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7868
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7869
!Win32OperatingSystem::OSProcessStatus class methodsFor:'instance creation'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7870
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7871
pid:pid status:status code:code core:core
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7872
    "private interface for Win32OperatingSystem"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7873
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7874
    ^ self new pid:pid status:status code:code core:core
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7875
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7876
    "Created: 28.12.1995 / 14:16:14 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7877
    "Modified: 30.4.1996 / 18:25:00 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7878
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7879
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7880
processCreationFailure
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7881
    "private interface for Win32OperatingSystem"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7882
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7883
    ^ self new pid:-1 status:#failure code:-1 core:false
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7884
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7885
    "Created: 28.12.1995 / 14:35:29 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7886
    "Modified: 30.4.1996 / 18:25:05 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7887
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7888
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7889
!Win32OperatingSystem::OSProcessStatus methodsFor:'accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7890
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7891
code
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7892
    "return the exitcode / signalNumber"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7893
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7894
    ^ code
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7895
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7896
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7897
    "Modified: 30.4.1996 / 18:26:23 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7898
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7899
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7900
core
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7901
    "return true if core has been dumped, false otherwise"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7902
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7903
    ^ core == true
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7904
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7905
    "Modified: 28.12.1995 / 14:14:38 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7906
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7907
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7908
pid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7909
    "return the pid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7910
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7911
    ^ pid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7912
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7913
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7914
    "Modified: 30.4.1996 / 18:26:30 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7915
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7916
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7917
status
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7918
    "return status as a Symbol;
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7919
     one of #exit #signal #stop #continue"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7920
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7921
    ^ status
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7922
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7923
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7924
    "Modified: 30.4.1996 / 18:26:54 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7925
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7926
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7927
!Win32OperatingSystem::OSProcessStatus methodsFor:'initialization'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7928
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7929
pid:newPid status:newStatus code:newCode core:newCore
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7930
    pid := newPid.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7931
    status := newStatus.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7932
    code := newCode.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7933
    core := newCore.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7934
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7935
    "Created: 28.12.1995 / 14:18:22 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7936
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7937
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7938
!Win32OperatingSystem::OSProcessStatus methodsFor:'private-OS interface'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7939
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7940
code:something
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7941
    "set the exitCode"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7942
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7943
    code := something.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7944
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7945
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7946
    "Modified: 30.4.1996 / 18:25:18 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7947
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7948
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7949
core:something
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7950
    "set core"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7951
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7952
    core := something.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7953
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7954
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7955
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7956
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7957
pid:something
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7958
    "set pid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7959
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7960
    pid := something.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7961
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7962
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7963
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7964
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7965
status:something
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7966
    "set status"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7967
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7968
    status := something.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7969
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7970
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7971
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7972
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7973
!Win32OperatingSystem::OSProcessStatus methodsFor:'queries'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7974
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7975
couldNotExecute
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7976
    "return true when a command could not be executed"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7977
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7978
    ^ status == #exit and:[code = 127].
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7979
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7980
    "Created: 28.12.1995 / 15:43:17 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7981
    "Modified: 30.4.1996 / 18:27:03 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7982
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7983
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7984
stillAlive
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7985
    "true if process is still alive"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7986
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7987
    ^ status == #stop or:[status == #continue]
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7988
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7989
    "Created: 28.12.1995 / 14:27:26 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7990
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7991
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7992
success
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7993
    "true if process terminated successfully"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7994
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7995
    ^ status == #exit and:[code = 0]
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7996
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7997
    "Created: 28.12.1995 / 14:13:05 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7998
    "Modified: 28.12.1995 / 14:13:41 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  7999
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8000
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8001
!Win32OperatingSystem::RegistryEntry class methodsFor:'defaults'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8003
rootKeyNames
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8004
    ^ #(
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8005
	'HKEY_CLASSES_ROOT'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8006
	'HKEY_CURRENT_USER' 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8007
	'HKEY_LOCAL_MACHINE' 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8008
	'HKEY_USERS' 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8009
	'HKEY_PERFORMANCE_DATA' 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8010
	'HKEY_CURRENT_CONFIG' 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8011
	'HKEY_DYN_DATA' 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8012
      )
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8013
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8014
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8015
separator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8016
    ^$\
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8017
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8018
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8019
!Win32OperatingSystem::RegistryEntry class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8021
documentation
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8022
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8023
    Interface to a WIN32 registry.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8024
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8025
    [author:]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8026
	Claus Gittinger (initial version & cleanup)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8027
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8028
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8029
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8030
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8031
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8032
examples
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8033
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8034
    create a key (if not already present):
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8035
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8036
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8037
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8038
	k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8039
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8041
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8042
    ask a keys value:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8043
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8044
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8045
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8046
	k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8047
	Transcript show:'Windows serial NR:'; showCR:(k valueNamed:'ProductId').
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8048
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8049
	k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8050
	Transcript showCR:(k valueNamed:'CurrentVersion').
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8051
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8052
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8053
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8054
    create a sub-key (if not already present):
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8055
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8056
	|k subKey|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8057
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8058
	k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8059
	subKey := k createSubKeyNamed:'RegistryDemo'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8060
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8061
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8062
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8063
    change a keys value:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8064
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8065
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8066
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8067
	k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8068
	k valueNamed:'FooBarBaz' put:'a foo bar baz string'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8069
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8070
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8071
    delete a value:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8072
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8073
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8074
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8075
	k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8076
	k deleteValueNamed:'FooBarBaz'. 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8077
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8078
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8079
    delete a key:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8080
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8081
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8082
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8083
	k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8084
	k deleteSubKeyNamed:'RegistryDemo'. 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8085
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8086
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8087
    enumerate keys:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8088
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8089
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8090
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8091
	k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8092
	k subKeysDo:[:subKey |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8093
	    Transcript showCR:subKey path
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8094
	]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8095
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8096
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8097
    enumerate all keys (recursive):
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8098
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8099
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8100
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8101
	k := Win32OperatingSystem::RegistryEntry key:'HKEY_LOCAL_MACHINE\Software'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8102
	k allSubKeysDo:[:subKey |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8103
	    Transcript showCR:subKey path
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8104
	]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8105
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8106
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8107
    fetch value by index:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8108
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8109
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8110
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8111
	k := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8112
	Transcript showCR:(k valueNameAtIndex:0)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8113
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8114
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8115
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8116
    enumerate value names:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8117
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8118
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8119
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8120
	k := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8121
	k valueNamesDo:[:nm  |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8122
	   Transcript showCR:nm.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8123
	]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8124
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8125
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8126
    enumerate values:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8127
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8128
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8129
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8130
	k := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8131
	k valueNamesAndValuesDo:[:nm :val |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8132
	    Transcript showCR:(nm , ' -> ' , val storeString).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8133
	]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8134
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8135
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8136
    search for a value (where does NT store the domain ?):
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8137
									[exBegin]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8138
	|k|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8139
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8140
	k := self key:'HKEY_LOCAL_MACHINE\System'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8141
	k subKeysDo:[:subKey |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8142
	    subKey subKeysDo:[:subSubKey |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8143
		|tcp params|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8144
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8145
		(subSubKey path asLowercase endsWith:'services') ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8146
		    tcp := subSubKey subKeyNamed:'tcpip'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8147
		    tcp notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8148
			params := tcp subKeyNamed:'parameters'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8149
			params notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8150
			    Transcript showCR:'Domain is found in ' , params path ,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8151
					' value: ' , (params valueNamed:'Domain').
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8152
			    params close.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8153
			].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8154
			tcp close.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8155
		    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8156
		]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8157
	    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8158
	]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8159
									[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8160
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8161
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8162
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8163
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8164
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8165
!Win32OperatingSystem::RegistryEntry class methodsFor:'initialization'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8166
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8167
initialize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8168
    Lobby := Registry new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8169
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8170
    HKEY_CLASSES_ROOT     := %{ __MKEXTERNALADDRESS(HKEY_CLASSES_ROOT) %}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8171
    HKEY_CURRENT_USER     := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_USER) %}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8172
    HKEY_LOCAL_MACHINE    := %{ __MKEXTERNALADDRESS(HKEY_LOCAL_MACHINE) %}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8173
    HKEY_USERS            := %{ __MKEXTERNALADDRESS(HKEY_USERS) %}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8174
    HKEY_PERFORMANCE_DATA := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_DATA) %}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8175
    HKEY_CURRENT_CONFIG   := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_CONFIG) %}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8176
    HKEY_DYN_DATA         := %{ __MKEXTERNALADDRESS(HKEY_DYN_DATA) %}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8177
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8178
    "Created: / 19.5.1999 / 21:39:57 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8179
    "Modified: / 19.5.1999 / 22:45:31 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8180
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8181
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8182
rootKeyValueFor:specialKeyStringOrSymbol
5142
13dec365d177 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5141
diff changeset
  8183
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
13dec365d177 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5141
diff changeset
  8184
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8185
    specialKeyStringOrSymbol = 'HKEY_CLASSES_ROOT' ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8186
	^ HKEY_CLASSES_ROOT.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8187
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8188
    specialKeyStringOrSymbol = 'HKEY_CURRENT_USER' ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8189
	^ HKEY_CURRENT_USER.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8190
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8191
    specialKeyStringOrSymbol = 'HKEY_LOCAL_MACHINE' ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8192
	^ HKEY_LOCAL_MACHINE.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8193
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8194
    specialKeyStringOrSymbol = 'HKEY_USERS' ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8195
	^ HKEY_USERS.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8196
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8197
    specialKeyStringOrSymbol = 'HKEY_PERFORMANCE_DATA' ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8198
	^ HKEY_PERFORMANCE_DATA.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8199
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8200
    specialKeyStringOrSymbol = 'HKEY_CURRENT_CONFIG' ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8201
	^ HKEY_CURRENT_CONFIG.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8202
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8203
    specialKeyStringOrSymbol = 'HKEY_DYN_DATA' ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8204
	^ HKEY_DYN_DATA.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8205
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8206
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8207
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8208
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8209
    "Created: / 19.5.1999 / 21:40:30 / cg"
5142
13dec365d177 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5141
diff changeset
  8210
    "Modified: / 24.12.1999 / 00:02:06 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8211
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8212
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8213
!Win32OperatingSystem::RegistryEntry class methodsFor:'instance creation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8214
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8215
key:aKeyNamePath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8216
    "retrieve an entry by full path name (starting at a root)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8217
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8218
    |idx first rest root|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8219
5142
13dec365d177 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5141
diff changeset
  8220
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
13dec365d177 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5141
diff changeset
  8221
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8222
    idx := aKeyNamePath indexOf:(self separator).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8223
    idx == 0 ifTrue:[
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8224
	first := aKeyNamePath.
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8225
	rest := nil.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8226
    ] ifFalse:[
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8227
	first := aKeyNamePath copyTo:idx-1.
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8228
	rest := aKeyNamePath copyFrom:idx+1
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8229
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8230
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8231
    first := first asUppercase.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8232
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8233
    "/ the first is a pseudo name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8234
    root := self rootKey:first.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8235
    root isNil ifTrue:[
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8236
	^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8237
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8238
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8239
    rest size == 0 ifTrue:[
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  8240
	^ root
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8241
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8242
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8243
    ^ root subKeyNamed:rest.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8244
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8245
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8246
     self key:'HKEY_LOCAL_MACHINE'      
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8247
     self key:'HKEY_LOCAL_MACHINE\Software'      
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8248
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'      
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8249
     self key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\3.2.5\Directory'      
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8250
    "
5142
13dec365d177 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5141
diff changeset
  8251
13dec365d177 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5141
diff changeset
  8252
    "Modified: / 24.12.1999 / 00:01:52 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8253
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8254
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8255
rootKey:aRootKeyStringOrSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8256
    "retrieve one of the root entries by name"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8257
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8258
    |keyVal|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8259
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8260
    keyVal := self rootKeyValueFor:aRootKeyStringOrSymbol.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8261
    keyVal isNil ifTrue:[^ nil].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8262
    "/ rootKeys are not registered for RegClose ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8263
    ^ self basicNew setHandle:keyVal path:aRootKeyStringOrSymbol.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8264
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8265
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8266
     RegistryEntry rootKey:#'HKEY_LOCAL_MACHINE'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8267
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8268
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8269
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8270
!Win32OperatingSystem::RegistryEntry class methodsFor:'registry access'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8271
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8272
stringValueFor:valueName atKey:keyPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8273
    "convenient accessing method;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8274
     Looks for a string value under keyPath;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8275
     returns nil if either not found, or no string value"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8276
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8277
    |k v|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8278
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8279
    k := self key:keyPath.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8280
    k isNil ifTrue:[^ nil].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8281
    v := k valueNamed:valueName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8282
    k close.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8283
    v isString ifFalse:[^ nil].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8284
    ^ v
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8285
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8286
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8287
     self 
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8288
	stringValueFor:'Content Type'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8289
	atKey:'HKEY_CLASSES_ROOT\.au'  
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8290
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8291
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8292
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8293
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8294
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8295
name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8296
    "return the keys name component (subKey name within my
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8297
     parent key)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8298
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8299
    |idx|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8300
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8301
    idx := path lastIndexOf:(self class separator).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8302
    idx == 0 ifTrue:[^ path].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8303
    ^ path copyFrom:idx+1
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8304
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8305
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8306
path
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8307
    "return the keys full key path name"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8308
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8309
    ^ path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8310
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8311
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8312
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing subkeys'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8313
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8314
createSubKeyNamed:subKeyString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8315
    "create a new key below mySelf and return a new registry entry for it.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8316
     If it already exists, return it.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8317
     Return nil if the new key cannot be created."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8318
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8319
    |newEntry subHandle|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8320
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8321
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8322
    HKEY myKey, subKey = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8323
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8324
    if (__isExternalAddressLike(__INST(handle)) 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8325
     && (__isString(subKeyString) || __isSymbol(subKeyString))) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8326
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8327
	if (RegCreateKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8328
	    subHandle = __MKEXTERNALADDRESS(subKey);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8329
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8330
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8331
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8332
    subHandle notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8333
	newEntry := self class basicNew 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8334
			setHandle:subHandle 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8335
			path:(path , self class separator asString , subKeyString).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8336
	Lobby register:newEntry.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8337
	^ newEntry.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8338
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8339
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8340
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8341
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8342
     |top sub|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8343
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8344
     top := self key:'HKEY_LOCAL_MACHINE'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8345
     sub := top createSubKeyNamed:'FooBarBaz'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8346
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8347
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8348
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8349
deleteSubKeyNamed:subKeyString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8350
    "delete a key below mySelf.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8351
     Return true on success."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8352
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8353
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8354
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8355
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8356
    if (__isExternalAddressLike(__INST(handle)) 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8357
     && (__isString(subKeyString) || __isSymbol(subKeyString))) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8358
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8359
	if (RegDeleteKey(myKey, __stringVal(subKeyString)) == ERROR_SUCCESS) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8360
	    RETURN (true);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8361
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8362
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8363
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8364
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8365
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8366
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8367
     |top sub|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8368
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8369
     top := self key:'HKEY_LOCAL_MACHINE'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8370
     sub := top createSubKeyNamed:'FooBarBaz'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8371
     top deleteSubKeyNamed:'FooBarBaz'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8372
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8373
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8374
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8375
remoteKeyOnHost:hostName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8376
    "return the corresponding registry entry from 
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8377
     a remote computers registry."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8378
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8379
    |newEntry remoteHandle|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8380
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8381
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8382
    HKEY myKey, remoteKey = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8383
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8384
    if (__isExternalAddressLike(__INST(handle)) && __isString(hostName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8385
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8386
	if (RegConnectRegistry(__stringVal(hostName), myKey, &remoteKey) == ERROR_SUCCESS) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8387
	    remoteHandle = __MKEXTERNALADDRESS(remoteKey);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8388
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8389
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8390
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8391
    remoteHandle notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8392
	newEntry := self class basicNew setHandle:remoteHandle path:path.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8393
	Lobby register:newEntry.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8394
	^ newEntry.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8395
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8396
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8397
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8398
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8399
     |top remote|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8400
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8401
     top := self key:'HKEY_LOCAL_MACHINE'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8402
     remote := top remoteKeyOnHost:'BETTI'  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8403
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8404
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8405
     |top remote|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8406
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8407
     top := self key:'HKEY_USERS'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8408
     remote := top remoteKeyOnHost:'BETTI'   
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8409
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8410
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8411
     |top remote|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8412
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8413
     top := self key:'HKEY_LOCAL_MACHINE'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8414
     remote := top remoteKeyOnHost:'JOSHUA'  
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8415
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8416
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8417
     |top remote|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8418
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8419
     top := self key:'HKEY_USERS'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8420
     remote := top remoteKeyOnHost:'JOSHUA'   
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8421
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8422
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8423
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8424
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8425
subKeyAtIndex:subKeyIndex
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8426
    "return a new registry entry below mySelf for the given subKey index.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8427
     Return nil if no such key exists"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8428
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8429
    |subKeyName subKeyClassName|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8430
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8431
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8432
    HKEY myKey, subKey = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8433
    char nameBuffer[256];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8434
    DWORD nameSize = sizeof(nameBuffer) - 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8435
    char classNameBuffer[256];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8436
    DWORD classNameSize = sizeof(classNameBuffer) - 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8437
    FILETIME modificationTime;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8438
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8439
    if (__isExternalAddressLike(__INST(handle)) 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8440
     && __isSmallInteger(subKeyIndex)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8441
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8442
	if (RegEnumKeyEx(myKey, __intVal(subKeyIndex), 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8443
			 nameBuffer, &nameSize,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8444
			 NULL,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8445
			 classNameBuffer, &classNameSize,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8446
			 &modificationTime) == ERROR_SUCCESS) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8447
	    nameBuffer[nameSize] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8448
	    classNameBuffer[classNameSize] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8449
	    subKeyName = __MKSTRING(nameBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8450
	    subKeyClassName = __MKSTRING(classNameBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8451
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8452
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8453
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8454
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8455
    subKeyName isNil ifTrue:[^ nil].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8456
    ^ self subKeyNamed:subKeyName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8457
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8458
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8459
     |top sub|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8460
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8461
     top := self key:'HKEY_LOCAL_MACHINE'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8462
     sub := top subKeyAtIndex:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8463
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8464
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8465
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8466
subKeyNamed:subKeyString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8467
    "return a new registry entry below mySelf with the given subKey.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8468
     Return nil if no such key exists"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8469
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8470
    |newEntry subHandle|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8471
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8472
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8473
    HKEY myKey, subKey = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8474
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8475
    if (__isExternalAddressLike(__INST(handle)) 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8476
     && (__isString(subKeyString) || __isSymbol(subKeyString))) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8477
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8478
	if (RegOpenKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8479
	    subHandle = __MKEXTERNALADDRESS(subKey);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8480
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8481
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8482
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8483
    subHandle notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8484
	newEntry := self class basicNew 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8485
			setHandle:subHandle 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8486
			path:(path , self class separator asString , subKeyString).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8487
	Lobby register:newEntry.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8488
	^ newEntry.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8489
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8490
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8491
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8492
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8493
     |top sub|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8494
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8495
     top := self key:'HKEY_LOCAL_MACHINE'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8496
     sub := top subKeyNamed:'Software'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8497
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8498
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8499
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8500
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing values'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8501
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8502
deleteValueNamed:aValueName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8503
    "delete a value.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8504
     Return true on success."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8505
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8506
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8507
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8508
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8509
    if (__isExternalAddressLike(__INST(handle)) 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8510
     && (__isString(aValueName) || __isSymbol(aValueName))) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8511
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8512
	if (RegDeleteValue(myKey, __stringVal(aValueName)) == ERROR_SUCCESS) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8513
	    RETURN (true);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8514
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8515
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8516
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8517
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8518
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8519
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8520
valueNameAtIndex:valueIndex
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8521
    "return a values name for the given value index.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8522
     Return nil if no such value exists"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8523
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8524
    |valueName|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8525
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8526
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8527
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8528
    char nameBuffer[256];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8529
    DWORD nameSize = sizeof(nameBuffer) - 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8530
    DWORD valueType;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8531
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8532
    if (__isExternalAddressLike(__INST(handle)) 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8533
     && __isSmallInteger(valueIndex)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8534
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8535
	if (RegEnumValue(myKey, __intVal(valueIndex), 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8536
			 nameBuffer, &nameSize,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8537
			 NULL,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8538
			 &valueType, 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8539
			 NULL, NULL) == ERROR_SUCCESS) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8540
	    nameBuffer[nameSize] = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8541
	    valueName = __MKSTRING(nameBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8542
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8543
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8544
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8545
    ^ valueName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8546
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8547
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8548
     |top sub|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8549
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8550
     top := self key:'HKEY_LOCAL_MACHINE'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8551
     sub := top subKeyAtIndex:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8552
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8553
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8554
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8555
valueNamed:aValueName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8556
    "retrieve a value; the returned object depends upon the type:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8557
	REG_BINARY      -> ByteArray
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8558
	REG_SZ          -> String
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8559
	REG_MULTI_SZ    -> Array of strings
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8560
	REG_DWORD       -> Integer
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8561
	REG_NONE        -> nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8562
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8563
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8564
    |data stringArray|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8565
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8566
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8567
    DWORD valueType;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8568
    union {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8569
	DWORD dWord;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8570
	unsigned char dWordBytes[4];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8571
	unsigned char smallDataBuffer[256];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8572
    } quickData;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8573
    int val;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8574
    DWORD dataSize = sizeof(quickData);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8575
    unsigned char *dataBuffer = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8576
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8577
    if (__isExternalAddressLike(__INST(handle)) 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8578
     && (__isString(aValueName) || __isSymbol(aValueName))) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8579
	int ret;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8580
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8581
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8582
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8583
	/*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8584
	 * try to get it with one call ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8585
	 */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8586
	ret = RegQueryValueEx(myKey, __stringVal(aValueName), 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8587
			 NULL,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8588
			 &valueType,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8589
			 &quickData, &dataSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8590
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8591
	if (ret == ERROR_MORE_DATA) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8592
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8593
	     * nope - need another one ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8594
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8595
	    switch (valueType) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8596
		case REG_BINARY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8597
		case REG_MULTI_SZ:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8598
		    data = __BYTEARRAY_UNINITIALIZED_NEW_INT(dataSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8599
		    dataBuffer = __ByteArrayInstPtr(data)->ba_element;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8600
		    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8601
		case REG_SZ:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8602
		    data = __MKEMPTYSTRING(dataSize-1);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8603
		    dataBuffer = __stringVal(data);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8604
		    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8605
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8606
	    if (dataBuffer) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8607
		ret = RegQueryValueEx(myKey, __stringVal(aValueName), 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8608
				 NULL,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8609
				 &valueType,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8610
				 dataBuffer, &dataSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8611
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8612
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8613
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8614
	if (ret == ERROR_SUCCESS) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8615
	    switch (valueType) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8616
		case REG_NONE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8617
		    /* RETURN (@symbol(none));  */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8618
		    RETURN (nil);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8619
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8620
		case REG_BINARY:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8621
		    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8622
		     * did we get it with the first call ?
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8623
		     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8624
		    if (! dataBuffer) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8625
			data = __MKBYTEARRAY(quickData.smallDataBuffer, dataSize);    
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8626
		    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8627
		    RETURN (data);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8628
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8629
		case REG_SZ:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8630
		case REG_EXPAND_SZ:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8631
		    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8632
		     * did we get it with the first call ?
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8633
		     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8634
		    if (! dataBuffer) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8635
			data = __MKSTRING_L(quickData.smallDataBuffer, dataSize-1);    
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8636
		    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8637
		    RETURN (data);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8638
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8639
#if 0
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8640
		case REG_DWORD:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8641
		    /* int in native format */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8642
		    RETURN (__MKUINT(quickData.dWord));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8643
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8644
		case REG_DWORD_LITTLE_ENDIAN:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8645
		    val = quickData.dWordBytes[3];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8646
		    val = (val << 8) | quickData.dWordBytes[2];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8647
		    val = (val << 8) | quickData.dWordBytes[1];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8648
		    val = (val << 8) | quickData.dWordBytes[0];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8649
		    RETURN (__MKUINT(val));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8650
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8651
		case REG_DWORD_BIG_ENDIAN:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8652
		    val = quickData.dWordBytes[0];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8653
		    val = (val << 8) | quickData.dWordBytes[1];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8654
		    val = (val << 8) | quickData.dWordBytes[2];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8655
		    val = (val << 8) | quickData.dWordBytes[3];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8656
		    RETURN (__MKUINT(val));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8657
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8658
		case REG_MULTI_SZ:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8659
		    {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8660
			char *cp, *cp0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8661
			int ns = 0, i;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8662
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8663
			cp0 = dataBuffer ? dataBuffer : quickData.smallDataBuffer;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8664
			cp = cp0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8665
			while (*cp) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8666
			    while (*cp++) ;;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8667
			    ns++;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8668
			    cp++;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8669
			}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8670
			stringArray = __ARRAY_NEW_INT(ns);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8671
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8672
			i = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8673
			while (*cp0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8674
			    OBJ s;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8675
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8676
			    cp = cp0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8677
			    while (*cp++) ;;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8678
			    s = __MKSTRING(cp0);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8679
			    __ArrayInstPtr(stringArray)->a_element[i] = s;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8680
			    __STORE(stringArray, s);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8681
			    cp++;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8682
			    cp0 = cp;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8683
			    i++;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8684
			}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8685
			RETURN (stringArray);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8686
		    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8687
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8688
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8689
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8690
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8691
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8692
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8693
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8694
     |key|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8695
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8696
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8697
     key valueNamed:'CurrentVersion'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8698
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8699
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8700
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8701
valueNamed:aValueName put:datum
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8702
    "store a value; the value type depends upon the stored value:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8703
	ByteArray       -> REG_BINARY
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8704
	String          -> REG_SZ 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8705
	Array of string -> REG_MULTI_SZ  
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8706
	Integer         -> REG_DWORD  
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8707
	nil             -> REG_NONE  
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8708
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8709
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8710
    |data stringArray|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8711
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8712
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8713
    DWORD valueType = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8714
    int val;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8715
    DWORD dataSize = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8716
    unsigned char *dataPointer = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8717
    int datumOk = 1, mustFreeData = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8718
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8719
    if (__isExternalAddressLike(__INST(handle)) 
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8720
     && (__isString(aValueName) || __isSymbol(aValueName))) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8721
	int ret;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8722
	OBJ cls;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8723
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8724
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8725
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8726
	if (datum == nil) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8727
	    valueType = REG_NONE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8728
	    dataSize = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8729
	} else if (__isSmallInteger(datum)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8730
	    valueType = REG_DWORD;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8731
	    val = __intVal(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8732
	    dataPointer = (unsigned char *)(&val);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8733
	    dataSize = sizeof(val);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8734
	} else if (__isString(datum) || __isSymbol(datum)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8735
	    valueType = REG_SZ;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8736
	    dataPointer = __stringVal(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8737
	    dataSize = __stringSize(datum) + 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8738
	} else if (__Class(datum) == ByteArray) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8739
	    valueType = REG_BINARY;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8740
	    dataPointer = __ByteArrayInstPtr(datum)->ba_element;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8741
	    dataSize = __byteArraySize(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8742
	} else if (__Class(datum) == LargeInteger) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8743
	    valueType = REG_DWORD;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8744
	    val = __longIntVal(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8745
	    if (val) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8746
		dataPointer = (unsigned char *)(&val);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8747
		dataSize = sizeof(val);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8748
	    } else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8749
		datumOk = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8750
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8751
	} else if (__Class(datum) == Array) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8752
	    int i = 0, ns = 0, totalSize = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8753
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8754
	    valueType = REG_MULTI_SZ;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8755
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8756
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8757
	     * must allocate a local buffer
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8758
	     * find size ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8759
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8760
	    for (i=0; i<__arraySize(datum); i++) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8761
		OBJ s = __ArrayInstPtr(datum)->a_element[i];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8762
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8763
		if (__isString(datum) || __isSymbol(datum)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8764
		    totalSize += __stringSize(datum) + 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8765
		} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8766
		    datumOk = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8767
		    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8768
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8769
		ns++;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8770
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8771
	    if (datumOk) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8772
		char *cp;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8773
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8774
		/*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8775
		 * allocate and fill...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8776
		 */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8777
		totalSize ++;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8778
		dataPointer = (char *)(malloc(totalSize));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8779
		mustFreeData = 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8780
		cp = dataPointer;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8781
		for (i=0; i<__arraySize(datum); i++) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8782
		    OBJ s = __ArrayInstPtr(datum)->a_element[i];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8783
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8784
		    strcpy(cp, __stringVal(s));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8785
		    cp += __stringSize(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8786
		    *cp++ = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8787
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8788
		*cp++ = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8789
		dataSize = totalSize;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8790
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8791
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8792
	    datumOk = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8793
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8794
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8795
	if (datumOk) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8796
	    ret = RegSetValueEx(myKey, __stringVal(aValueName), 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8797
				0, valueType,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8798
				dataPointer, dataSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8799
	    if (mustFreeData) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8800
		free(dataPointer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8801
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8802
	    RETURN ((ret == ERROR_SUCCESS) ? true : false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8803
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8804
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8805
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8806
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8807
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8808
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8809
     |key|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8810
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8811
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8812
     key valueNamed:'CurrentVersion' put:'3.5.2'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8813
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8814
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8815
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8816
!Win32OperatingSystem::RegistryEntry methodsFor:'enumeration'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8817
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8818
allSubKeysDo:aBlock
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8819
    "recursively evaluate aBlock for all subKeys below the receiver"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8820
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8821
    |idx subEntry|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8822
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8823
    idx := 0.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8824
    [true] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8825
	subEntry := self subKeyAtIndex:idx.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8826
	subEntry isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8827
	    ^self
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8828
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8829
	aBlock value:subEntry.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8830
	subEntry allSubKeysDo:aBlock.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8831
	subEntry close.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8832
	idx := idx + 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8833
    ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8834
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8835
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8836
     |top sub|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8837
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8838
     top := self key:'HKEY_LOCAL_MACHINE'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8839
     top allSubKeysDo:[:subEntry |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8840
	Transcript showCR:subEntry path
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8841
     ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8842
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8843
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8844
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8845
subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8846
    "return a collection of subKeys below the receiver"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8847
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8848
    |idx subEntry subKeys|
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8849
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8850
    subKeys := OrderedCollection new.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8851
    self subKeysDo:[:k | subKeys add:k].
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8852
    ^ subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8853
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8854
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8855
     |top sub|
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8856
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8857
     top := self key:'HKEY_LOCAL_MACHINE'.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8858
     top subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8859
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8860
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8861
    "Created: / 23.12.1999 / 22:15:22 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8862
    "Modified: / 23.12.1999 / 22:15:44 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8863
!
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  8864
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8865
subKeysDo:aBlock
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8866
    "evaluate aBlock for all subKeys below the receiver"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8867
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8868
    |idx subEntry|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8869
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8870
    idx := 0.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8871
    [true] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8872
	subEntry := self subKeyAtIndex:idx.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8873
	subEntry isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8874
	    ^self
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8875
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8876
	aBlock value:subEntry.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8877
	subEntry close.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8878
	idx := idx + 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8879
    ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8880
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8881
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8882
     |top sub|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8883
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8884
     top := self key:'HKEY_LOCAL_MACHINE'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8885
     top subKeysDo:[:subEntry |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8886
	Transcript showCR:subEntry path
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8887
     ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8888
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8889
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8890
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8891
valueNamesAndValuesDo:aBlock
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8892
    "evaluate aBlock for all value names"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8893
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8894
    self valueNamesDo:[:nm |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8895
	aBlock value:nm value:(self valueNamed:nm)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8896
    ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8897
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8898
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8899
     |key|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8900
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8901
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8902
     key valueNamesAndValuesDo:[:nm :val |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8903
	Transcript showCR:(nm , ' -> ' , val storeString).
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8904
     ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8905
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8906
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8907
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8908
valueNamesDo:aBlock
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8909
    "evaluate aBlock for all value names"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8910
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8911
    |idx valueName|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8912
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8913
    idx := 0.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8914
    [true] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8915
	valueName := self valueNameAtIndex:idx.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8916
	valueName isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8917
	    ^self
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8918
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8919
	aBlock value:valueName.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8920
	idx := idx + 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8921
    ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8922
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8923
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8924
!Win32OperatingSystem::RegistryEntry methodsFor:'instance release'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8925
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8926
close
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8927
    "close mySelf"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8928
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8929
    self closeKey.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8930
    Lobby unregister:self.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8931
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8932
    "Modified: / 19.5.1999 / 22:44:44 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8933
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8934
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8935
closeKey
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8936
    "close mySelf"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8937
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8938
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8939
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8940
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8941
    if (__isExternalAddressLike(__INST(handle))) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8942
	myKey = (HKEY)(__externalAddressVal(__INST(handle)));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8943
	__INST(handle) = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8944
	RegCloseKey(myKey);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8945
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8946
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8947
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8948
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8949
disposed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8950
    "some entry has been collected - close it"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8951
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8952
    handle notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8953
	self closeKey.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8954
    ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8955
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8956
    "Created: / 19.5.1999 / 22:39:52 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8957
    "Modified: / 19.5.1999 / 22:44:50 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8958
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8959
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8960
!Win32OperatingSystem::RegistryEntry methodsFor:'private'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8961
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8962
setHandle:aHandle path:aPathString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8963
    handle := aHandle.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8964
    path := aPathString.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8965
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8966
    "Created: / 19.5.1999 / 22:27:05 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8967
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8968
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8969
setupForHandleValue:integerHandleValue
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8970
    "not normally used - given an integer address,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8971
     return a registry entry. This is provided to
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8972
     allow for future root keys to be added at the smalltalk level"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8973
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8974
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8975
    HKEY key;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8976
    OBJ t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8977
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8978
    key = __longIntVal(integerHandleValue);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8979
    if (! key) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8980
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8981
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8982
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8983
    __INST(handle) = t = __MKEXTERNALADDRESS(key); __STORE(self, t);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8984
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8985
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8986
    "Created: / 19.5.1999 / 21:45:05 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8987
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8988
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8989
!Win32OperatingSystem::Win32FILEHandle class methodsFor:'documentation'!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8990
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8991
documentation
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8992
"
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8993
    I represent a FILE*, as used in the stdio library.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8994
    Since most stdio libs are inherently buggy, thread-unsave
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8995
    and hard to use in a multithreading environment,
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8996
    these will no longer be used in future ST/X versions.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8997
    However, they may be useful when interfacing to external
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8998
    libraries...
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  8999
"
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9000
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9001
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9002
version
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  9003
    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.148 2004-03-05 17:05:43 ca Exp $'
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9004
! !
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9005
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9006
!Win32OperatingSystem::Win32FILEHandle methodsFor:'release'!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9007
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9008
closeFile
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9009
    "close the file"
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9010
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9011
%{
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9012
    FILE *f = (FILE *)(__externalAddressVal(self));
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9013
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9014
    if (f) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9015
	__externalAddressVal(self) = NULL;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9016
	fclose(f);
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9017
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9018
%}.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9019
! !
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9020
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9021
!Win32OperatingSystem::Win32Handle class methodsFor:'documentation'!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9022
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9023
documentation
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9024
"
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9025
    I represent a generic HANDLE, which can be closed via CloseHandle.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9026
"
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9027
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9028
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9029
version
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  9030
    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.148 2004-03-05 17:05:43 ca Exp $'
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9031
! !
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9032
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9033
!Win32OperatingSystem::Win32Handle methodsFor:'io'!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9034
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9035
readBytes:count into:aByteBuffer startingAt:firstIndex
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9036
    "read count bytes into a byte-buffer;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9037
     Return the number of bytes read (negative on error)"
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9038
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9039
    |errSym errorNumber|
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9040
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9041
%{
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9042
    unsigned char *extPtr;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9043
    int bufferIsExternalBytes;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9044
    int mustFreeBuffer = 0;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9045
    int nRead = -1;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9046
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9047
    DWORD cntWanted, offs, cntRead;
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9048
    int bufferSize;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9049
    char miniBuffer[32];
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9050
    BOOL ok;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9051
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9052
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9053
	errSym = @symbol(errorNotOpen);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9054
	goto bad;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9055
    }
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9056
    if (! __bothSmallInteger(count, firstIndex)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9057
	errSym = @symbol(badArgument);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9058
	goto bad;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9059
    }
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9060
    cntWanted = __smallIntegerVal(count);
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9061
    if (cntWanted <= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9062
	errSym = @symbol(badCount);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9063
	goto bad;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9064
    }
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9065
    offs = __smallIntegerVal(firstIndex) - 1;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9066
    if (offs < 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9067
	errSym = @symbol(badOffset);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9068
	goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9069
    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9070
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9071
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9072
    if (! bufferIsExternalBytes) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9073
	if (__isByteArray(aByteBuffer)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9074
	    bufferSize = __byteArraySize(aByteBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9075
	} else if (__isString(aByteBuffer)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9076
	    bufferSize = __stringSize(aByteBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9077
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9078
	    errSym = @symbol(badBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9079
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9080
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9081
	if (bufferSize < (cntWanted + offs)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9082
	    errSym = @symbol(badBufferSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9083
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9084
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9085
	if (cntWanted <= sizeof(miniBuffer)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9086
	    extPtr = miniBuffer;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9087
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9088
	    extPtr = malloc(cntWanted);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9089
	    mustFreeBuffer = 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9090
	}
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9091
    } else {        
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9092
	OBJ sz;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9093
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9094
	extPtr = (char *)(__externalBytesAddress(aByteBuffer));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9095
	sz = __externalBytesSize(aByteBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9096
	if (! __isSmallInteger(sz)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9097
	    errSym = @symbol(badBufferSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9098
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9099
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9100
	bufferSize = __smallIntegerVal(sz);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9101
	if (bufferSize < (cntWanted + offs)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9102
	    errSym = @symbol(badBufferSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9103
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9104
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9105
	extPtr = extPtr + offs;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9106
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9107
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9108
    do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9109
	__threadErrno = 0;
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  9110
	ok = STX_API_CALL5( "ReadFile", ReadFile, hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */);
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9111
    } while(__threadErrno == EINTR);
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9112
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9113
    if (ok == TRUE) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9114
	if (! bufferIsExternalBytes) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9115
	    /* copy over */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9116
	    memcpy(__byteArrayVal(aByteBuffer)+offs, extPtr, cntRead);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9117
	    if (mustFreeBuffer) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9118
		free(extPtr);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9119
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9120
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9121
	RETURN (__mkSmallInteger(cntRead));
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9122
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9123
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9124
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9125
bad: ;   
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9126
    if (mustFreeBuffer) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9127
	free(extPtr);
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9128
    }
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9129
%}.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9130
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9131
    errorNumber isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9132
	self error:'invalid argument(s): ', errSym.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9133
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9134
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9135
    ].
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9136
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9137
    "
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9138
     |h buff n|
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9139
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9140
     h := self basicNew.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9141
     buff := ByteArray new:10. 
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9142
     n := h readBytes:10 into:buff startingAt:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9143
     Transcript show:n; space; showCR:buff.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9144
    "
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9145
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9146
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9147
readWaitWithTimeoutMs:millis
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9148
    "return true if a timeout occurred"
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9149
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9150
    |errSym errorNumber|
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9151
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9152
%{
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9153
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9154
    DWORD res;
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9155
    INT t;
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9156
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9157
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9158
	errSym = @symbol(errorNotOpen);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9159
	goto bad;
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9160
    }
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9161
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9162
#if 0
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9163
    if (ioctlsocket((SOCKET)hFile, FIONREAD, &res)==0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9164
	/* its a socket */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9165
	if (res > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9166
	    RETURN ( false ); 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9167
	}
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9168
    }
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9169
    if (PeekNamedPipe(hFile, 0, 0, 0, &res, 0)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9170
	/* its a namedPipe */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9171
	if (res > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9172
	    RETURN ( false ); 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9173
	}
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9174
    }
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9175
#endif
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9176
    if (__isSmallInteger(millis)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9177
	t = __intVal(millis);
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9178
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9179
	t = INFINITE;
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9180
    }
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9181
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9182
    do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9183
	__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9184
	res = WaitForSingleObject(hFile, t);
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9185
    } while (__threadErrno == EINTR);
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9186
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9187
    switch (res) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9188
	case WAIT_OBJECT_0:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9189
	    /* signalled */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9190
	    RETURN ( false ); 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9191
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9192
	case WAIT_TIMEOUT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9193
	    /* signalled */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9194
	    RETURN ( true ); 
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9195
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9196
	default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9197
	case WAIT_ABANDONED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9198
	    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9199
	    goto bad;
6337
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9200
    }
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9201
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9202
bad: ;
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9203
%}.
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9204
    "
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9205
     timeout argument not integer,
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9206
     or any fd-array nonNil and not an array
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9207
     or not supported by OS
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9208
    "
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9209
    ^ self primitiveFailed
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9210
!
d1320ad45f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  9211
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9212
seekTo:newPosition from:whence
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9213
    "whence is one of:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9214
	#begin
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9215
	#current
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9216
	#end
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9217
    "
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9218
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9219
    |errSym errorNumber|
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9220
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9221
%{
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9222
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9223
    DWORD moveHow;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9224
    LONG posLo, posHi = 0;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9225
    __uint64__ pos64, newPos64;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9226
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9227
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9228
	errSym = @symbol(errorNotOpen);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9229
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9230
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9231
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9232
    if (whence == @symbol(begin)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9233
	moveHow = FILE_BEGIN;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9234
    } else if (whence == @symbol(current)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9235
	moveHow = FILE_CURRENT;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9236
    } else if (whence == @symbol(end)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9237
	moveHow = FILE_END;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9238
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9239
	errSym = @symbol(badArgument2);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9240
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9241
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9242
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9243
    if (__signedLong64IntVal(newPosition, &pos64) == 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9244
	errSym = @symbol(badArgument);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9245
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9246
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9247
    posLo = pos64.lo;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9248
    posHi = pos64.hi;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9249
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9250
    posLo = SetFilePointer(hFile, posLo, &posHi, moveHow);
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9251
    if (posLo == 0xFFFFFFFF) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9252
	int lastError;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9253
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9254
	/* can be either an error, or a valid low-word */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9255
	lastError = GetLastError();
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9256
	if (lastError != NO_ERROR) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9257
	    errorNumber = __mkSmallInteger( __WIN32_ERR(lastError) );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9258
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9259
	}
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9260
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9261
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9262
    if (posHi == 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9263
	RETURN (__MKUINT( posLo ));
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9264
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9265
    newPos64.lo = posLo;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9266
    newPos64.hi = posHi;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9267
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9268
    RETURN ( __MKUINT64(&newPos64) );
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9269
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9270
bad: ;   
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9271
%}.
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9272
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9273
    errorNumber isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9274
	self error:'invalid argument(s): ', errSym.
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9275
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9276
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9277
    ].
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9278
!
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9279
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9280
writeBytes:count from:aByteBuffer startingAt:firstIndex
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9281
    "write count bytes from a byte-buffer;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9282
     Return the number of bytes written (negative on error)"
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9283
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9284
    |errSym errorNumber|
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9285
%{
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9286
    unsigned char *extPtr;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9287
    int bufferIsExternalBytes;
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9288
    int mustFreeBuffer = 0;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9289
    int nWritten = -1;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9290
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9291
    DWORD cntWanted, offs, cntWritten;
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9292
    int bufferSize;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9293
    char miniBuffer[32];
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9294
    BOOL ok;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9295
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9296
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9297
	errSym = @symbol(errorNotOpen);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9298
	goto bad;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9299
    }
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9300
    if (! __bothSmallInteger(count, firstIndex)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9301
	errSym = @symbol(badArgument);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9302
	goto bad;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9303
    }
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9304
    cntWanted = __smallIntegerVal(count);
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9305
    if (cntWanted <= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9306
	errSym = @symbol(badCount);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9307
	goto bad;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9308
    }
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9309
    offs = __smallIntegerVal(firstIndex) - 1;
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9310
    if (offs < 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9311
	errSym = @symbol(badOffset);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9312
	goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9313
    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9314
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9315
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9316
    if (! bufferIsExternalBytes) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9317
	if (__isByteArray(aByteBuffer)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9318
	    bufferSize = __byteArraySize(aByteBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9319
	} else if (__isString(aByteBuffer)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9320
	    bufferSize = __stringSize(aByteBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9321
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9322
	    errSym = @symbol(badBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9323
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9324
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9325
	if (bufferSize < (cntWanted + offs)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9326
	    errSym = @symbol(badBufferSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9327
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9328
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9329
	if (cntWanted <= sizeof(miniBuffer)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9330
	    extPtr = miniBuffer;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9331
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9332
	    extPtr = malloc(cntWanted);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9333
	    mustFreeBuffer = 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9334
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9335
	memcpy(extPtr, __byteArrayVal(aByteBuffer)+offs, cntWanted);
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9336
    } else {        
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9337
	extPtr = (char *)(__externalBytesAddress(aByteBuffer));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9338
	bufferSize = __externalBytesSize(aByteBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9339
	if (! __isSmallInteger(bufferSize)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9340
	    errSym = @symbol(badBufferSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9341
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9342
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9343
	bufferSize = __smallIntegerVal(bufferSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9344
	if (bufferSize < (cntWanted + offs)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9345
	    errSym = @symbol(badBufferSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9346
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9347
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9348
	extPtr = extPtr + offs;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9349
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9350
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9351
    do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9352
	__threadErrno = 0;
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  9353
	ok = STX_API_CALL5( "WriteFile", WriteFile, hFile, extPtr, cntWanted, &cntWritten, 0 /* lpOverlapped */);
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9354
    } while(__threadErrno == EINTR);
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9355
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9356
    if (ok == TRUE) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9357
	if (mustFreeBuffer) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9358
	    free(extPtr);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9359
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9360
	RETURN (__mkSmallInteger(cntWritten));
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9361
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9362
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9363
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9364
bad: ;   
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9365
    if (mustFreeBuffer) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9366
	free(extPtr);
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9367
    }
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9368
%}.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9369
    errorNumber isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9370
	self error:'invalid argument(s): ', errSym.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9371
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9372
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9373
    ].
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9374
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9375
    "
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9376
     |h buff n|
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9377
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9378
     h := self basicNew.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9379
     h setFileDescriptor:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9380
     buff := '12345678901234567890'.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9381
     n := h writeBytes:10 from:buff startingAt:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9382
    "
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9383
! !
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9384
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  9385
!Win32OperatingSystem::Win32Handle methodsFor:'queries'!
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  9386
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  9387
isValid
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  9388
     ^ self address ~~0
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  9389
! !
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  9390
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9391
!Win32OperatingSystem::Win32Handle methodsFor:'release'!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9392
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9393
closeFile
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9394
    "close the handle"
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9395
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9396
%{
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9397
    HANDLE h = (HANDLE)(__externalAddressVal(self));
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9398
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9399
    if (h) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9400
	__externalAddressVal(self) = (HANDLE)0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9401
	CloseHandle(h);
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9402
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9403
%}.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9404
! !
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9405
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9406
!Win32OperatingSystem class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9407
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9408
version
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  9409
    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.148 2004-03-05 17:05:43 ca Exp $'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9410
! !
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  9411
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9412
Win32OperatingSystem initialize!
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  9413
Win32OperatingSystem::RegistryEntry initialize!