Win32OperatingSystem.st
author Claus Gittinger <cg@exept.de>
Wed, 22 Feb 2006 15:04:59 +0100
changeset 9188 e1d727ed4ec3
parent 9186 662a7b37a7c6
child 9198 c46334001b72
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
9174
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
    47
OSHandle subclass:#Win32Handle
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
    48
	instanceVariableNames:''
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
    49
	classVariableNames:''
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
    50
	poolDictionaries:''
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
    51
	privateIn:Win32OperatingSystem
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
    52
!
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
    53
9100
0ebdc95e88ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9094
diff changeset
    54
OSHandle subclass:#Win32IOHandle
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
    55
	instanceVariableNames:''
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
    56
	classVariableNames:'Lobby'
7158
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
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
    61
Win32OperatingSystem::Win32Handle subclass:#Win32ProcessHandle
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
    62
	instanceVariableNames:'pid'
7645
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
9100
0ebdc95e88ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9094
diff changeset
    68
Win32OperatingSystem::Win32IOHandle subclass:#Win32SerialPortHandle
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
    69
	instanceVariableNames:''
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
    70
	classVariableNames:''
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
    71
	poolDictionaries:''
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
    72
	privateIn:Win32OperatingSystem
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
    73
!
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
    74
9100
0ebdc95e88ff *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9094
diff changeset
    75
Win32OperatingSystem::Win32IOHandle subclass:#Win32SocketHandle
9092
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
    76
	instanceVariableNames:''
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
    77
	classVariableNames:''
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
    78
	poolDictionaries:''
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
    79
	privateIn:Win32OperatingSystem
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
    80
!
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
    81
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    82
!Win32OperatingSystem primitiveDefinitions!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    83
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
    84
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
    85
#include "stxOSDefs.h"
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
    86
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
    87
/*
8172
14f6383d7da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8078
diff changeset
    88
 * ensure that ST/X runs on NT, 95 and 98
14f6383d7da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8078
diff changeset
    89
 * (however, this disables some Win2K and XP features (sigh)
14f6383d7da0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8078
diff changeset
    90
 */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
    91
#ifndef WINVER
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
    92
# define WINVER 0x0400
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
    93
#endif
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
    94
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
    95
#if WINVER < 0x0400
8173
a9bf47d88fa6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8172
diff changeset
    96
# define NO_GETADAPTERSINFO
a9bf47d88fa6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8172
diff changeset
    97
#endif
a9bf47d88fa6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8172
diff changeset
    98
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
    99
#define USE_H_ERRNO
6095
fd28101edf09 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5922
diff changeset
   100
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
   101
# if defined(i386) || defined(__i386__)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   102
#  ifndef _X86_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   103
#   define _X86_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   104
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   105
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   106
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   107
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   108
 * notice: although many systems' include files
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   109
 * already block against multiple inclusion, some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   110
 * do not. Therefore, this is done here again.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   111
 * (it does not hurt)
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   112
 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   113
# ifndef _SIGNAL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   114
#  include <signal.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   115
#  define _SIGNAL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   116
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   117
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   118
# ifndef _SYS_TYPES_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   119
#  include <sys/types.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   120
#  define _SYS_TYPES_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   121
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   122
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   123
# ifndef _TIME_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   124
#  include <time.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   125
#  define _TIME_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   126
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   127
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   128
# ifndef _SYS_TIMEB_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   129
#  include <sys/timeb.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   130
#  define _SYS_TIMEB_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   131
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   132
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   133
# ifndef _SYS_STAT_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   134
#  include <sys/stat.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   135
#  define _SYS_STAT_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   136
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   137
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   138
# ifndef _ERRNO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   139
#  include <errno.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   140
#  define _ERRNO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   141
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   142
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   143
# ifndef _STDIO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   144
#  include <stdio.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   145
#  define _STDIO_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   146
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   147
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   148
# ifndef _FCNTL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   149
#  include <fcntl.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   150
#  define _FCNTL_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   151
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   152
8651
a346a806f4cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8650
diff changeset
   153
/* # define PROCESSDEBUGWIN32     /* */
a346a806f4cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8650
diff changeset
   154
/* # define PROCESS1DEBUGWIN32    /* */
a346a806f4cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8650
diff changeset
   155
/* # define PROCESS2DEBUGWIN32    /* */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
   156
/* # define PROCESSDEBUG_CHILDPROCESSWAIT    /* */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   157
/* # define SELECTDEBUGWIN32     /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   158
/* # define SELECT1DEBUGWIN32    /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   159
/* # define SELECT2DEBUGWIN32    /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   160
/* # define WAITDEBUGWIN32       /* */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   161
/* # define SIGNALDEBUGWIN32     /* */
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   162
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   163
# undef INT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   164
# undef Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   165
# undef Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   166
# undef Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   167
# undef Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   168
# undef Rectangle
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   169
# undef Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   170
# undef String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   171
# undef Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   172
# undef Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   173
# undef Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   174
# undef Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   175
# undef Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   176
# undef Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   177
# undef Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   178
# undef Delay
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   179
# undef Message
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   180
# undef Process
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   181
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   182
# include <stdarg.h> /* */
9092
286c8b9e8780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9089
diff changeset
   183
7531
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   184
# ifndef WINDOWS_H_INCLUDED
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   185
#  define WINDOWS_H_INCLUDED
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   186
#  include <windows.h>
4682ca752d27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7287
diff changeset
   187
# endif
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   188
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
   189
# ifndef NO_GETADAPTERSINFO
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   190
#  include <iphlpapi.h>
6543
916373aeb49f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6542
diff changeset
   191
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   192
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   193
# if !defined(__BORLANDC__)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   194
#  undef stat
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   195
#  define stat _stat
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   196
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   197
#  undef chmod
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   198
#  define chmod _chmod
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   199
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   200
#  undef access
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   201
#  define access _access
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   202
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   203
#  define MAXFILELEN 256
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   204
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   205
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   206
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   207
# ifdef __DEF_Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   208
#  define Array __DEF_Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   209
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   210
# ifdef __DEF_Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   211
#  define Number __DEF_Number
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   212
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   213
# ifdef __DEF_Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   214
#  define Method __DEF_Method
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   215
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   216
# ifdef __DEF_Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   217
#  define Point __DEF_Point
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   218
# endif
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   219
# ifdef __DEF_Rectangle
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   220
#  define Rectangle __DEF_Rectangle
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
   221
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   222
# ifdef __DEF_Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   223
#  define Block __DEF_Block
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   224
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   225
# ifdef __DEF_String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   226
#  define String __DEF_String
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   227
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   228
# ifdef __DEF_Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   229
#  define Message __DEF_Message
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   230
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   231
# ifdef __DEF_Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   232
#  define Object __DEF_Object
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   233
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   234
# ifdef __DEF_Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   235
#  define Context __DEF_Context
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   236
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   237
# ifdef __DEF_Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   238
#  define Date __DEF_Date
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   239
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   240
# ifdef __DEF_Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   241
#  define Time __DEF_Time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   242
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   243
# ifdef __DEF_Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   244
#  define Set __DEF_Set
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   245
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   246
# ifdef __DEF_Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   247
#  define Signal __DEF_Signal
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   248
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   249
# ifdef __DEF_Delay
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   250
#  define Delay __DEF_Delay
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   251
# endif
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   252
# ifdef __DEF_Message
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   253
#  define Message __DEF_Message
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   254
# endif
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   255
# ifdef __DEF_Process
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   256
#  define Process __DEF_Process
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
   257
# endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   258
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   259
# define INT int
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   260
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   261
typedef int (*intf)(int);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   262
BOOL __signalUserInterruptWIN32(DWORD sig);
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
# if defined (HAS_LOCALECONV)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   265
#  ifndef _LOCALE_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   266
#   include <locale.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   267
#   define _LOCALE_H_INCLUDED_
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   268
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   269
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   270
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   271
# ifdef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   272
#  include <dir.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   273
#  define MAXPATHLEN MAXPATH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   274
#  define MAXFILELEN MAXFILE
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   275
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   276
OBJ _SEND0(OBJ, OBJ, OBJ, inlineCachePtr);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   277
OBJ _SEND1(OBJ, OBJ, OBJ, inlineCachePtr, OBJ);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   278
OBJ _SEND2(OBJ, OBJ, OBJ, inlineCachePtr, OBJ, OBJ);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   279
OBJ _SEND3(OBJ, OBJ, OBJ, inlineCachePtr, OBJ, OBJ, OBJ);
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   280
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   281
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   282
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   283
# ifndef MAXPATHLEN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   284
#  ifndef MSDOS_LIKE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   285
#   ifndef NO_SYS_PARAM_H
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   286
#    include <sys/param.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   287
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   288
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   289
#  ifndef MAXPATHLEN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   290
#   ifdef FILENAME_MAX  /* i.e. MSDOS_LIKE */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   291
#    define MAXPATHLEN FILENAME_MAX
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   292
#   else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   293
#    ifdef MAX_PATH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   294
#     define MAXPATHLEN MAX_PATH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   295
#    else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   296
#     define MAXPATHLEN 1024
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   297
#    endif
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
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   300
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   301
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   302
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   303
 * sigaction dummies (you won't believe these call themself ``POSIX'' systems ...)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   304
 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   305
# ifndef SA_RESTART
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   306
#  define SA_RESTART    0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   307
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   308
# ifndef SA_SIGINFO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   309
#  define SA_SIGINFO    0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   310
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   311
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   312
# if defined(HAS_WAITPID) || defined(HAS_WAIT3)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   313
#  include <sys/wait.h>
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   316
# if defined(HAS_SYSINFO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   317
#  include <sys/systeminfo.h>
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   318
# endif
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
#define SIGHANDLER_ARG int
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
#define _HANDLEVal(o)        (HANDLE)(__externalAddressVal(o))
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   323
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   324
/*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   325
 * not all systems have time_t and off_t
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   326
 * explicit add of those we know to have ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   327
 */
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
#ifndef TIME_T
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   330
# define TIME_T long
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
#ifndef OFF_T
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   333
# define OFF_T  long
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   334
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   335
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
 * where is the timezone info ?
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
#if defined(HAS_NO_TIMEZONE)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   340
# if defined(HAS_NO_TM_GMTOFF)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   341
#  define TIMEZONE(tmPtr)       0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   342
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   343
#  define TIMEZONE(tmPtr)       ((tmPtr)->tm_gmtoff)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   344
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   345
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   346
# ifdef MSDOS_LIKE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   347
#   define TIMEZONE(tmPtr)      0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   348
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   349
#  define TIMEZONE(tmPtr)       timezone
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   350
# endif
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
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   353
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   354
%}
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   357
!Win32OperatingSystem primitiveFunctions!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   358
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   359
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   360
/* isWindows-NT flag:
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   361
 *  1 for NT based systemes, such as NT,XP or 2k
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   362
 *  0 for w95 based systems, such as w95/w98/ME
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   363
 */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   364
static int __isWinNT = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   365
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   366
#define __wait wait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   367
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   368
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   369
static int
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   370
_canAccessIOWithoutBlocking (aFD, readMode)
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   371
int aFD;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   372
int readMode;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   373
{
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   374
    struct timeval tv;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   375
    fd_set         fds;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   376
    int            n;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   377
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   378
/* 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
   379
   but otherwise it not works
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   380
*/
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   381
    int sock = (int) _get_osfhandle (aFD);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   382
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   383
    FD_ZERO( & fds );
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   384
    FD_SET ( sock, & fds );
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   385
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   386
    tv.tv_sec  = 0;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   387
    tv.tv_usec = 0;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   388
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   389
    if (readMode) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   390
	n = select (sock + 1, & fds, NULL, NULL, & tv);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   391
    } else {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   392
	n = select (sock + 1, NULL, & fds, NULL, & tv);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   393
    }
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
    if (n == 0) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   396
	return (0);
7825
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
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   399
    if (n > 0) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   400
	return ((FD_ISSET (sock, & fds)) ? 1 : 0);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   401
    }
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
    switch (WSAGetLastError()) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   404
	case WSAENOTSOCK:
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   405
	    if (readMode) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   406
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   407
		DWORD  w = 0;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   408
		HANDLE h = (HANDLE) _get_osfhandle (aFD);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   409
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   410
		if (PeekNamedPipe (h, 0, 0, 0, & w, 0)) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   411
		    if( !__isWinNT || w > 0 )
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   412
			return (1);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   413
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   414
		    return (0);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   415
		}
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   416
		return (-1);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   417
	    }
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   418
	    /* in writeMode we return allways true for none-sockets */
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   419
	    return (1);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   420
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   421
	case WSAEINPROGRESS:
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   422
	case WSAEWOULDBLOCK: return (0);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   423
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   424
	default: return (1);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   425
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   426
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   427
    return (0);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   428
}
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   429
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   430
#define _canReadWithoutBlocking(fd)     _canAccessIOWithoutBlocking(fd, 1)
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
   431
#define _canWriteWithoutBlocking(fd)    _canAccessIOWithoutBlocking(fd, 0)
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   432
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   433
static FARPROC
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   434
__get_KERNEL32_functionAddress(functionName)
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   435
    char *functionName;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   436
{
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   437
    /*
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   438
     * Attention: some API calls are not available on old NT4.0/W95/W98
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   439
     */
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   440
    FARPROC entry;
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   441
    static HINSTANCE handle = NULL;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   442
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   443
    if (handle == NULL) {
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   444
	handle = LoadLibrary("KERNEL32.DLL");
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   445
    }
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   446
    entry = GetProcAddress(handle, functionName);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   447
    return entry;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   448
}
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   449
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   450
static FARPROC
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   451
__get_iphlpapi_functionAddress(functionName)
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   452
    char *functionName;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   453
{
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   454
    /*
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   455
     * Attention: some API calls are not available on old NT4.0/W95/W98
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   456
     */
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
   457
    FARPROC entry;
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   458
    static HINSTANCE handle2 = NULL;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   459
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   460
    if (handle2 == NULL) {
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   461
	handle2 = LoadLibrary("iphlpapi.DLL");
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   462
    }
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   463
    entry = GetProcAddress(handle2, functionName);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   464
    return entry;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
   465
}
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
   466
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   467
%}
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
!Win32OperatingSystem class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   471
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   472
copyright
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   473
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   474
 COPYRIGHT (c) 1988 by Claus Gittinger
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   475
 COPYRIGHT (c) 1998-2004 by eXept Software AG
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   476
	      All Rights Reserved
5133
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 software is furnished under a license and may be used
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   479
 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
   480
 inclusion of the above copyright notice.   This software may not
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   481
 be provided or otherwise made available to, or used by, any
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   482
 other person.  No title to or ownership of the software is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   483
 hereby transferred.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   484
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   485
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   486
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   487
documentation
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   488
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   489
    this class resulted from extracting WIN32 specifics of the old
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   490
    OperatingSystemClass into this sub-class.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   491
    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
   492
    or later.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   493
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   494
    this class realizes access to most (all ?) required operating system services;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   495
    some of it is very specific for unix, so do not depend on
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   496
    things available here in your applications
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   497
    - 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
   498
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   499
    (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
   500
     from you - in some situations it MAY be interesting to be
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   501
     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
   502
     You decide - portability vs. functionality)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   503
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   504
    [Class variables:]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   505
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   506
	HostName        <String>        remembered hostname
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   507
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   508
	DomainName      <String>        remembered domainname
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   509
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   510
	CurrentDirectory <String>       remembered currentDirectories path
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   511
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   512
    [author:]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   513
	Claus Gittinger (initial version & cleanup)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   514
	Manfred Dierolf (many features)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   515
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   516
    [see also:]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   517
	OSProcessStatus
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   518
	Filename Date Time
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   519
	ExternalStream FileStream PipeStream Socket
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   520
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   521
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   522
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   523
examples
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   524
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   525
  various queries
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   526
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   527
    Transcript
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   528
	showCR:'hello ' , (OperatingSystem getLoginName)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   529
								[exEnd]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   530
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   531
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   532
    OperatingSystem isUNIXlike ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   533
	Transcript showCR:'this is some UNIX-like OS'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   534
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   535
	Transcript showCR:'this OS is not UNIX-like'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   536
    ]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   537
								[exEnd]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   538
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   539
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   540
    Transcript
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   541
	showCR:'this machine is called ' , OperatingSystem getHostName
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   542
								[exEnd]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   543
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   544
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   545
    Transcript
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   546
	showCR:('this machine is in the '
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   547
	       , OperatingSystem getDomainName
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   548
	       , ' domain')
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   549
								[exEnd]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   550
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   551
								[exBegin]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   552
    Transcript
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   553
	showCR:('this machine''s CPU is a '
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   554
	       , OperatingSystem getCPUType
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   555
	       )
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   556
								[exEnd]
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
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   559
    Transcript showCR:'executing ls command ...'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   560
    OperatingSystem executeCommand:'ls'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   561
    Transcript showCR:'... done.'.
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   562
								[exEnd]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   563
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   564
  locking a file
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   565
  (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
   566
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   567
    |f|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   568
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   569
    f := 'testFile' asFilename readWriteStream.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   570
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   571
    10 timesRepeat:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   572
	'about to lock ...' printCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   573
	[
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   574
	  OperatingSystem
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   575
	    lockFD:(f fileDescriptor)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   576
	    shared:false
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   577
	    blocking:false
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   578
	] whileFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   579
	    'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   580
	    Delay waitForSeconds:1
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   581
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   582
	'LOCKED ...' printCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   583
	Delay waitForSeconds:10.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   584
	'unlock ...' printCR.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
   585
	(OperatingSystem
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   586
	    unlockFD:(f fileDescriptor)) printCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   587
	Delay waitForSeconds:3.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   588
    ]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   589
								[exBegin]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   590
"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   591
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   592
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   593
!Win32OperatingSystem class methodsFor:'initialization'!
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
initOSType
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   596
    "internal - see if running under win-NT/XP/2k
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
   597
     (as opposed to win-95/98/ME)"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   598
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   599
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   600
    OSVERSIONINFO osvi;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   601
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   602
    memset(&osvi, 0, sizeof(OSVERSIONINFO));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   603
    osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   604
    GetVersionEx (&osvi);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   605
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   606
    if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   607
	__isWinNT = 1;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   608
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   609
	__isWinNT = 0;
5133
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
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   612
!
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
initialize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   615
    "initialize the class"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   616
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   617
    ObjectMemory addDependent:self.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   618
    HostName := nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   619
    DomainName := nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   620
    LastErrorNumber := nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   621
    PipeFailed := false.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   622
    self initOSType
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
    "Modified: 13.9.1997 / 10:47:32 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   625
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   626
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   627
update:something with:aParameter from:changedObject
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   628
    "catch image restart and flush some cached data"
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
    something == #earlyRestart ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   631
	"
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   632
	 flush cached data
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   633
	"
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   634
	HostName := nil.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   635
	DomainName := nil.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   636
	LastErrorNumber := nil.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   637
	PipeFailed := false.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
   638
	self initOSType
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   639
    ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   640
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   641
    "Modified: 22.4.1996 / 13:10:43 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   642
    "Created: 15.6.1996 / 15:22:37 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   643
    "Modified: 7.1.1997 / 19:36:11 / stefan"
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   646
!Win32OperatingSystem class methodsFor:'OS signal constants'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   647
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   648
sigABRT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   649
    "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
   650
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   651
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   652
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   653
#ifdef SIGABRT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   654
    RETURN ( __mkSmallInteger(SIGABRT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   655
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   656
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   657
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   658
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   659
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   660
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   661
sigALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   662
    "return the signal number for SIGALRM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   663
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   664
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   665
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   666
#ifdef SIGALRM
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   667
    RETURN ( __mkSmallInteger(SIGALRM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   668
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   669
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   670
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   671
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   672
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   673
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   674
sigBREAK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   675
    "return the signal number for SIGBREAK - 0 if not supported.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   676
     This is an MSDOS specific signal"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   677
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   678
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   679
#ifdef SIGBREAK
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   680
    RETURN ( __mkSmallInteger(SIGBREAK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   681
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   682
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   683
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   684
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   685
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   686
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   687
sigBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   688
    "return the signal number for SIGBUS - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   689
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   690
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   691
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   692
#ifdef SIGBUS
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   693
    RETURN ( __mkSmallInteger(SIGBUS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   694
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   695
    RETURN ( __mkSmallInteger(0) );
5133
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
%}
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
sigCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   701
    "return the signal number for SIGCHLD - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   702
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   703
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   704
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   705
#if defined(SIGCHLD)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   706
    RETURN ( __mkSmallInteger(SIGCHLD) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   707
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   708
# if  defined(SIGCLD)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   709
    RETURN ( __mkSmallInteger(SIGCLD) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   710
# else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   711
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   712
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   713
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   714
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   715
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   716
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   717
sigCONT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   718
    "return the signal number for SIGCONT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   719
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   720
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   721
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   722
#if defined(SIGCONT)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   723
    RETURN ( __mkSmallInteger(SIGCONT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   724
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   725
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   726
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   727
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   728
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   729
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   730
sigDANGER
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   731
    "return the signal number for SIGDANGER - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   732
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   733
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   734
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   735
#if defined(SIGDANGER)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   736
    RETURN ( __mkSmallInteger(SIGDANGER) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   737
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   738
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   739
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   740
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   741
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   742
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   743
sigEMT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   744
    "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
   745
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   746
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   747
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   748
#ifdef SIGEMT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   749
    RETURN ( __mkSmallInteger(SIGEMT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   750
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   751
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   752
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   753
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   754
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   755
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   756
sigFP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   757
    "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
   758
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   759
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   760
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   761
#ifdef SIGFPE
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   762
    RETURN ( __mkSmallInteger(SIGFPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   763
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   764
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   765
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   766
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   767
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   768
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   769
sigGRANT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   770
    "return the signal number for SIGGRANT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   771
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   772
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   773
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   774
#if defined(SIGGRANT)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   775
    RETURN ( __mkSmallInteger(SIGGRANT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   776
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   777
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   778
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   779
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   780
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   781
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   782
sigHUP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   783
    "return the signal number for SIGHUP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   784
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   785
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   786
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   787
#ifdef SIGHUP
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   788
    RETURN ( __mkSmallInteger(SIGHUP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   789
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   790
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   791
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   792
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   793
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   794
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   795
sigILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   796
    "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
   797
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   798
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   799
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   800
#ifdef SIGILL
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   801
    RETURN ( __mkSmallInteger(SIGILL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   802
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   803
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   804
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   805
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   806
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   807
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   808
sigINT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   809
    "return the signal number for SIGINT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   810
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   811
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   812
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   813
#ifdef SIGINT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   814
    RETURN ( __mkSmallInteger(SIGINT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   815
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   816
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   817
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   818
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   819
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   820
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   821
sigIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   822
    "return the signal number for SIGIO - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   823
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   824
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   825
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   826
#if defined(SIGIO)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   827
    RETURN ( __mkSmallInteger(SIGIO) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   828
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   829
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   830
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   831
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   832
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   833
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   834
sigIOT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   835
    "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
   836
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   837
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   838
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   839
#ifdef SIGIOT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   840
    RETURN ( __mkSmallInteger(SIGIOT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   841
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   842
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   843
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   844
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   845
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   846
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   847
sigKILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   848
    "return the signal number for SIGKILL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   849
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   850
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   851
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   852
#ifdef SIGKILL
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   853
    RETURN ( __mkSmallInteger(SIGKILL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   854
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   855
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   856
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   857
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   858
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   859
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   860
sigLOST
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   861
    "return the signal number for SIGLOST - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   862
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   863
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   864
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   865
#if defined(SIGLOST)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   866
    RETURN ( __mkSmallInteger(SIGLOST) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   867
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   868
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   869
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   870
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   871
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   872
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   873
sigMIGRATE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   874
    "return the signal number for SIGMIGRATE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   875
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   876
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   877
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   878
#if defined(SIGMIGRATE)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   879
    RETURN ( __mkSmallInteger(SIGMIGRATE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   880
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   881
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   882
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   883
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   884
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   885
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   886
sigMSG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   887
    "return the signal number for SIGMSG - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   888
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   889
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   890
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   891
#if defined(SIGMSG)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   892
    RETURN ( __mkSmallInteger(SIGMSG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   893
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   894
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   895
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   896
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   897
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   898
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   899
sigPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   900
    "return the signal number for SIGPIPE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   901
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   902
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   903
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   904
#ifdef SIGPIPE
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   905
    RETURN ( __mkSmallInteger(SIGPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   906
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   907
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   908
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   909
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   910
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   911
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   912
sigPOLL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   913
    "return the signal number for SIGPOLL - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   914
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   915
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   916
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   917
#if defined(SIGPOLL)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   918
    RETURN ( __mkSmallInteger(SIGPOLL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   919
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   920
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   921
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   922
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   923
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   924
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   925
sigPRE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   926
    "return the signal number for SIGPRE - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   927
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   928
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   929
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   930
#if defined(SIGPRE)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   931
    RETURN ( __mkSmallInteger(SIGPRE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   932
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   933
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   934
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   935
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   936
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   937
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   938
sigPROF
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   939
    "return the signal number for SIGPROF - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   940
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   941
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   942
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   943
#if defined(SIGPROF)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   944
    RETURN ( __mkSmallInteger(SIGPROF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   945
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   946
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   947
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   948
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   949
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   950
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   951
sigPWR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   952
    "return the signal number for SIGPWR - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   953
     (not available on all systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   954
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   955
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   956
#if defined(SIGPWR)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   957
    RETURN ( __mkSmallInteger(SIGPWR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   958
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   959
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   960
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   961
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   962
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   963
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   964
sigQUIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   965
    "return the signal number for SIGQUIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   966
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   967
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   968
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   969
#ifdef SIGQUIT
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   970
    RETURN ( __mkSmallInteger(SIGQUIT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   971
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   972
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   973
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   974
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   975
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   976
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   977
sigRETRACT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   978
    "return the signal number for SIGRETRACT - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   979
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   980
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   981
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   982
#if defined(SIGRETRACT)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   983
    RETURN ( __mkSmallInteger(SIGRETRACT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   984
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   985
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   986
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   987
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   988
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   989
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   990
sigSAK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   991
    "return the signal number for SIGSAK - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   992
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   993
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   994
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   995
#if defined(SIGSAK)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   996
    RETURN ( __mkSmallInteger(SIGSAK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   997
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
   998
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
   999
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1000
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1001
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1003
sigSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1004
    "return the signal number for SIGSEGV - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1005
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1006
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1007
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1008
#ifdef SIGSEGV
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1009
    RETURN ( __mkSmallInteger(SIGSEGV) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1010
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1011
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1012
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1013
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1014
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1015
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1016
sigSOUND
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1017
    "return the signal number for SIGSOUND - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1018
     (seems to be an AIX special)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1019
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1020
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1021
#if defined(SIGSOUND)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1022
    RETURN ( __mkSmallInteger(SIGSOUND) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1023
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1024
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1025
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1026
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1027
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1028
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1029
sigSTOP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1030
    "return the signal number for SIGSTOP - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1031
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1032
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1033
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1034
#if defined(SIGSTOP)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1035
    RETURN ( __mkSmallInteger(SIGSTOP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1036
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1037
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1038
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1039
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1040
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1041
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1042
sigSYS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1043
    "return the signal number for SIGSYS - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1044
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1045
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1046
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1047
#ifdef SIGSYS
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1048
    RETURN ( __mkSmallInteger(SIGSYS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1049
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1050
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1051
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1052
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1053
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1054
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1055
sigTERM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1056
    "return the signal number for SIGTERM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1057
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1058
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1059
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1060
#ifdef SIGTERM
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1061
    RETURN ( __mkSmallInteger(SIGTERM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1062
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1063
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1064
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1065
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1066
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1067
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1068
sigTRAP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1069
    "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
  1070
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1071
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1072
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1073
#ifdef SIGTRAP
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1074
    RETURN ( __mkSmallInteger(SIGTRAP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1075
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1076
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1077
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1078
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1079
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1080
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1081
sigTSTP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1082
    "return the signal number for SIGTSTP - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1083
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1084
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1085
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1086
#if defined(SIGTSTP)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1087
    RETURN ( __mkSmallInteger(SIGTSTP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1088
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1089
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1090
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1091
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1092
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1093
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1094
sigTTIN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1095
    "return the signal number for SIGTTIN - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1096
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1097
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1098
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1099
#if defined(SIGTTIN)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1100
    RETURN ( __mkSmallInteger(SIGTTIN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1101
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1102
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1103
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1104
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1105
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1106
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1107
sigTTOU
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1108
    "return the signal number for SIGTTOU - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1109
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1110
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1111
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1112
#if defined(SIGTTOU)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1113
    RETURN ( __mkSmallInteger(SIGTTOU) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1114
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1115
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1116
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1117
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1118
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1119
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1120
sigURG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1121
    "return the signal number for SIGURG - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1122
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1123
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1124
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1125
#if defined(SIGURG)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1126
    RETURN ( __mkSmallInteger(SIGURG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1127
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1128
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1129
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1130
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1131
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1132
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1133
sigUSR1
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1134
    "return the signal number for SIGUSR1 - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1135
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1136
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1137
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1138
#if defined(SIGUSR1)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1139
    RETURN ( __mkSmallInteger(SIGUSR1) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1140
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1141
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1142
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1143
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1144
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1145
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1146
sigUSR2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1147
    "return the signal number for SIGUSR2 - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1148
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1149
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1150
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1151
#if defined(SIGUSR2)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1152
    RETURN ( __mkSmallInteger(SIGUSR2) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1153
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1154
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1155
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1156
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1157
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1158
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1159
sigVTALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1160
    "return the signal number for SIGVTALRM - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1161
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1162
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1163
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1164
#if defined(SIGVTALRM)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1165
    RETURN ( __mkSmallInteger(SIGVTALRM) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1166
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1167
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1168
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1169
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1170
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1171
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1172
sigWINCH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1173
    "return the signal number for SIGWINCH - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1174
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1175
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1176
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1177
#if defined(SIGWINCH)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1178
    RETURN ( __mkSmallInteger(SIGWINCH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1179
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1180
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1181
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1182
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1183
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1184
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1185
sigXCPU
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1186
    "return the signal number for SIGXCPU - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1187
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1188
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1189
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1190
#if defined(SIGXCPU)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1191
    RETURN ( __mkSmallInteger(SIGXCPU) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1192
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1193
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1194
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1195
%}
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1198
sigXFSZ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1199
    "return the signal number for SIGXFSZ - 0 if not supported
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1200
     (the numeric value is not the same across unix-systems)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1201
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1202
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1203
#if defined(SIGXFSZ)
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1204
    RETURN ( __mkSmallInteger(SIGXFSZ) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1205
#else
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1206
    RETURN ( __mkSmallInteger(0) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1207
#endif
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1211
!Win32OperatingSystem class methodsFor:'error messages'!
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
currentErrorNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1214
    "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
  1215
     Notice, that the value of this flag is only valid immediately
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1216
     after the error occurred - it gets updated with every other
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1217
     request to the OS.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1218
     Use lastErrorNumber - currentErrorNumber is invalidated by
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1219
     many, many internal calls."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1220
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1221
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1222
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  1223
     RETURN ( __mkSmallInteger(__threadErrno) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1224
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1225
     "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1226
      OperatingSystem currentErrorNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1227
     "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1228
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  1229
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1230
errorHolderForNumber:errNr
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  1231
    "return an osErrorHolder for the given error number (as returned by a system call)."
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1232
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1233
    |sym typ holder|
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1234
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1235
%{
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1236
    /* claus:
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1237
     * I made this primitive code, since errnos are not
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1238
     * standard across unixes
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1239
     */
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1240
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1241
    typ = @symbol(defaultOsErrorSignal);
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1242
    sym = @symbol(ERROR_OTHER);
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  1243
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  1244
    if (__isSmallInteger(errNr) || (__unsignedLongIntVal(errNr) > 0)) {
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  1245
      int __eno = __unsignedLongIntVal(errNr);
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1246
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1247
      if (__isWIN32Error(__eno)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1248
        switch (__eno & 0xFFFF) {
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1249
            /*
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1250
             * WIN32 GetLastError returns
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1251
             */
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1252
            case ERROR_INVALID_FUNCTION:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1253
                sym = @symbol(ERROR_INVALID_FUNCTION);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1254
                typ = @symbol(illegalOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1255
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1256
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1257
            case ERROR_BAD_FORMAT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1258
                sym = @symbol(ERROR_BAD_FORMAT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1259
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1260
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1261
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1262
            case ERROR_FILE_NOT_FOUND:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1263
                sym = @symbol(ERROR_FILE_NOT_FOUND);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1264
                typ = @symbol(nonexistentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1265
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1266
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1267
            case ERROR_PATH_NOT_FOUND:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1268
                sym = @symbol(ERROR_PATH_NOT_FOUND);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1269
                typ = @symbol(nonexistentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1270
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1271
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1272
            case ERROR_TOO_MANY_OPEN_FILES:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1273
                sym = @symbol(ERROR_TOO_MANY_OPEN_FILES);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1274
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1275
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1276
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1277
            /*
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1278
             * what a nice errorCode - thats the most "useful" one I ever
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1279
             * encountered ... (... those stupid micro-softies ...)
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1280
             */
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1281
            case ERROR_OPEN_FAILED:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1282
                sym = @symbol(ERROR_OPEN_FAILED);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1283
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1284
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1285
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1286
            case ERROR_ACCESS_DENIED:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1287
                sym = @symbol(ERROR_ACCESS_DENIED);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1288
                typ = @symbol(noPermissionsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1289
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1290
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1291
            case ERROR_INVALID_HANDLE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1292
                sym = @symbol(ERROR_INVALID_HANDLE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1293
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1294
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1295
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1296
            case ERROR_NOT_ENOUGH_MEMORY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1297
                sym = @symbol(ERROR_NOT_ENOUGH_MEMORY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1298
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1299
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1300
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1301
            case ERROR_INVALID_ACCESS:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1302
                sym = @symbol(ERROR_INVALID_ACCESS);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1303
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1304
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1305
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1306
            case ERROR_INVALID_DATA:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1307
                sym = @symbol(ERROR_INVALID_DATA);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1308
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1309
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1310
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1311
            case ERROR_INVALID_NAME:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1312
                sym = @symbol(ERROR_INVALID_NAME);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1313
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1314
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1315
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1316
            case ERROR_ARENA_TRASHED:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1317
                sym = @symbol(ERROR_ARENA_TRASHED);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1318
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1319
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1320
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1321
            case ERROR_OUTOFMEMORY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1322
                sym = @symbol(ERROR_OUTOFMEMORY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1323
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1324
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1325
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1326
            case ERROR_BROKEN_PIPE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1327
                sym = @symbol(ERROR_BROKEN_PIPE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1328
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1329
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1330
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1331
            case ERROR_GEN_FAILURE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1332
                sym = @symbol(ERROR_GEN_FAILURE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1333
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1334
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1335
            case ERROR_WRITE_PROTECT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1336
                sym = @symbol(ERROR_WRITE_PROTECT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1337
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1338
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1339
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1340
            case ERROR_WRITE_FAULT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1341
                sym = @symbol(ERROR_WRITE_FAULT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1342
                typ = @symbol(transferFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1343
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1344
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1345
            case ERROR_READ_FAULT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1346
                sym = @symbol(ERROR_READ_FAULT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1347
                typ = @symbol(transferFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1348
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1349
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1350
            case ERROR_HANDLE_DISK_FULL:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1351
                sym = @symbol(ERROR_HANDLE_DISK_FULL);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1352
                typ = @symbol(volumeFullSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1353
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1354
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1355
            case ERROR_DISK_FULL:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1356
                sym = @symbol(ERROR_DISK_FULL);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1357
                typ = @symbol(volumeFullSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1358
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1359
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1360
            case ERROR_SHARING_VIOLATION:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1361
                sym = @symbol(ERROR_SHARING_VIOLATION);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1362
                typ = @symbol(noPermissionsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1363
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1364
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1365
            case ERROR_LOCK_VIOLATION:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1366
                sym = @symbol(ERROR_LOCK_VIOLATION);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1367
                typ = @symbol(noPermissionsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1368
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1369
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1370
            case ERROR_INVALID_PARAMETER:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1371
                sym = @symbol(ERROR_INVALID_PARAMETER);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1372
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1373
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1374
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1375
            case ERROR_NET_WRITE_FAULT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1376
                sym = @symbol(ERROR_NET_WRITE_FAULT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1377
                typ = @symbol(transferFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1378
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1379
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1380
            case ERROR_NOT_SUPPORTED:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1381
                sym = @symbol(ERROR_NOT_SUPPORTED);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1382
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1383
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1384
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1385
            case ERROR_REM_NOT_LIST:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1386
                sym = @symbol(ERROR_REM_NOT_LIST);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1387
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1388
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1389
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1390
            case ERROR_NETWORK_ACCESS_DENIED:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1391
                sym = @symbol(ERROR_NETWORK_ACCESS_DENIED);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1392
                typ = @symbol(noPermissionsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1393
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1394
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1395
            case ERROR_DUP_NAME:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1396
                sym = @symbol(ERROR_DUP_NAME);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1397
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1398
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1399
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1400
            case ERROR_BAD_NETPATH:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1401
                sym = @symbol(ERROR_BAD_NETPATH);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1402
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1403
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1404
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1405
            case ERROR_NETWORK_BUSY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1406
                sym = @symbol(ERROR_NETWORK_BUSY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1407
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1408
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1409
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1410
            case ERROR_DRIVE_LOCKED:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1411
                sym = @symbol(ERROR_DRIVE_LOCKED);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1412
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1413
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1414
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1415
            case ERROR_INVALID_DRIVE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1416
                sym = @symbol(ERROR_INVALID_DRIVE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1417
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1418
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1419
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1420
            case ERROR_WRONG_DISK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1421
                sym = @symbol(ERROR_WRONG_DISK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1422
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1423
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1424
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1425
            case ERROR_CURRENT_DIRECTORY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1426
                sym = @symbol(ERROR_CURRENT_DIRECTORY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1427
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1428
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1429
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1430
            /*
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1431
             * what a nice errorCode - thats the most "useful" one I ever
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1432
             * encountered ... (... those stupid micro-softies ...)
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1433
             */
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1434
            case ERROR_CANNOT_MAKE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1435
                sym = @symbol(ERROR_CANNOT_MAKE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1436
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1437
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1438
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1439
            case ERROR_NO_MORE_FILES:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1440
                sym = @symbol(ERROR_NO_MORE_FILES);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1441
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1442
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1443
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1444
            case ERROR_NOT_READY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1445
                sym = @symbol(ERROR_NOT_READY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1446
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1447
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1448
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1449
            case ERROR_NOT_DOS_DISK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1450
                sym = @symbol(ERROR_NOT_DOS_DISK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1451
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1452
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1453
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1454
            case ERROR_OUT_OF_PAPER:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1455
                sym = @symbol(ERROR_OUT_OF_PAPER);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1456
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1457
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1458
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1459
            case ERROR_PRINTQ_FULL:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1460
                sym = @symbol(ERROR_PRINTQ_FULL);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1461
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1462
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1463
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1464
            default:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1465
                sym = nil;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1466
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1467
        }
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1468
      } else {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1469
        switch (__eno) {
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1470
            /*
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1471
             * POSIX errnos - these should be defined
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1472
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1473
#ifdef EPERM
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1474
            case EPERM:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1475
                sym = @symbol(EPERM);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1476
                typ = @symbol(noPermissionsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1477
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1478
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1479
#ifdef ENOENT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1480
            case ENOENT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1481
                sym = @symbol(ENOENT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1482
                typ = @symbol(nonexistentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1483
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1484
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1485
#ifdef ESRCH
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1486
            case ESRCH:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1487
                sym = @symbol(ESRCH);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1488
                typ = @symbol(unavailableReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1489
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1490
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1491
#ifdef EINTR
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1492
            case EINTR:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1493
                sym = @symbol(EINTR);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1494
                typ = @symbol(transientErrorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1495
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1496
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1497
#ifdef EIO
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1498
            case EIO:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1499
                sym = @symbol(EIO);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1500
                typ = @symbol(transferFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1501
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1502
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1503
#ifdef ENXIO
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1504
            case ENXIO:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1505
                sym = @symbol(ENXIO);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1506
                typ = @symbol(unavailableReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1507
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1508
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1509
#ifdef E2BIG
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1510
            case E2BIG:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1511
                sym = @symbol(E2BIG);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1512
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1513
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1514
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1515
#ifdef ENOEXEC
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1516
            case ENOEXEC:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1517
                sym = @symbol(ENOEXEC);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1518
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1519
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1520
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1521
#ifdef EBADF
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1522
            case EBADF:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1523
                sym = @symbol(EBADF);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1524
                typ = @symbol(badAccessorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1525
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1526
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1527
#ifdef ECHILD
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1528
            case ECHILD:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1529
                sym = @symbol(ECHILD);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1530
                typ = @symbol(informationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1531
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1532
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1533
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1534
            case EAGAIN:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1535
                sym = @symbol(EAGAIN);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1536
                typ = @symbol(notReadySignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1537
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1538
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1539
#ifdef ENOMEM
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1540
            case ENOMEM:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1541
                sym = @symbol(ENOMEM);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1542
                typ = @symbol(noMemorySignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1543
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1544
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1545
#ifdef EACCES
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1546
            case EACCES:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1547
                sym = @symbol(EACCES);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1548
                typ = @symbol(noPermissionsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1549
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1550
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1551
#ifdef EFAULT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1552
            case EFAULT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1553
                sym = @symbol(EFAULT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1554
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1555
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1556
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1557
#ifdef EBUSY
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1558
            case EBUSY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1559
                sym = @symbol(EBUSY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1560
                typ = @symbol(unavailableReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1561
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1562
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1563
#ifdef EEXIST
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1564
            case EEXIST:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1565
                sym = @symbol(EEXIST);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1566
                typ = @symbol(existingReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1567
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1568
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1569
#ifdef EXDEV
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1570
            case EXDEV:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1571
                sym = @symbol(EXDEV);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1572
                typ = @symbol(inappropriateReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1573
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1574
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1575
#ifdef ENODEV
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1576
            case ENODEV:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1577
                sym = @symbol(ENODEV);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1578
                typ = @symbol(inaccessibleSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1579
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1580
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1581
#ifdef ENOTDIR
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1582
            case ENOTDIR:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1583
                sym = @symbol(ENOTDIR);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1584
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1585
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1586
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1587
#ifdef EISDIR
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1588
            case EISDIR:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1589
                sym = @symbol(EISDIR);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1590
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1591
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1592
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1593
#ifdef EINVAL
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1594
            case EINVAL:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1595
                sym = @symbol(EINVAL);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1596
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1597
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1598
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1599
#ifdef ENFILE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1600
            case ENFILE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1601
                sym = @symbol(ENFILE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1602
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1603
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1604
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1605
#ifdef EMFILE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1606
            case EMFILE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1607
                sym = @symbol(EMFILE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1608
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1609
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1610
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1611
#ifdef ENOTTY
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1612
            case ENOTTY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1613
                sym = @symbol(ENOTTY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1614
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1615
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1616
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1617
#ifdef EFBIG
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1618
            case EFBIG:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1619
                sym = @symbol(EFBIG);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1620
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1621
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1622
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1623
#ifdef ENOSPC
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1624
            case ENOSPC:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1625
                sym = @symbol(ENOSPC);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1626
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1627
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1628
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1629
#ifdef ESPIPE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1630
            case ESPIPE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1631
                sym = @symbol(ESPIPE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1632
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1633
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1634
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1635
#ifdef EROFS
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1636
            case EROFS:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1637
                sym = @symbol(EROFS);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1638
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1639
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1640
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1641
#ifdef EMLINK
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1642
            case EMLINK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1643
                sym = @symbol(EMLINK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1644
                typ = @symbol(rangeErrorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1645
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1646
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1647
#ifdef EPIPE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1648
            case EPIPE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1649
                sym = @symbol(EPIPE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1650
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1651
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1652
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1653
#ifdef EDOM
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1654
            case EDOM:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1655
                sym = @symbol(EDOM);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1656
                typ = @symbol(rangeErrorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1657
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1658
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1659
#ifdef ERANGE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1660
            case ERANGE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1661
                sym = @symbol(ERANGE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1662
                typ = @symbol(rangeErrorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1663
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1664
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1665
#ifdef EDEADLK
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1666
# if EDEADLK != EWOULDBLOCK
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1667
            case EDEADLK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1668
                sym = @symbol(EDEADLK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1669
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1670
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1671
# endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1672
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1673
#ifdef ENAMETOOLONG
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1674
            case ENAMETOOLONG:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1675
                sym = @symbol(ENAMETOOLONG);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1676
                typ = @symbol(rangeErrorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1677
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1678
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1679
#ifdef ENOLCK
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1680
            case ENOLCK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1681
                sym = @symbol(ENOLCK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1682
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1683
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1684
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1685
#ifdef ENOSYS
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1686
            case ENOSYS:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1687
                sym = @symbol(ENOSYS);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1688
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1689
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1690
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1691
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1692
            case ENOTEMPTY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1693
                sym = @symbol(ENOTEMPTY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1694
                typ = @symbol(inappropriateReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1695
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1696
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1697
#ifdef EILSEQ
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1698
            case EILSEQ:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1699
                sym = @symbol(EILSEQ);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1700
                typ = @symbol(transferFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1701
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1702
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1703
            /*
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1704
             * XPG3 errnos - defined on most systems
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1705
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1706
#ifdef ENOTBLK
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1707
            case ENOTBLK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1708
                sym = @symbol(ENOTBLK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1709
                typ = @symbol(inappropriateReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1710
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1711
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1712
#ifdef ETXTBSY
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1713
            case ETXTBSY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1714
                sym = @symbol(ETXTBSY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1715
                typ = @symbol(inaccessibleSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1716
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1717
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1718
            /*
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1719
             * some others
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1720
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1721
#ifdef EWOULDBLOCK
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1722
            case EWOULDBLOCK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1723
                sym = @symbol(EWOULDBLOCK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1724
                typ = @symbol(notReadySignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1725
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1726
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1727
#ifdef ENOMSG
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1728
            case ENOMSG:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1729
                sym = @symbol(ENOMSG);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1730
                typ = @symbol(noDataSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
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 ELOOP
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1734
            case ELOOP:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1735
                sym = @symbol(ELOOP);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1736
                typ = @symbol(rangeErrorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1737
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1738
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1739
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1740
            /*
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1741
             * some stream errors
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1742
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1743
#ifdef ETIME
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1744
            case ETIME:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1745
                sym = @symbol(ETIME);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1746
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1747
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1748
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1749
#ifdef ENOSR
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1750
            case ENOSR:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1751
                sym = @symbol(ENOSR);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1752
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1753
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1754
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1755
#ifdef ENOSTR
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1756
            case ENOSTR:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1757
                sym = @symbol(ENOSTR);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1758
                typ = @symbol(inappropriateReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1759
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1760
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1761
#ifdef ECOMM
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1762
            case ECOMM:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1763
                sym = @symbol(ECOMM);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1764
                typ = @symbol(transferFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1765
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1766
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1767
#ifdef EPROTO
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1768
            case EPROTO:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1769
                sym = @symbol(EPROTO);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1770
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1771
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1772
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1773
            /*
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1774
             * nfs errors
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1775
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1776
#ifdef ESTALE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1777
            case ESTALE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1778
                sym = @symbol(ESTALE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1779
                typ = @symbol(unavailableReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1780
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1781
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1782
#ifdef EREMOTE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1783
            case EREMOTE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1784
                sym = @symbol(EREMOTE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1785
                typ = @symbol(rangeErrorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1786
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1787
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1788
            /*
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1789
             * some networking errors
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1790
             */
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1791
#ifdef EINPROGRESS
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1792
            case EINPROGRESS:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1793
                sym = @symbol(EINPROGRESS);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1794
                typ = @symbol(operationStartedSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1795
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1796
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1797
#ifdef EALREADY
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1798
            case EALREADY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1799
                sym = @symbol(EALREADY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1800
                typ = @symbol(operationStartedSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1801
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1802
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1803
#ifdef ENOTSOCK
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1804
            case ENOTSOCK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1805
                sym = @symbol(ENOTSOCK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1806
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1807
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1808
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1809
#ifdef EDESTADDRREQ
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1810
            case EDESTADDRREQ:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1811
                sym = @symbol(EDESTADDRREQ);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1812
                typ = @symbol(underspecifiedSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1813
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1814
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1815
#ifdef EMSGSIZE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1816
            case EMSGSIZE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1817
                sym = @symbol(EMSGSIZE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1818
                typ = @symbol(rangeErrorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1819
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1820
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1821
#ifdef EPROTOTYPE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1822
            case EPROTOTYPE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1823
                sym = @symbol(EPROTOTYPE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1824
                typ = @symbol(wrongSubtypeForOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1825
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1826
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1827
#ifdef ENOPROTOOPT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1828
            case ENOPROTOOPT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1829
                sym = @symbol(ENOPROTOOPT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1830
                typ = @symbol(unsupportedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1831
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1832
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1833
#ifdef EPROTONOSUPPORT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1834
            case EPROTONOSUPPORT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1835
                sym = @symbol(EPROTONOSUPPORT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1836
                typ = @symbol(unsupportedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1837
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1838
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1839
#ifdef ESOCKTNOSUPPORT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1840
            case ESOCKTNOSUPPORT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1841
                sym = @symbol(ESOCKTNOSUPPORT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1842
                typ = @symbol(unsupportedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1843
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1844
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1845
#ifdef EOPNOTSUPP
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1846
            case EOPNOTSUPP:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1847
                sym = @symbol(EOPNOTSUPP);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1848
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1849
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1850
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1851
#ifdef EPFNOSUPPORT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1852
            case EPFNOSUPPORT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1853
                sym = @symbol(EPFNOSUPPORT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1854
                typ = @symbol(unsupportedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1855
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1856
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1857
#ifdef EAFNOSUPPORT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1858
            case EAFNOSUPPORT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1859
                sym = @symbol(EAFNOSUPPORT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1860
                typ = @symbol(unsupportedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1861
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1862
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1863
#ifdef EADDRINUSE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1864
            case EADDRINUSE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1865
                sym = @symbol(EADDRINUSE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1866
                typ = @symbol(existingReferentSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1867
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1868
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1869
#ifdef EADDRNOTAVAIL
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1870
            case EADDRNOTAVAIL:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1871
                sym = @symbol(EADDRNOTAVAIL);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1872
                typ = @symbol(noPermissionsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1873
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1874
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1875
#ifdef ETIMEDOUT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1876
            case ETIMEDOUT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1877
                sym = @symbol(ETIMEDOUT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1878
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1879
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1880
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1881
#ifdef ECONNREFUSED
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1882
            case ECONNREFUSED:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1883
                sym = @symbol(ECONNREFUSED);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1884
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1885
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1886
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1887
#ifdef ENETDOWN
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1888
            case ENETDOWN:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1889
                sym = @symbol(ENETDOWN);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1890
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1891
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1892
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1893
#ifdef ENETUNREACH
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1894
            case ENETUNREACH:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1895
                sym = @symbol(ENETUNREACH);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1896
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1897
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1898
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1899
#ifdef ENETRESET
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1900
            case ENETRESET:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1901
                sym = @symbol(ENETRESET);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1902
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1903
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1904
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1905
#ifdef ECONNABORTED
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1906
            case ECONNABORTED:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1907
                sym = @symbol(ECONNABORTED);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1908
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1909
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1910
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1911
#ifdef ECONNRESET
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1912
            case ECONNRESET:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1913
                sym = @symbol(ECONNRESET);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1914
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1915
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1916
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1917
#ifdef EISCONN
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1918
            case EISCONN:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1919
                sym = @symbol(EISCONN);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1920
                typ = @symbol(unpreparedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1921
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1922
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1923
#ifdef ENOTCONN
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1924
            case ENOTCONN:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1925
                sym = @symbol(ENOTCONN);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1926
                typ = @symbol(unpreparedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1927
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1928
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1929
#ifdef ESHUTDOWN
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1930
            case ESHUTDOWN:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1931
                sym = @symbol(ESHUTDOWN);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1932
                typ = @symbol(unpreparedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1933
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1934
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1935
#ifdef EHOSTDOWN
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1936
            case EHOSTDOWN:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1937
                sym = @symbol(EHOSTDOWN);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1938
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1939
                break;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1940
#endif
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  1941
#ifdef EHOSTUNREACH
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1942
            case EHOSTUNREACH:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1943
                sym = @symbol(EHOSTUNREACH);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1944
                typ = @symbol(peerFaultSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1945
                break;
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1946
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  1947
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1948
#ifdef WSAEFAULT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1949
            case WSAEFAULT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1950
                sym = @symbol(WSAEFAULT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1951
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1952
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1953
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1954
#ifdef WSAEINTR
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1955
            case WSAEINTR:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1956
                sym = @symbol(WSAEINTR);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1957
                typ = @symbol(transientErrorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1958
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1959
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1960
#ifdef WSAEBADF
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1961
            case WSAEBADF:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1962
                sym = @symbol(WSAEBADF);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1963
                typ = @symbol(badAccessorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1964
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1965
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1966
#ifdef WSAEACCESS
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1967
            case WSAEACCESS:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1968
                sym = @symbol(WSAEACCESS);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1969
                typ = @symbol(badAccessorSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1970
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1971
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1972
#ifdef WSAEINVAL
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1973
            case WSAEINVAL:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1974
                sym = @symbol(WSAEINVAL);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1975
                typ = @symbol(invalidArgumentsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1976
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1977
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1978
#ifdef WSAEMFILE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1979
            case WSAEMFILE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1980
                sym = @symbol(WSAEMFILE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1981
                typ = @symbol(noResourcesSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1982
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1983
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1984
#ifdef WSAEWOULDBLOCK
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1985
            case WSAEWOULDBLOCK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1986
                sym = @symbol(WSAEWOULDBLOCK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1987
                typ = @symbol(notReadySignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1988
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1989
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1990
#ifdef WSAEINPROGRESS
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1991
            case WSAEINPROGRESS:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1992
                sym = @symbol(WSAEINPROGRESS);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1993
                typ = @symbol(operationStartedSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1994
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1995
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  1996
#ifdef WSAEALREADY
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1997
            case WSAEALREADY:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1998
                sym = @symbol(WSAEALREADY);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  1999
                typ = @symbol(operationStartedSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2000
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2001
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2002
#ifdef WSAENOTSOCK
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2003
            case WSAENOTSOCK:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2004
                sym = @symbol(WSAENOTSOCK);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2005
                typ = @symbol(inappropriateOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2006
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2007
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2008
#ifdef WSAEPROTONOSUPPORT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2009
            case WSAEPROTONOSUPPORT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2010
                sym = @symbol(WSAEPROTONOSUPPORT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2011
                typ = @symbol(unsupportedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2012
                break;
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2013
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2014
#ifdef WSAESOCKTNOSUPPORT
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2015
            case WSAESOCKTNOSUPPORT:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2016
                sym = @symbol(WSAESOCKTNOSUPPORT);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2017
                typ = @symbol(unsupportedOperationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2018
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2019
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2020
#ifdef E_NOINTERFACE
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2021
            case E_NOINTERFACE:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2022
                sym = @symbol(E_NOINTERFACE);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2023
                typ = @symbol(noInterfaceSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2024
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2025
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2026
#ifdef CO_E_NOTINITIALIZED
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2027
            case CO_E_NOTINITIALIZED:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2028
                sym = @symbol(CO_E_NOTINITIALIZED);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2029
                typ = @symbol(coNotInitializedSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2030
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2031
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2032
#ifdef REGDB_E_CLASSNOTREG
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2033
            case REGDB_E_CLASSNOTREG:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2034
                sym = @symbol(REGDB_E_CLASSNOTREG);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2035
                typ = @symbol(classNotRegisteredSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2036
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2037
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2038
#ifdef CLASS_E_NOAGGREGATION
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2039
            case CLASS_E_NOAGGREGATION:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2040
                sym = @symbol(CLASS_E_NOAGGREGATION);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2041
                typ = @symbol(noAggregationSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2042
                break;
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2043
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2044
#ifdef DISP_E_UNKNOWNNAME
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2045
            case DISP_E_UNKNOWNNAME:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2046
                sym = @symbol(DISP_E_UNKNOWNNAME);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2047
                typ = @symbol(unknownNameSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2048
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2049
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2050
#ifdef OLEOBJ_E_NOVERBS
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2051
            case OLEOBJ_E_NOVERBS:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2052
                sym = @symbol(OLEOBJ_E_NOVERBS);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2053
                typ = @symbol(noVerbsSignal);
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2054
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2055
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2056
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2057
            default:
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2058
                break;
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2059
        }
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2060
      }
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2061
    }
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2062
%}.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2063
    holder := OSErrorHolder new.
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2064
    holder errorSymbol:sym errorCategory:typ.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2065
    ^ holder
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2066
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2067
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2068
     OperatingSystem errorHolderForNumber:4
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2069
     self errorHolderForNumber:(self errorNumberFor:#EPERM)
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2070
     self errorHolderForNumber:(self errorNumberFor:#EIO)
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2071
     self errorHolderForNumber:(self errorNumberFor:#ENXIO)
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2072
     self errorHolderForNumber:(self errorNumberFor:#E_NOINTERFACE)
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2073
    "
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2074
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  2075
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2076
errorNumberFor:aSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2077
    "given a symbolic error, return the numeric;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2078
     (i.e. errorNumberFor:#EBADF returns EBADF's value).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2079
     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
  2080
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2081
%{   /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2082
    OBJ sym = aSymbol;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2083
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2084
    /*
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2085
     * WIN32 GetLastError returns
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2086
     */
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2087
#ifdef ERROR_INVALID_FUNCTION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2088
    if (sym == @symbol(ERROR_INVALID_FUNCTION)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2089
        RETURN ( __mkSmallInteger(ERROR_INVALID_FUNCTION) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2090
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2091
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2092
#ifdef ERROR_BAD_FORMAT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2093
    if (sym == @symbol(ERROR_BAD_FORMAT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2094
        RETURN ( __mkSmallInteger(ERROR_BAD_FORMAT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2095
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2096
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2097
#ifdef ERROR_FILE_NOT_FOUND
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2098
    if (sym == @symbol(ERROR_FILE_NOT_FOUND)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2099
        RETURN ( __mkSmallInteger(ERROR_FILE_NOT_FOUND) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2100
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2101
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2102
#ifdef ERROR_PATH_NOT_FOUND
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2103
    if (sym == @symbol(ERROR_PATH_NOT_FOUND)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2104
        RETURN ( __mkSmallInteger(ERROR_PATH_NOT_FOUND) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2105
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2106
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2107
#ifdef ERROR_TOO_MANY_OPEN_FILES
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2108
    if (sym == @symbol(ERROR_TOO_MANY_OPEN_FILES)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2109
        RETURN ( __mkSmallInteger(ERROR_TOO_MANY_OPEN_FILES) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2110
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2111
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2112
#ifdef ERROR_OPEN_FAILED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2113
    if (sym == @symbol(ERROR_OPEN_FAILED)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2114
        RETURN ( __mkSmallInteger(ERROR_OPEN_FAILED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2115
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2116
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2117
#ifdef ERROR_ACCESS_DENIED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2118
    if (sym == @symbol(ERROR_ACCESS_DENIED)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2119
        RETURN ( __mkSmallInteger(ERROR_ACCESS_DENIED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2120
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2121
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2122
#ifdef ERROR_INVALID_HANDLE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2123
    if (sym == @symbol(ERROR_INVALID_HANDLE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2124
        RETURN ( __mkSmallInteger(ERROR_INVALID_HANDLE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2125
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2126
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2127
#ifdef ERROR_NOT_ENOUGH_MEMORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2128
    if (sym == @symbol(ERROR_NOT_ENOUGH_MEMORY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2129
        RETURN ( __mkSmallInteger(ERROR_NOT_ENOUGH_MEMORY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2130
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2131
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2132
#ifdef ERROR_INVALID_ACCESS
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2133
    if (sym == @symbol(ERROR_INVALID_ACCESS)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2134
        RETURN ( __mkSmallInteger(ERROR_INVALID_ACCESS) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2135
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2136
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2137
#ifdef ERROR_INVALID_DATA
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2138
    if (sym == @symbol(ERROR_INVALID_DATA)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2139
        RETURN ( __mkSmallInteger(ERROR_INVALID_DATA) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2140
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2141
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2142
#ifdef ERROR_INVALID_NAME
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2143
    if (sym == @symbol(ERROR_INVALID_NAME)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2144
        RETURN ( __mkSmallInteger(ERROR_INVALID_NAME) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2145
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2146
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2147
#ifdef ERROR_ARENA_TRASHED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2148
    if (sym == @symbol(ERROR_ARENA_TRASHED)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2149
        RETURN ( __mkSmallInteger(ERROR_ARENA_TRASHED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2150
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2151
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2152
#ifdef ERROR_OUTOFMEMORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2153
    if (sym == @symbol(ERROR_OUTOFMEMORY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2154
        RETURN ( __mkSmallInteger(ERROR_OUTOFMEMORY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2155
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2156
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2157
#ifdef ERROR_BROKEN_PIPE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2158
    if (sym == @symbol(ERROR_BROKEN_PIPE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2159
        RETURN ( __mkSmallInteger(ERROR_BROKEN_PIPE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2160
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2161
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2162
#ifdef ERROR_GEN_FAILURE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2163
    if (sym == @symbol(ERROR_GEN_FAILURE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2164
        RETURN ( __mkSmallInteger(ERROR_GEN_FAILURE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2165
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2166
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2167
#ifdef ERROR_WRITE_PROTECT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2168
    if (sym == @symbol(ERROR_WRITE_PROTECT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2169
        RETURN ( __mkSmallInteger(ERROR_WRITE_PROTECT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2170
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2171
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2172
#ifdef ERROR_WRITE_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2173
    if (sym == @symbol(ERROR_WRITE_FAULT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2174
        RETURN ( __mkSmallInteger(ERROR_WRITE_FAULT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2175
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2176
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2177
#ifdef ERROR_READ_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2178
    if (sym == @symbol(ERROR_READ_FAULT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2179
        RETURN ( __mkSmallInteger(ERROR_READ_FAULT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2180
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2181
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2182
#ifdef ERROR_HANDLE_DISK_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2183
    if (sym == @symbol(ERROR_HANDLE_DISK_FULL)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2184
        RETURN ( __mkSmallInteger(ERROR_HANDLE_DISK_FULL) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2185
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2186
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2187
#ifdef ERROR_DISK_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2188
    if (sym == @symbol(ERROR_DISK_FULL)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2189
        RETURN ( __mkSmallInteger(ERROR_DISK_FULL) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2190
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2191
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2192
#ifdef ERROR_ERROR_SHARING_VIOLATION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2193
    if (sym == @symbol(ERROR_ERROR_SHARING_VIOLATION)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2194
        RETURN ( __mkSmallInteger(ERROR_ERROR_SHARING_VIOLATION) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2195
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2196
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2197
#ifdef ERROR_LOCK_VIOLATION
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2198
    if (sym == @symbol(ERROR_LOCK_VIOLATION)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2199
        RETURN ( __mkSmallInteger(ERROR_LOCK_VIOLATION) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2200
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2201
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2202
#ifdef ERROR_INVALID_PARAMETER
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2203
    if (sym == @symbol(ERROR_INVALID_PARAMETER)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2204
        RETURN ( __mkSmallInteger(ERROR_INVALID_PARAMETER) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2205
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2206
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2207
#ifdef ERROR_NET_WRITE_FAULT
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2208
    if (sym == @symbol(ERROR_NET_WRITE_FAULT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2209
        RETURN ( __mkSmallInteger(ERROR_NET_WRITE_FAULT) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2210
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2211
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2212
#ifdef ERROR_NOT_SUPPORTED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2213
    if (sym == @symbol(ERROR_NOT_SUPPORTED)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2214
        RETURN ( __mkSmallInteger(ERROR_NOT_SUPPORTED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2215
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2216
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2217
#ifdef ERROR_REM_NOT_LIST
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2218
    if (sym == @symbol(ERROR_REM_NOT_LIST)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2219
        RETURN ( __mkSmallInteger(ERROR_REM_NOT_LIST) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2220
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2221
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2222
#ifdef ERROR_NETWORK_ACCESS_DENIED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2223
    if (sym == @symbol(ERROR_NETWORK_ACCESS_DENIED)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2224
        RETURN ( __mkSmallInteger(ERROR_NETWORK_ACCESS_DENIED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2225
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2226
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2227
#ifdef ERROR_DUP_NAME
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2228
    if (sym == @symbol(ERROR_DUP_NAME)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2229
        RETURN ( __mkSmallInteger(ERROR_DUP_NAME) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2230
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2231
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2232
#ifdef ERROR_BAD_NETPATH
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2233
    if (sym == @symbol(ERROR_BAD_NETPATH)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2234
        RETURN ( __mkSmallInteger(ERROR_BAD_NETPATH) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2235
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2236
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2237
#ifdef ERROR_NETWORK_BUSY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2238
    if (sym == @symbol(ERROR_NETWORK_BUSY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2239
        RETURN ( __mkSmallInteger(ERROR_NETWORK_BUSY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2240
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2241
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2242
#ifdef ERROR_DRIVE_LOCKED
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2243
    if (sym == @symbol(ERROR_DRIVE_LOCKED)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2244
        RETURN ( __mkSmallInteger(ERROR_DRIVE_LOCKED) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2245
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2246
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2247
#ifdef ERROR_INVALID_DRIVE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2248
    if (sym == @symbol(ERROR_INVALID_DRIVE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2249
        RETURN ( __mkSmallInteger(ERROR_INVALID_DRIVE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2250
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2251
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2252
#ifdef ERROR_WRONG_DISK
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2253
    if (sym == @symbol(ERROR_WRONG_DISK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2254
        RETURN ( __mkSmallInteger(ERROR_WRONG_DISK) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2255
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2256
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2257
#ifdef ERROR_CURRENT_DIRECTORY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2258
    if (sym == @symbol(ERROR_CURRENT_DIRECTORY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2259
        RETURN ( __mkSmallInteger(ERROR_CURRENT_DIRECTORY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2260
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2261
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2262
#ifdef ERROR_CANNOT_MAKE
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2263
    if (sym == @symbol(ERROR_CANNOT_MAKE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2264
        RETURN ( __mkSmallInteger(ERROR_CANNOT_MAKE) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2265
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2266
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2267
#ifdef ERROR_NO_MORE_FILES
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2268
    if (sym == @symbol(ERROR_NO_MORE_FILES)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2269
        RETURN ( __mkSmallInteger(ERROR_NO_MORE_FILES) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2270
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2271
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2272
#ifdef ERROR_NOT_READY
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2273
    if (sym == @symbol(ERROR_NOT_READY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2274
        RETURN ( __mkSmallInteger(ERROR_NOT_READY) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2275
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2276
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2277
#ifdef ERROR_NOT_DOS_DISK
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2278
    if (sym == @symbol(ERROR_NOT_DOS_DISK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2279
        RETURN ( __mkSmallInteger(ERROR_NOT_DOS_DISK) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2280
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2281
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2282
#ifdef ERROR_OUT_OF_PAPER
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2283
    if (sym == @symbol(ERROR_OUT_OF_PAPER)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2284
        RETURN ( __mkSmallInteger(ERROR_OUT_OF_PAPER) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2285
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2286
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2287
#ifdef ERROR_PRINTQ_FULL
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2288
    if (sym == @symbol(ERROR_PRINTQ_FULL)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2289
        RETURN ( __mkSmallInteger(ERROR_PRINTQ_FULL) );
6277
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2290
    }
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2291
#endif
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2292
08ba50e16d65 error text handling
Claus Gittinger <cg@exept.de>
parents: 6275
diff changeset
  2293
    /*
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2294
     * POSIX errnos - these should be defined
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 EPERM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2297
    if (sym == @symbol(EPERM)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2298
        RETURN ( __mkSmallInteger(EPERM) );
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 ENOENT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2303
    if (sym == @symbol(ENOENT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2304
        RETURN ( __mkSmallInteger(ENOENT) );
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 ESRCH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2309
    if (sym == @symbol(ESRCH)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2310
        RETURN ( __mkSmallInteger(ESRCH) );
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 EINTR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2315
    if (sym == @symbol(EINTR)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2316
        RETURN ( __mkSmallInteger(EINTR) );
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 EIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2321
    if (sym == @symbol(EIO)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2322
        RETURN ( __mkSmallInteger(EIO) );
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 ENXIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2327
    if (sym == @symbol(ENXIO)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2328
        RETURN ( __mkSmallInteger(ENXIO) );
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 E2BIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2333
    if (sym == @symbol(E2BIG)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2334
        RETURN ( __mkSmallInteger(E2BIG) );
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 ENOEXEC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2339
    if (sym == @symbol(ENOEXEC)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2340
        RETURN ( __mkSmallInteger(ENOEXEC) );
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 EBADF
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2345
    if (sym == @symbol(EBADF)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2346
        RETURN ( __mkSmallInteger(EBADF) );
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 ECHILD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2351
    if (sym == @symbol(ECHILD)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2352
        RETURN ( __mkSmallInteger(ECHILD) );
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
#if defined(EAGAIN)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2357
    if (sym == @symbol(EAGAIN)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2358
        RETURN ( __mkSmallInteger(EAGAIN) );
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 ENOMEM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2363
    if (sym == @symbol(ENOMEM)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2364
        RETURN ( __mkSmallInteger(ENOMEM) );
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 EACCES
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2369
    if (sym == @symbol(EACCES)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2370
        RETURN ( __mkSmallInteger(EACCES) );
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 EFAULT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2375
    if (sym == @symbol(EFAULT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2376
        RETURN ( __mkSmallInteger(EFAULT) );
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 EBUSY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2381
    if (sym == @symbol(EBUSY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2382
        RETURN ( __mkSmallInteger(EBUSY) );
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 EXDEV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2387
    if (sym == @symbol(EXDEV)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2388
        RETURN ( __mkSmallInteger(EXDEV) );
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 ENODEV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2393
    if (sym == @symbol(ENODEV)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2394
        RETURN ( __mkSmallInteger(ENODEV) );
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
#ifdef ENOTDIR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2399
    if (sym == @symbol(ENOTDIR)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2400
        RETURN ( __mkSmallInteger(ENOTDIR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2401
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2402
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2403
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2404
#ifdef EISDIR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2405
    if (sym == @symbol(EISDIR)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2406
        RETURN ( __mkSmallInteger(EISDIR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2407
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2408
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2409
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2410
#ifdef EINVAL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2411
    if (sym == @symbol(EINVAL)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2412
        RETURN ( __mkSmallInteger(EINVAL) );
5133
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
#endif
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 ENFILE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2417
    if (sym == @symbol(ENFILE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2418
        RETURN ( __mkSmallInteger(ENFILE) );
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 EMFILE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2423
    if (sym == @symbol(EMFILE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2424
        RETURN ( __mkSmallInteger(EMFILE) );
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 ENOTTY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2429
    if (sym == @symbol(ENOTTY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2430
        RETURN ( __mkSmallInteger(ENOTTY) );
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
#ifdef EFBIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2435
    if (sym == @symbol(EFBIG)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2436
        RETURN ( __mkSmallInteger(EFBIG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2437
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2438
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2439
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2440
#ifdef ENOSPC
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2441
    if (sym == @symbol(ENOSPC)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2442
        RETURN ( __mkSmallInteger(ENOSPC) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2443
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2444
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2445
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2446
#ifdef ESPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2447
    if (sym == @symbol(ESPIPE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2448
        RETURN ( __mkSmallInteger(ESPIPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2449
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2450
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2451
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2452
#ifdef EROFS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2453
    if (sym == @symbol(EROFS)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2454
        RETURN ( __mkSmallInteger(EROFS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2455
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2456
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2457
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2458
#ifdef EMLINK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2459
    if (sym == @symbol(EMLINK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2460
        RETURN ( __mkSmallInteger(EMLINK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2461
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2462
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2463
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2464
#ifdef EPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2465
    if (sym == @symbol(EPIPE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2466
        RETURN ( __mkSmallInteger(EPIPE) );
5133
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
#endif
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 EDOM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2471
    if (sym == @symbol(EDOM)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2472
        RETURN ( __mkSmallInteger(EDOM) );
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 ERANGE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2477
    if (sym == @symbol(ERANGE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2478
        RETURN ( __mkSmallInteger(ERANGE) );
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
#ifdef EDEADLK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2483
    if (sym == @symbol(EDEADLK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2484
        RETURN ( __mkSmallInteger(EDEADLK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2485
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2486
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2487
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2488
#ifdef ENAMETOOLONG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2489
    if (sym == @symbol(ENAMETOOLONG)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2490
        RETURN ( __mkSmallInteger(ENAMETOOLONG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2491
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2492
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2493
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2494
#ifdef ENOLCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2495
    if (sym == @symbol(ENOLCK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2496
        RETURN ( __mkSmallInteger(ENOLCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2497
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2498
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2499
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2500
#ifdef ENOSYS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2501
    if (sym == @symbol(ENOSYS)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2502
        RETURN ( __mkSmallInteger(ENOSYS) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2503
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2504
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2505
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2506
#ifdef ENOTEMPTY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2507
    if (sym == @symbol(ENOTEMPTY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2508
        RETURN ( __mkSmallInteger(ENOTEMPTY) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2509
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2510
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2511
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2512
#ifdef EEXIST
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2513
    if (sym == @symbol(EEXIST)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2514
        RETURN ( __mkSmallInteger(EEXIST) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2515
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2516
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2517
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2518
#ifdef EILSEQ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2519
    if (sym == @symbol(EILSEQ)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2520
        RETURN ( __mkSmallInteger(EILSEQ) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2521
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2522
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2523
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
     * XPG3 errnos - defined on most systems
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 ENOTBLK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2528
    if (sym == @symbol(ENOTBLK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2529
        RETURN ( __mkSmallInteger(ENOTBLK) );
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 ETXTBSY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2534
    if (sym == @symbol(ETXTBSY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2535
        RETURN ( __mkSmallInteger(ETXTBSY) );
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
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2540
     * some others
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2541
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2542
#ifdef EWOULDBLOCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2543
    if (sym == @symbol(EWOULDBLOCK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2544
        RETURN ( __mkSmallInteger(EWOULDBLOCK) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2545
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2546
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2547
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2548
#ifdef ENOMSG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2549
    if (sym == @symbol(ENOMSG)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2550
        RETURN ( __mkSmallInteger(ENOMSG) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2551
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2552
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2553
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2554
#ifdef ELOOP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2555
    if (sym == @symbol(ELOOP)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2556
        RETURN ( __mkSmallInteger(ELOOP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2557
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2558
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2559
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
     * some stream errors
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 ETIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2564
    if (sym == @symbol(ETIME)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2565
        RETURN ( __mkSmallInteger(ETIME) );
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 ENOSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2570
    if (sym == @symbol(ENOSR)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2571
        RETURN ( __mkSmallInteger(ENOSR) );
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 ENOSTR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2576
    if (sym == @symbol(ENOSTR)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2577
        RETURN ( __mkSmallInteger(ENOSTR) );
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 ECOMM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2582
    if (sym == @symbol(ECOMM)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2583
        RETURN ( __mkSmallInteger(ECOMM) );
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 EPROTO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2588
    if (sym == @symbol(EPROTO)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2589
        RETURN ( __mkSmallInteger(EPROTO) );
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
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2594
     * nfs errors
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2595
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2596
#ifdef ESTALE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2597
    if (sym == @symbol(ESTALE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2598
        RETURN ( __mkSmallInteger(ESTALE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2599
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2600
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2601
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2602
#ifdef EREMOTE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2603
    if (sym == @symbol(EREMOTE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2604
        RETURN ( __mkSmallInteger(EREMOTE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2605
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2606
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2607
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
     * some networking errors
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 EINPROGRESS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2612
    if (sym == @symbol(EINPROGRESS)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2613
        RETURN ( __mkSmallInteger(EINPROGRESS) );
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 EALREADY
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2618
    if (sym == @symbol(EALREADY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2619
        RETURN ( __mkSmallInteger(EALREADY) );
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 ENOTSOCK
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2624
    if (sym == @symbol(ENOTSOCK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2625
        RETURN ( __mkSmallInteger(ENOTSOCK) );
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 EDESTADDRREQ
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2630
    if (sym == @symbol(EDESTADDRREQ)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2631
        RETURN ( __mkSmallInteger(EDESTADDRREQ) );
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 EMSGSIZE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2636
    if (sym == @symbol(EMSGSIZE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2637
        RETURN ( __mkSmallInteger(EMSGSIZE) );
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
#ifdef EPROTOTYPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2642
    if (sym == @symbol(EPROTOTYPE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2643
        RETURN ( __mkSmallInteger(EPROTOTYPE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2644
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2645
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2646
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2647
#ifdef ENOPROTOOPT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2648
    if (sym == @symbol(ENOPROTOOPT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2649
        RETURN ( __mkSmallInteger(ENOPROTOOPT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2650
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2651
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2652
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2653
#ifdef EPROTONOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2654
    if (sym == @symbol(EPROTONOSUPPORT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2655
        RETURN ( __mkSmallInteger(EPROTONOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2656
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2657
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2658
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2659
#ifdef ESOCKTNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2660
    if (sym == @symbol(ESOCKTNOSUPPORT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2661
        RETURN ( __mkSmallInteger(ESOCKTNOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2662
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2663
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2664
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2665
#ifdef EOPNOTSUPP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2666
    if (sym == @symbol(EOPNOTSUPP)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2667
        RETURN ( __mkSmallInteger(EOPNOTSUPP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2668
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2669
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2670
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2671
#ifdef EPFNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2672
    if (sym == @symbol(EPFNOSUPPORT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2673
        RETURN ( __mkSmallInteger(EPFNOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2674
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2675
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2676
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2677
#ifdef EAFNOSUPPORT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2678
    if (sym == @symbol(EAFNOSUPPORT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2679
        RETURN ( __mkSmallInteger(EAFNOSUPPORT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2680
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2681
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2682
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2683
#ifdef EADDRINUSE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2684
    if (sym == @symbol(EADDRINUSE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2685
        RETURN ( __mkSmallInteger(EADDRINUSE) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2686
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2687
#endif
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
#ifdef EADDRNOTAVAIL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2690
    if (sym == @symbol(EADDRNOTAVAIL)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2691
        RETURN ( __mkSmallInteger(EADDRNOTAVAIL) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2692
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2693
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2694
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2695
#ifdef ETIMEDOUT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2696
    if (sym == @symbol(ETIMEDOUT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2697
        RETURN ( __mkSmallInteger(ETIMEDOUT) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2698
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2699
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2700
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2701
#ifdef ECONNREFUSED
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2702
    if (sym == @symbol(ECONNREFUSED)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2703
        RETURN ( __mkSmallInteger(ECONNREFUSED) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2704
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2705
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2706
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2707
#ifdef ENETDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2708
    if (sym == @symbol(ENETDOWN)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2709
        RETURN ( __mkSmallInteger(ENETDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2710
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2711
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2712
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2713
#ifdef ENETUNREACH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2714
    if (sym == @symbol(ENETUNREACH)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2715
        RETURN ( __mkSmallInteger(ENETUNREACH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2716
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2717
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2718
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2719
#ifdef ENETRESET
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2720
    if (sym == @symbol(ENETRESET)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2721
        RETURN ( __mkSmallInteger(ENETRESET) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2722
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2723
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2724
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2725
#ifdef ECONNABORTED
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2726
    if (sym == @symbol(ECONNABORTED)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2727
        RETURN ( __mkSmallInteger(ECONNABORTED) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2728
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2729
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2730
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2731
#ifdef ECONNRESET
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2732
    if (sym == @symbol(ECONNRESET)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2733
        RETURN ( __mkSmallInteger(ECONNRESET) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2734
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2735
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2736
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2737
#ifdef EISCONN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2738
    if (sym == @symbol(EISCONN)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2739
        RETURN ( __mkSmallInteger(EISCONN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2740
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2741
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2742
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2743
#ifdef ENOTCONN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2744
    if (sym == @symbol(ENOTCONN)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2745
        RETURN ( __mkSmallInteger(ENOTCONN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2746
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2747
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2748
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2749
#ifdef ESHUTDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2750
    if (sym == @symbol(ESHUTDOWN)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2751
        RETURN ( __mkSmallInteger(ESHUTDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2752
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2753
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2754
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2755
#ifdef EHOSTDOWN
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2756
    if (sym == @symbol(EHOSTDOWN)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2757
        RETURN ( __mkSmallInteger(EHOSTDOWN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2758
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2759
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2760
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2761
#ifdef EHOSTUNREACH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2762
    if (sym == @symbol(EHOSTUNREACH)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2763
        RETURN ( __mkSmallInteger(EHOSTUNREACH) );
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
#endif
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2766
    /*
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2767
     * windows socket errors
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2768
     */
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2769
#ifdef WSAEINTR
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2770
    if (sym == @symbol(WSAEINTR)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2771
        RETURN ( __mkSmallInteger(WSAEINTR) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2772
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2773
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2774
#ifdef WSAEBADF
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2775
    if (sym == @symbol(WSAEBADF)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2776
        RETURN ( __mkSmallInteger(WSAEBADF) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2777
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2778
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2779
#ifdef WSAEACCESS
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2780
    if (sym == @symbol(WSAEACCESS)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2781
        RETURN ( __mkSmallInteger(WSAEACCESS) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2782
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2783
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2784
#ifdef WSAEFAULT
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2785
    if (sym == @symbol(WSAEFAULT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2786
        RETURN ( __mkSmallInteger(WSAEFAULT) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2787
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2788
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2789
#ifdef WSAEINVAL
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2790
    if (sym == @symbol(WSAEINVAL)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2791
        RETURN ( __mkSmallInteger(WSAEINVAL) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2792
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2793
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2794
#ifdef WSAEMFILE
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2795
    if (sym == @symbol(WSAEMFILE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2796
        RETURN ( __mkSmallInteger(WSAEMFILE) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2797
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2798
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2799
#ifdef WSAEWOULDBLOCK
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2800
    if (sym == @symbol(WSAEWOULDBLOCK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2801
        RETURN ( __mkSmallInteger(WSAEWOULDBLOCK) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2802
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2803
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2804
#ifdef WSAEINPROGRESS
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2805
    if (sym == @symbol(WSAEINPROGRESS)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2806
        RETURN ( __mkSmallInteger(WSAEINPROGRESS) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2807
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2808
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2809
#ifdef WSAEALREADY
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2810
    if (sym == @symbol(WSAEALREADY)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2811
        RETURN ( __mkSmallInteger(WSAEALREADY) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2812
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2813
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2814
#ifdef WSAENOTSOCK
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2815
    if (sym == @symbol(WSAENOTSOCK)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2816
        RETURN ( __mkSmallInteger(WSAENOTSOCK) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2817
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2818
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2819
#ifdef WSAEPROTONOSUPPORT
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2820
    if (sym == @symbol(WSAEPROTONOSUPPORT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2821
        RETURN ( __mkSmallInteger(WSAEPROTONOSUPPORT) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2822
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2823
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2824
#ifdef WSAESOCKTNOSUPPORT
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2825
    if (sym == @symbol(WSAESOCKTNOSUPPORT)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2826
        RETURN ( __mkSmallInteger(WSAESOCKTNOSUPPORT) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2827
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2828
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2829
#ifdef E_NOINTERFACE
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2830
    if (sym == @symbol(E_NOINTERFACE)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2831
        RETURN ( __MKUINT(E_NOINTERFACE) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2832
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2833
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2834
#ifdef CO_E_NOTINITIALIZED
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2835
    if (sym == @symbol(CO_E_NOTINITIALIZED)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2836
        RETURN ( __MKUINT(CO_E_NOTINITIALIZED) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2837
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2838
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2839
#ifdef REGDB_E_CLASSNOTREG
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2840
    if (sym == @symbol(REGDB_E_CLASSNOTREG)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2841
        RETURN ( __MKUINT(REGDB_E_CLASSNOTREG) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2842
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2843
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2844
#ifdef CLASS_E_NOAGGREGATION
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2845
    if (sym == @symbol(CLASS_E_NOAGGREGATION)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2846
        RETURN ( __MKUINT(CLASS_E_NOAGGREGATION) );
9166
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2847
    }
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2848
#endif
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2849
#ifdef DISP_E_UNKNOWNNAME
Claus Gittinger <cg@exept.de>
parents: 9156
diff changeset
  2850
    if (sym == @symbol(DISP_E_UNKNOWNNAME)) {
9181
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2851
        RETURN ( __MKUINT(DISP_E_UNKNOWNNAME) );
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2852
    }
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2853
#endif
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2854
#ifdef OLEOBJ_E_NOVERBS
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2855
    if (sym == @symbol(OLEOBJ_E_NOVERBS)) {
90f5b5e63cb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9177
diff changeset
  2856
        RETURN ( __MKUINT(OLEOBJ_E_NOVERBS) );
8780
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2857
    }
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2858
#endif
e86dbfe09278 WSA error codes
Claus Gittinger <cg@exept.de>
parents: 8763
diff changeset
  2859
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2860
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2861
    ^ -1
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2862
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2863
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2864
!Win32OperatingSystem class methodsFor:'executing OS commands'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2865
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2866
canExecuteCommand:aCommandString
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2867
    "return true, if the OS can execute aCommand."
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2868
8800
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  2869
"/    |fn|
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  2870
"/
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  2871
"/    fn := aCommandString asFilename.
b1762fb45942 canExecuteCommand fixed
Claus Gittinger <cg@exept.de>
parents: 8792
diff changeset
  2872
"/    ( #('com' 'exe') includes:fn suffix) ifFalse:[^ false].
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2873
    ^ super canExecuteCommand:aCommandString
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2874
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2875
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2876
     OperatingSystem canExecuteCommand:'fooBar'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2877
     OperatingSystem canExecuteCommand:'ls'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2878
     OperatingSystem canExecuteCommand:'cvs'
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  2879
     OperatingSystem canExecuteCommand:'diff'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2880
     OperatingSystem canExecuteCommand:'cvs.exe'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2881
     OperatingSystem canExecuteCommand:'C:\Dokumente und Einstellungen\penk\work\stx\projects\smalltalk\cvs.exe'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2882
     OperatingSystem canExecuteCommand:'C:\Windows\cvs.exe'
7066
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2883
    "
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2884
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2885
    "Created: 4.11.1995 / 19:13:54 / cg"
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2886
!
c1df8100c4ad canExecuteCommand fixed
penk
parents: 7065
diff changeset
  2887
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2888
commandAndArgsForOSCommand:aCommandString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2889
    "get a shell and shell arguments for command execution"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2890
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2891
    |shell args wDir path words hasRedirection|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2892
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
    "/ 'x:\WINNT\System32\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2895
    "/ or 'x:\WINDOWS\System32\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2896
    "/ or 'x:\WINDOWS\System\cmd /c <command>'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2897
    "/ or whatever ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2898
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2899
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2900
    "/ to workaround a bug in win95's command.com
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  2901
    "/ (which always returns a 0-exit code
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2902
    "/  - even if the command failed),
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2903
    "/ 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
  2904
    "/ call it directly if found.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2905
    "/ If not found, assume its a builtIn or batch command
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2906
    "/ and pass it to command.com.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2907
    "/ Also use command.com, if any I/O redirection is
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2908
    "/ involved, since that is (not yet) handled here.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2909
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2910
    "/ I know: this is a kludge but should work for now...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2911
    "/ ...this will change in an upcoming version to include
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2912
    "/ command.com command-line parsing here (sigh).
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2913
    hasRedirection := false.
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2914
    (aCommandString isNil or:[aCommandString includesAny:'<>|']) ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2915
	hasRedirection := true
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2916
    ].
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2917
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  2918
    self isMSWINDOWSNTlike ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2919
	hasRedirection ifFalse:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2920
	    |size name|
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2921
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2922
	    "/ test whether the commandString is an executable;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2923
	    "/ then, no shell is required
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2924
	    name := aCommandString withoutSeparators.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2925
	    (name notEmpty and:[(name startsWith:$") not]) ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2926
		|index file suffix|
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2927
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2928
		index := name indexOfSeparatorStartingAt:1.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2929
		index ~~ 0 ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2930
		    name := name copyFrom:1 to:(index -1).
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2931
		].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2932
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2933
		file   := name asFilename.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2934
		suffix := file suffix.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2935
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2936
		suffix isEmptyOrNil ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2937
		    suffix := 'exe'.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2938
		    file := file withSuffix:suffix.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2939
		].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2940
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2941
		(file exists and:[suffix = 'exe']) ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2942
		    "/ is an executable, no shell required
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2943
		    ^ Array with:nil with:aCommandString.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2944
		]
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2945
	    ].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2946
	].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2947
	shell := self getEnvironment:'COMSPEC'.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2948
	shell isNil ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2949
	    wDir := self getWindowsSystemDirectory asFilename.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2950
	    shell := (wDir construct:'cmd.exe').
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2951
	    shell exists ifFalse:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2952
		shell := (wDir construct:'command.com').
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2953
		shell exists ifFalse:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2954
		    self error:'no command.com available'.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2955
		]
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2956
	    ].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2957
	    shell := shell pathName.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2958
	].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2959
	aCommandString isNil ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2960
	    ^ Array with:nil with:shell
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2961
	].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2962
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2963
	^ Array with:nil with:(shell , ' /c ' , '"' , aCommandString , '"' )
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2964
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2965
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2966
    "/ I/O redirection is not yet handled directly
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2967
    "/ fallBack to command.com (below) to do it.
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2968
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  2969
    hasRedirection ifFalse:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2970
	words := aCommandString asCollectionOfSubstringsSeparatedBy:Character space.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2971
	args := ' '.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2972
	words from:2 to:(words size) do:[:s |
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2973
	    args := args , (s , ' ').
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2974
	].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2975
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2976
	path := self pathOfCommand:(words at:1).
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2977
	path notNil ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2978
	    "/ execute the command directly -
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2979
	    "/ without going through command.com
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2980
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2981
	    self isMSWINDOWSNTlike ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2982
		args := path , args.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2983
	    ].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2984
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2985
	    ^ Array with:path with:args
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2986
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2987
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2988
8078
dc95f02fa4c5 commandAndArgsForOSCommand: if no redirection and the command starts
ca
parents: 7865
diff changeset
  2989
    "/ I/O redirection or no executable was found
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2990
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2991
    shell := self getEnvironment:'COMSPEC'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  2992
    shell isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2993
	wDir := self getWindowsSystemDirectory asFilename.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2994
	shell := (wDir construct:'cmd.exe').
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2995
	shell exists ifFalse:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2996
	    shell := (wDir construct:'command.com').
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2997
	    shell exists ifFalse:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2998
		self error:'no command.com available'.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  2999
	    ]
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3000
	].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3001
	shell := shell pathName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3002
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3003
    aCommandString isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3004
	^ Array with:shell with:shell
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3005
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3006
    ^ Array with:shell with:(shell , ' /c ' , aCommandString)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3007
8349
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  3008
    "Modified: / 20-01-1998 / 16:57:19 / md"
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  3009
    "Modified: / 12-05-2004 / 12:47:06 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3010
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3011
7080
a82683bc1843 Cleanup closeDescriptor handling in exec:withArguments:...
Stefan Vogel <sv@exept.de>
parents: 7077
diff changeset
  3012
exec:aCommandPath withArguments:argString environment:environment fileDescriptors:fdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3013
    "Internal lowLevel entry for combined fork & exec for WIN32
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3014
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3015
     If fork is false (chain a command):
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3016
	 execute the OS command specified by the argument, aCommandPath, with
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3017
	 arguments in argArray (no arguments, if nil).
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3018
	 If successful, this method does not return and smalltalk is gone.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3019
	 If not successful, it does return.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3020
	 Normal use is with forkForCommand.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3021
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3022
     If fork is true (subprocess command execution):
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3023
	fork a child to do the above.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3024
	The process id of the child process is returned; nil if the fork failed.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3025
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3026
     fdArray contains the filedescriptors, to be used for the child (if fork is true).
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3027
	fdArray[1] = 15 -> use fd 15 as stdin.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3028
	If an element of the array is set to nil, the corresponding filedescriptor
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3029
	will be closed for the child.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3030
	fdArray[0] == StdIn for child
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3031
	fdArray[1] == StdOut for child
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3032
	fdArray[2] == StdErr for child
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3033
	on VMS, these must be channels as returned by createMailBox.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3034
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3035
     NOTE that in WIN32 the fds are HANDLES.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3036
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3037
     If newPgrp is true, the subprocess will be established in a new process group.
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3038
	The processgroup will be equal to id.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3039
	newPgrp is not used on WIN32 and VMS systems."
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3040
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3041
    |dirPath cmdPath cmdLine rslt|
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3042
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3043
    aDirectory notNil ifTrue:[
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3044
	dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3045
	(dirPath endsWith:':') ifTrue:[
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3046
	    dirPath := dirPath , '\'.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3047
	].
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3048
    ].
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3049
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3050
    self isMSWINDOWSNTlike ifTrue:[
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3051
	cmdPath := aCommandPath.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3052
	cmdLine := argString
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3053
    ] ifFalse:[
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3054
	cmdPath := 'stxspawn.exe'.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3055
	cmdLine := 'stxspawn.exe ' , aCommandPath , ' ' , argString
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3056
    ].
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3057
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3058
    rslt := self
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3059
	primExec:cmdPath
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3060
	commandLine:cmdLine
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3061
	fileDescriptors:fdArray
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3062
	fork:doFork
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3063
	newPgrp:newPgrp
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3064
	inPath:dirPath
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  3065
	createFlags:nil.
7841
c25e1dc957b8 debugPrint removed
ca
parents: 7840
diff changeset
  3066
c25e1dc957b8 debugPrint removed
ca
parents: 7840
diff changeset
  3067
"/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3068
    ^ rslt
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3069
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3070
    "Modified: / 31.1.1998 / 10:54:24 / md"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3071
    "Modified: / 15.5.1999 / 18:07:51 / cg"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3072
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  3073
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3074
getStatusOfProcess:aProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3075
    "wait for a process to terminate and fetch its exit status.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3076
     This is required to avoid zombie processes."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3077
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3078
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3079
    DWORD endStatus;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3080
    int status = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3081
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3082
    if (__isExternalAddressLike(aProcessId)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3083
	HANDLE handle = _HANDLEVal(aProcessId);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3084
	if (handle) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3085
#ifdef DO_WRAP_CALLS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3086
	    do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3087
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3088
		endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, handle, INFINITE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3089
	    } while ((endStatus < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3090
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3091
	    endStatus = WaitForSingleObject(handle , INFINITE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3092
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3093
	    if (endStatus != WAIT_FAILED) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3094
		if (GetExitCodeProcess(handle,&endStatus)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3095
		    status = endStatus;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3096
#ifdef PROCESSDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3097
		    fprintf(stderr, "getexitcode status = %d\n",status);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3098
		} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3099
		    fprintf(stderr, "getexitcode failed.\n");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3100
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3101
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3102
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3103
	}
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3104
	RETURN ( __mkSmallInteger(status));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3105
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3106
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3107
    self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3108
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3109
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3110
pathOfCommand:aCommand
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3111
    "find where aCommand's executable file is;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3112
     return its full pathName if there is such a command, otherwise
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3113
     return nil."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3114
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3115
    |path f fExt|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3116
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3117
    aCommand asFilename isAbsolute ifTrue:[
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3118
	aCommand asFilename exists ifTrue:[
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3119
	    ^ aCommand
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3120
	].
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3121
	^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3122
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3123
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3124
    path := self getEnvironment:'PATH'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3125
    path notNil ifTrue:[
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3126
	(path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3127
	    path isEmpty ifTrue:[
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3128
		f := aCommand asFilename
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3129
	    ] ifFalse:[
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3130
		f := path asFilename construct:aCommand.
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3131
	    ].
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3132
	    self executableFileExtensions do:[:ext |
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3133
		ext notEmpty ifTrue:[
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3134
		    fExt := (f pathName , '.' , ext) asFilename.
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3135
		] ifFalse:[
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3136
		    fExt := f.
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3137
		].
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3138
		fExt isExecutable ifTrue:[
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3139
		    ^ fExt pathName
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3140
		].
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3141
	    ].
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3142
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3143
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3144
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3145
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3146
    "windows:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3147
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3148
     OperatingSystem pathOfCommand:'bcc32'
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  3149
     OperatingSystem pathOfCommand:'diff'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3150
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3151
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3152
    "Modified: / 10.9.1998 / 17:51:49 / cg"
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
7080
a82683bc1843 Cleanup closeDescriptor handling in exec:withArguments:...
Stefan Vogel <sv@exept.de>
parents: 7077
diff changeset
  3155
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
  3156
    "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
  3157
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3158
    |handle|
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3159
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3160
    handle := Win32ProcessHandle new.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3161
%{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3162
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3163
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3164
     * if fork is false, chain to another command (not yet supported)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3165
     * otherwise, spawn a subprocess and let it execute the command.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3166
     * Currently, only the forking version is supported (who chains anyway ?)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3167
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3168
#if 0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3169
    char fullCmdPathBuffer[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3170
    char fullCmdLine[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3171
    char fullDirName[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3172
    char *fullCmdPath = fullCmdPathBuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3173
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3174
    char *cmdPath = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3175
    char *cmdLine = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3176
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3177
    char *dir = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3178
    DWORD               fdwCreate = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3179
    STARTUPINFO         lpsiStartInfo;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3180
    PROCESS_INFORMATION lppiProcInfo;
7070
c84a77aeb893 *** empty log message ***
penk
parents: 7066
diff changeset
  3181
    SECURITY_ATTRIBUTES sa;
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  3182
    SECURITY_DESCRIPTOR sd;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3183
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3184
    if (__isString(dirName)) {
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3185
	dir = __stringVal(dirName);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3186
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3187
    if ((__isString(commandPath) || (commandPath == nil))
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3188
     && __isString(commandLine)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3189
#if 0
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3190
	/*
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3191
	 * generate command line (cmd plus args)
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3192
	 */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3193
	if (__isWinNT) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3194
	    char *d;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3195
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3196
	    strcpy(fullCmdPath, __stringVal(aCommandPath));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3197
	    d = strchr(fullCmdPath,' ');
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3198
	    if (d) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3199
		*d++ = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3200
		strcpy(fullCmdLine, d);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3201
	    } else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3202
		fullCmdLine[0] = '\0';
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3203
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3204
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3205
	    //fullCmdPath = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3206
	    strcpy(fullCmdPath,"stxspawn.exe");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3207
	    strcpy(fullCmdLine,"stxspawn.exe ");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3208
	    strcat(fullCmdLine, __stringVal(aCommandPath));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3209
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3210
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3211
	if (__isString(argArray)) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3212
	    if (strlen(fullCmdLine) > 0) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3213
		strcat(fullCmdLine, " ");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3214
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3215
	    strcat(fullCmdLine, __stringVal(argArray));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3216
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3217
	    int i;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3218
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3219
	    for (i=0; i<__arraySize(argArray); i++) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3220
		OBJ arg = __ArrayInstPtr(argArray)->a_element[i];
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3221
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3222
		if (__isString(arg)) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3223
		    strcat(fullCmdLine, " ");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3224
		    strcat(fullCmdLine, __stringVal(arg));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3225
		} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3226
		    /* ignore */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3227
		    fprintf(stderr, "bad (non-string) arg\n");
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3228
		}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3229
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3230
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3231
#endif
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3232
	if (commandPath != nil) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3233
	    cmdPath = __stringVal(commandPath);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3234
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3235
	cmdLine = __stringVal(commandLine);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3236
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3237
	/*
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3238
	 * create descriptors as req'd
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3239
	 */
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  3240
	memset(&sa, 0, sizeof (sa));
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3241
	sa.nLength = sizeof( sa );
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3242
	sa.lpSecurityDescriptor = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3243
	sa.bInheritHandle = TRUE;
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  3244
	if (__isWinNT) {
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  3245
	    InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  3246
	    SetSecurityDescriptorDacl(&sd, -1, 0, 0);
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  3247
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  3248
	    sa.lpSecurityDescriptor = &sd;
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  3249
	}
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3250
	memset(&lppiProcInfo, 0, sizeof (lppiProcInfo));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3251
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3252
	memset(&lpsiStartInfo, 0, sizeof (lpsiStartInfo));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3253
	lpsiStartInfo.cb                = sizeof(lpsiStartInfo);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3254
	lpsiStartInfo.lpReserved        = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3255
	lpsiStartInfo.lpDesktop         = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3256
	lpsiStartInfo.lpTitle           = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3257
	lpsiStartInfo.dwX               = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3258
	lpsiStartInfo.dwY               = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3259
	lpsiStartInfo.dwXSize           = 100;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3260
	lpsiStartInfo.dwYSize           = 100;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3261
	lpsiStartInfo.dwXCountChars     = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3262
	lpsiStartInfo.dwYCountChars     = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3263
	lpsiStartInfo.dwFillAttribute   = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3264
	if (0 /*__isWinNT*/) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3265
	    lpsiStartInfo.dwFlags           = STARTF_USESTDHANDLES;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3266
	    lpsiStartInfo.wShowWindow       = SW_SHOWDEFAULT;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3267
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3268
	    lpsiStartInfo.dwFlags           = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES /*| STARTF_USEPOSITION*/;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3269
	    lpsiStartInfo.wShowWindow       = SW_HIDE /*SW_SHOWDEFAULT*/;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3270
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3271
	lpsiStartInfo.cbReserved2       = 0;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3272
	lpsiStartInfo.lpReserved2       = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3273
	lpsiStartInfo.hStdInput         = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3274
	lpsiStartInfo.hStdOutput        = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3275
	lpsiStartInfo.hStdError         = NULL;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3276
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3277
	/*
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3278
	 * set create process flags
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3279
	 * if the flags arg is nil, use common defaults;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3280
	 * 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
  3281
	 */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3282
	if (flagsOrNil != nil) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3283
	    fdwCreate = __longIntVal(flagsOrNil);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3284
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3285
	    if (0 /* __isWinNT */)
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3286
		fdwCreate = 0; //IDLE_PRIORITY_CLASS;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3287
	    else
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3288
		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
  3289
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3290
	    if (newPgrp == true) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3291
		fdwCreate |= CREATE_NEW_PROCESS_GROUP;
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3292
	    }
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  3293
	    fdwCreate |= CREATE_DEFAULT_ERROR_MODE;
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3294
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3295
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3296
	if (fdArray == nil) {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3297
	    lpsiStartInfo.hStdInput  = (HANDLE) _get_osfhandle (0);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3298
	    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (1);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3299
	    lpsiStartInfo.hStdError  = (HANDLE) _get_osfhandle (2);
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
  3300
	} else if (__isArrayLike(fdArray) && (__arraySize(fdArray) >= 3)) {
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3301
	    if (__ArrayInstPtr(fdArray)->a_element[0] != nil) {
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3302
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[0])) {
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3303
		    lpsiStartInfo.hStdInput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[0]);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3304
		} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3305
		    lpsiStartInfo.hStdInput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[0]));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3306
		}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3307
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3308
	    if (__ArrayInstPtr(fdArray)->a_element[1] != nil) {
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3309
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[1])) {
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3310
		    lpsiStartInfo.hStdOutput = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[1]);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3311
		} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3312
		    lpsiStartInfo.hStdOutput = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[1]));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3313
		}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3314
	    }
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3315
	    if (__ArrayInstPtr(fdArray)->a_element[2] != nil) {
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3316
		if (__isExternalAddressLike(__ArrayInstPtr(fdArray)->a_element[2])) {
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3317
		    lpsiStartInfo.hStdError  = _HANDLEVal(__ArrayInstPtr(fdArray)->a_element[2]);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3318
		} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3319
		    lpsiStartInfo.hStdError = (HANDLE) _get_osfhandle (__intVal(__ArrayInstPtr(fdArray)->a_element[2]));
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3320
		}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3321
	    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3322
#ifdef PROCESSDEBUGWIN32
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3323
	    fprintf(stderr, "stdin %x\n", lpsiStartInfo.hStdInput);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3324
	    fprintf(stderr, "stdout %x\n",lpsiStartInfo.hStdOutput);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3325
	    fprintf(stderr, "stderr %x\n",lpsiStartInfo.hStdError);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3326
#endif
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3327
	} else {
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  3328
	    fprintf(stderr, "Win32OS [warning]: bad fd arg in createProcess\n");
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3329
	}
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3330
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3331
	if (doFork == true) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3332
#ifdef PROCESSDEBUGWIN32
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3333
	    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
  3334
#endif
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3335
	    if (CreateProcess(  cmdPath,
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3336
				cmdLine,
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  3337
				&sa, NULL /* &sa */,           /* sec-attribs */
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3338
				sa.bInheritHandle,  /* inherit handles */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3339
				fdwCreate,
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3340
				NULL,               /* env */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3341
				dir,
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3342
				&lpsiStartInfo,
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3343
				&lppiProcInfo ))
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3344
	    {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3345
		CloseHandle(lppiProcInfo.hThread);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3346
#ifdef PROCESSDEBUGWIN32
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3347
		fprintf(stderr, "created process hProcess=%x\n", lppiProcInfo.hProcess);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3348
#endif
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3349
		__externalAddressVal(handle) = lppiProcInfo.hProcess;
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3350
		((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(handle))->pid = __mkSmallInteger(lppiProcInfo.dwProcessId);
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  3351
		RETURN (handle);
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3352
	    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3353
#ifdef PROCESSDEBUGWIN32
7118
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3354
	    fprintf(stderr, "created process error %d\n", GetLastError());
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3355
#endif
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3356
	    RETURN (nil);
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3357
	} else {
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3358
	    ; /* should never be called that way */
10b067555add *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7102
diff changeset
  3359
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3360
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3361
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3362
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3363
     path-argument not string
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3364
     or argArray not an array/nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3365
     or malloc failed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3366
     or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3367
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3368
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3369
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3370
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3371
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3372
    errorTo:anExternalErrStream auxFrom:anAuxiliaryStream
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3373
    environment:anEvironmentDictionary inDirectory:dir
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3374
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3375
    "start executing the OS command as specified by the argument, aCommandString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3376
     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
  3377
     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
  3378
     '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
  3379
     The command gets stdIn, stdOut and stdErr assigned from the arguments;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3380
     each may be nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3381
     Return the processId if successful, nil otherwise.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3382
     Use #monitorPid:action: for synchronization and exec status return,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3383
     or #killProcess: to stop it."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3384
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3385
    |nullStream in out err shellAndArgs rslt auxFd|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3386
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3387
    aCommandString isNil ifTrue:[^ nil].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3388
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3389
    (in := anExternalInStream) isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3390
	nullStream := Filename nullDevice readWriteStream.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3391
	in := nullStream.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3392
    ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3393
    (out := anExternalOutStream) isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3394
	nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3395
	out := nullStream.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3396
    ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3397
    (err := anExternalErrStream) isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3398
	err := out
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3399
    ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3400
    anAuxiliaryStream notNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3401
	auxFd := anAuxiliaryStream fileDescriptor
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  3402
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3403
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3404
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3405
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3406
    rslt := self
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3407
	exec:(shellAndArgs at:1)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3408
	withArguments:(shellAndArgs at:2)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3409
	environment:anEvironmentDictionary
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3410
	fileDescriptors:(Array with:in fileDescriptor
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3411
			       with:out fileDescriptor
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3412
			       with:err fileDescriptor
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3413
			       with:auxFd)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3414
	fork:true
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3415
	newPgrp:true "/ false
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3416
	inDirectory:dir.
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3417
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3418
    nullStream notNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3419
	nullStream close.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3420
    ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3421
    ^ rslt
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3422
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3423
    "blocking at current prio (i.e. only higher prio threads execute):
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3424
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3425
     OperatingSystem executeCommand:'ls -l > out'.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3426
    "
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3427
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3428
    "non-blocking (lower prio threads continue):
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3429
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3430
     |in out err pid sema|
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3431
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3432
     in := 'out' asFilename readStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3433
     out := 'out2' asFilename writeStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3434
     err := 'err' asFilename writeStream.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3435
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3436
     sema := Semaphore new.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3437
     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
  3438
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3439
     The following will no longer work. monitorPid has disappeared
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3440
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3441
     pid notNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  3442
	 Processor monitorPid:pid action:[:OSstatus | sema signal ].
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3443
     ].
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3444
     in close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3445
     out close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3446
     err close.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3447
     sema wait.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3448
     Transcript showCR:'finished'
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3449
    "
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  3450
8349
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  3451
    "Modified: / 21-03-1997 / 10:04:35 / dq"
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  3452
    "Modified: / 15-07-1997 / 16:03:51 / stefan"
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  3453
    "Created: / 12-11-1998 / 14:39:20 / cg"
b87b90e6d15a com-command generation (d-quotes in command-arg string)
Claus Gittinger <cg@exept.de>
parents: 8348
diff changeset
  3454
    "Modified: / 12-05-2004 / 12:30:21 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3455
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3456
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3457
!Win32OperatingSystem class methodsFor:'file access'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3458
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3459
closeFd:anIntegerOrHandle
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3460
    "low level close of a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3461
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3462
%{
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3463
    if (__isExternalAddressLike(anIntegerOrHandle) ) {
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3464
       if( !CloseHandle( anIntegerOrHandle ) ) {
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  3465
	   fprintf( stderr, "Win32OS [warning]: Could not close handle : %x\n", anIntegerOrHandle);
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3466
       }
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3467
       RETURN(self);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3468
    }
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3469
    if (__isSmallInteger(anIntegerOrHandle)) {
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3470
	close(__intVal(anIntegerOrHandle));
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3471
	RETURN(self);
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3472
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3473
%}.
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  3474
    ^ self primitiveFailed.
5133
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
createDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3478
    "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
  3479
     path, or relative to the current directory.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3480
     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
  3481
     This is a low-level entry - use Filename protocol for compatibility."
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
    "/ if it already exists this is ok
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3484
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3485
    (self isDirectory:aPathName) ifTrue:[^ true].
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
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3489
	int ret;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3490
	SECURITY_ATTRIBUTES sa;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3491
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3492
	sa.nLength = sizeof( sa );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3493
	sa.lpSecurityDescriptor = NULL;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3494
	sa.bInheritHandle = TRUE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3495
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3496
	ret = CreateDirectory(__stringVal(aPathName), &sa);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3497
	if (ret != TRUE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3498
	    __threadErrno = __WIN32_ERR(GetLastError());
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3499
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3500
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3501
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3502
	RETURN (true);
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  3503
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3504
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3505
    self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3506
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3507
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3508
     OperatingSystem createDirectory:'foo'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3509
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3510
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3511
    "Modified: 20.12.1995 / 11:24:13 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3512
    "Modified: 29.6.1996 / 14:06:54 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3513
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3514
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3515
createFileForReadAppend:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3516
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3517
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3518
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3519
createFileForReadWrite:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3520
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE' #'CREATE_ALWAYS')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3521
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3522
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3523
linkFile:oldPath to:newPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3524
    "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
  3525
     Return true if successful, false if not."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3526
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3527
    (oldPath isString not or:[newPath isString not]) ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3528
	"/
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3529
	"/ bad argument(s) given
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3530
	"/
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3531
	^ self primitiveFailed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3532
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3533
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3534
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3535
    "/ this OperatingSystem does not support links
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3536
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3537
    ^ UnsupportedOperationSignal raise
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3538
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3539
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3540
     OperatingSystem linkFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3541
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3542
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3543
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3544
openFile:pathName attributes:attributeSpec
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3545
    "non public internal helper.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3546
     open a file, return an os specific fileHandle.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3547
     attributes is a collection of symbols specifying how the file is
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3548
     to be opened."
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3549
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3550
    |fileHandle errorNumber argumentError|
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3551
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3552
    fileHandle := Win32Handle new.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3553
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3554
%{
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3555
    HANDLE h;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3556
    char *name;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3557
    OBJ *ap = __ArrayInstPtr(attributeSpec)->a_element;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3558
    int numAttrib = __arraySize(attributeSpec);
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3559
    int i;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3560
    DWORD access, share, create, attr;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3561
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3562
    if (! __isString(pathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3563
	fileHandle = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3564
	argumentError = @symbol(badPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3565
	goto badArgument;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3566
    }
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
  3567
    if (! __isArrayLike(attributeSpec)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3568
	fileHandle = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3569
	argumentError = @symbol(badAttributeSpec);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3570
	goto badArgument;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3571
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3572
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3573
    name = __stringVal(pathName);
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3574
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3575
    share = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3576
    access = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3577
    create = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3578
    attr = 0;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3579
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3580
    for (i=0; i<numAttrib;i++) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3581
	OBJ attrSym = ap[i];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3582
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3583
	if (attrSym == @symbol(FILE_SHARE_READ)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3584
	    share |= FILE_SHARE_READ;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3585
	} else if (attrSym == @symbol(FILE_SHARE_WRITE)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3586
	    share |= FILE_SHARE_WRITE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3587
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3588
	} else if (attrSym == @symbol(GENERIC_READ)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3589
	    access |= GENERIC_READ;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3590
	} else if (attrSym == @symbol(GENERIC_WRITE)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3591
	    access |= GENERIC_WRITE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3592
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3593
	} else if (attrSym == @symbol(CREATE_NEW)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3594
	    create |= CREATE_NEW;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3595
	} else if (attrSym == @symbol(CREATE_ALWAYS)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3596
	    create |= CREATE_ALWAYS;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3597
	} else if (attrSym == @symbol(OPEN_EXISTING)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3598
	    create |= OPEN_EXISTING;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3599
	} else if (attrSym == @symbol(OPEN_ALWAYS)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3600
	    create |= OPEN_ALWAYS;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3601
	} else if (attrSym == @symbol(TRUNCATE_EXISTING)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3602
	    create |= TRUNCATE_EXISTING;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3603
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3604
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_HIDDEN)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3605
	    attr |= FILE_ATTRIBUTE_HIDDEN;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3606
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3607
	    attr |= FILE_ATTRIBUTE_READONLY;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3608
	} else if (attrSym == @symbol(FILE_ATTRIBUTE_READONLY)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3609
	    attr |= FILE_ATTRIBUTE_READONLY;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3610
	} else if (attrSym == @symbol(FILE_FLAG_WRITE_THROUGH)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3611
	    attr |= FILE_FLAG_WRITE_THROUGH;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3612
	} else if (attrSym == @symbol(FILE_FLAG_SEQUENTIAL_SCAN)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3613
	    attr |= FILE_FLAG_SEQUENTIAL_SCAN;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3614
	} else if (attrSym == @symbol(FILE_FLAG_DELETE_ON_CLOSE)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3615
	    attr |= FILE_FLAG_DELETE_ON_CLOSE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3616
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3617
	    fprintf(stderr, "Win32OS [warning]: unsupported open mode\n");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3618
	}
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3619
    }
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3620
    if (create == 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3621
	fileHandle = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3622
	argumentError = @symbol(missingCreateMode);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3623
	goto badArgument;
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3624
    }
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  3625
#ifdef PROCESSDEBUGWIN32
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  3626
    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
  3627
		name, access, share, create, attr);
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  3628
#endif
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3629
    h = CreateFile(name, access, share, 0 /* sa */, create, attr, 0 /* hTempl */);
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3630
    if (h != INVALID_HANDLE_VALUE) {
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3631
	__externalAddressVal(fileHandle) = (void *)h;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3632
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3633
	fileHandle = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3634
	errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3635
    }
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3636
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3637
badArgument: ;
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3638
%}.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3639
    fileHandle notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3640
	fileHandle registerForFinalization.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3641
	^ fileHandle.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3642
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3643
    errorNumber isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3644
	self error:'invalid argument(s): ', argumentError.
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3645
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3646
	(self errorHolderForNumber:errorNumber) reportError
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3647
    ].
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3648
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3649
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3650
openFileForAppend:pathName
8412
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  3651
    "noone sends this message yet"
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  3652
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  3653
    ^ self shouldImplement
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3654
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3655
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3656
openFileForRead:pathName
6297
7d0a04fb50be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  3657
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3658
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3659
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3660
openFileForReadAppend:pathName
8412
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  3661
    "noone sends this message yet"
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  3662
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  3663
    ^ self shouldImplement
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3664
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3665
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3666
openFileForReadWrite:pathName
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3667
     ^ self openFile:pathName attributes:#(#'GENERIC_READ' #'GENERIC_WRITE')
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3668
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3669
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3670
openFileForWrite:pathName
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  3671
     ^ self openFile:pathName attributes:#(#'GENERIC_WRITE' #'OPEN_EXISTING')
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3672
!
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  3673
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3674
recursiveCopyDirectory:sourcePathName to:destination
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3675
    "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
  3676
     Return true if successful."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3677
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3678
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3679
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3680
    "Modified: / 4.6.1998 / 04:29:49 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3681
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3682
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3683
removeDirectory:fullPathName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3684
    "remove the directory named 'fullPathName'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3685
     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
  3686
     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
  3687
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3688
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3689
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3690
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3691
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3692
    if (__isString(fullPathName)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3693
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3694
	{
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3695
	    char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3696
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3697
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3698
	    do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3699
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3700
		ret = STX_API_CALL1( "RemoveDirectory", RemoveDirectory, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3701
	    } while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3702
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3703
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3704
	ret = RemoveDirectory((char *)__stringVal(fullPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3705
	__threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3706
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3707
	if (ret != TRUE) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3708
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3709
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3710
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3711
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3712
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3713
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3714
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3715
    "/ either not a string argument,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3716
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3717
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3718
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3719
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3720
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3721
     OperatingSystem createDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3722
     OperatingSystem removeDirectory:'foo'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3723
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3724
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3725
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3726
removeFile:fullPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3727
    "remove the file named 'fullPathName'; return true if successful.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3728
     This is a lowLevel entry - use Filename protocol for compatibility."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3729
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3730
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3731
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3732
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3733
    if (__isString(fullPathName)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3734
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3735
	{
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3736
	    char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3737
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3738
	    strncpy(_aPathName, __stringVal(fullPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3739
	    do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3740
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3741
		ret = STX_API_CALL1( "DeleteFile", DeleteFile, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3742
	    } while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3743
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3744
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3745
	ret = DeleteFile((char *)__stringVal(fullPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3746
	__threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3747
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3748
	if (ret != TRUE) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3749
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3750
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3751
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3752
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3753
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3754
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3755
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3756
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3757
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3758
renameFile:oldPath to:newPath
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3759
    "rename the file 'oldPath' to 'newPath'.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3760
     Someone else has to care for the names to be correct and
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3761
     correct for the OS used - therefore, this should not be called
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3762
     directlt. Instead, use Filename protocol to rename; this cares for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3763
     any invalid names.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3764
     Returns true if successful, false if not"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3765
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
    int ret, eno;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3768
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3769
    if (__isString(oldPath) && __isString(newPath)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3770
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3771
	char _oldPath[MAXPATHLEN], _newPath[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3772
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3773
	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
  3774
	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
  3775
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3776
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3777
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3778
	    ret = STX_C_CALL2( "rename", rename, _oldPath, _newPath);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3779
	} 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
  3780
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3781
	__BEGIN_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3782
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3783
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3784
	    ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3785
	} while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3786
	__END_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3787
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3788
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3789
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3790
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3791
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3792
	if (ret < 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3793
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3794
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3795
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3796
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3797
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3798
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3799
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3800
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3801
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3802
     OperatingSystem renameFile:'foo' to:'bar'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3803
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3804
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3805
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3806
truncateFile:aPathName to:newSize
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3807
    "change a files size return true on success, false on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3808
     This may not be supported on all architectures.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3809
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3810
     This is a low-level entry - use Filename protocol."
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
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3813
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3814
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3815
!Win32OperatingSystem class methodsFor:'file access rights'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3816
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3817
accessMaskFor:aSymbol
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3818
    "return the access bits mask for numbers as returned by
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3819
     OperatingSystem>>accessModeOf:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3820
     and expected by OperatingSystem>>changeAccessModeOf:to:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3821
     Since these numbers are OS dependent, always use the mask
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3822
     (never hardcode 8rxxx into your code)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3823
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3824
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3825
    /* posix systems should define these ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3826
#   ifndef S_IRUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3827
#    define S_IRUSR 0400
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3828
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3829
#   ifndef S_IWUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3830
#    define S_IWUSR 0200
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3831
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3832
#   ifndef S_IXUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3833
#    define S_IXUSR 0100
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3834
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3835
#   ifndef S_IRGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3836
#    define S_IRGRP 0040
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3837
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3838
#   ifndef S_IWGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3839
#    define S_IWGRP 0020
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3840
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3841
#   ifndef S_IXGRP
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3842
#    define S_IXGRP 0010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3843
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3844
#   ifndef S_IROTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3845
#    define S_IROTH 0004
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3846
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3847
#   ifndef S_IWOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3848
#    define S_IWOTH 0002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3849
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3850
#   ifndef S_IXOTH
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3851
#    define S_IXOTH 0001
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3852
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3853
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3854
    if (aSymbol == @symbol(readUser)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3855
	RETURN ( __mkSmallInteger(S_IRUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3856
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3857
    if (aSymbol == @symbol(writeUser)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3858
	RETURN ( __mkSmallInteger(S_IWUSR) );
5133
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
    if (aSymbol == @symbol(executeUser)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3861
	RETURN ( __mkSmallInteger(S_IXUSR) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3862
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3863
    if (aSymbol == @symbol(readGroup)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3864
	RETURN ( __mkSmallInteger(S_IRGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3865
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3866
    if (aSymbol == @symbol(writeGroup)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3867
	RETURN ( __mkSmallInteger(S_IWGRP) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3868
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3869
    if (aSymbol == @symbol(executeGroup)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3870
	RETURN ( __mkSmallInteger(S_IXGRP) );
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
    if (aSymbol == @symbol(readOthers)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3873
	RETURN ( __mkSmallInteger(S_IROTH) );
5133
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
    if (aSymbol == @symbol(writeOthers)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3876
	RETURN ( __mkSmallInteger(S_IWOTH) );
5133
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
    if (aSymbol == @symbol(executeOthers)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3879
	RETURN ( __mkSmallInteger(S_IXOTH) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3880
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3881
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3882
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3883
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3884
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3885
     OperatingSystem accessMaskFor:#readUser
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
!
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
accessModeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3890
    "return a number representing access rights rwxrwxrwx for owner,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3891
     group and others. Return nil if such a file does not exist.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3892
     Notice that the returned number is OS dependent - use the
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3893
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3894
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3895
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3896
     this could have been implemented as:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3897
	(self infoOf:aPathName) at:#mode
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3898
     but for huge directory searches the code below is faster
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3899
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3900
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
    struct stat buf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3903
    int ret;
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
    if (__isString(aPathName)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3906
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3907
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3908
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3909
	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
  3910
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3911
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3912
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3913
	    ret = STX_C_CALL2( "stat", stat, _aPathName, &buf);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3914
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3915
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3916
	__BEGIN_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3917
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3918
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3919
	    ret = stat( (char *)__stringVal(aPathName), &buf);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3920
	} while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3921
	__END_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3922
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3923
	    __threadErrno = __WIN32_ERR(GetLastError());
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
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3926
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3927
	if (ret < 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3928
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3929
	    RETURN ( nil );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3930
	}
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3931
	RETURN ( __mkSmallInteger(buf.st_mode & 0777) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3932
    }
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
   ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3935
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3936
   "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3937
    (OperatingSystem accessModeOf:'/') printStringRadix:8
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3938
   "
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
changeAccessModeOf:aPathName to:modeBits
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3942
    "change the access rights of aPathName to the OS dependent modeBits.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3943
     You should construct this mask using accessMaskFor, to be OS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3944
     independent. Return true if changed,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3945
     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
  3946
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3947
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3948
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3949
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3950
    if (__isString(aPathName) && __isSmallInteger(modeBits)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3951
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3952
	int chmod();
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3953
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3954
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3955
	strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3956
	do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3957
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3958
	    ret = STX_C_CALL2( "chmod", chmod, _aPathName, __intVal(modeBits));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3959
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3960
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3961
	__BEGIN_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3962
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3963
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3964
	    ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3965
	} while ((ret < 0) && (__threadErrno == EINTR));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3966
	__END_INTERRUPTABLE__
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3967
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3968
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3969
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3970
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3971
	if (ret < 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  3972
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3973
	    RETURN ( false );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3974
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  3975
	RETURN ( true );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3976
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3977
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3978
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3979
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3980
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3981
!Win32OperatingSystem class methodsFor:'file queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3982
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3983
caseSensitiveFilenames
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3984
    "return true, if the OS has caseSensitive file naming.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3985
     On MSDOS, this will return false;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3986
     on a real OS, we return true."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3987
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3988
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3989
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3990
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3991
compressPath:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3992
    "return the pathName compressed - that is, remove all ..-entries
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3993
     and . entries. This does not always (in case of symbolic links)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3994
     return the true pathName and is therefore used as a fallback
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3995
     if realPath and popen failed."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3996
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3997
    |names n "{ Class: SmallInteger }" |
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  3998
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  3999
    names := pathName
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4000
		asCollectionOfSubstringsSeparatedBy:self fileSeparator.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4001
    names := names asOrderedCollection.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4002
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4003
     cut off initial double-slashes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4004
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4005
    [names startsWith:#('' '')] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4006
	names removeFirst.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4007
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4008
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4009
     cut off double-slashes at end
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4010
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4011
    [names endsWith:#('')] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4012
	names removeLast.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4013
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4014
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4015
     cut off current-dir at beginning
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4016
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4017
    n := names size.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4018
    [(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4019
	names removeFirst.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4020
	n := n - 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4021
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4022
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4023
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4024
     cut off parent-dirs at end
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4025
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4026
    [(n > 2)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4027
     and:[(names endsWith:#('..'))
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4028
     and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4029
	names removeLast; removeLast.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4030
	n := n - 2.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4031
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4032
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4033
    ^ names asStringWith:self fileSeparator
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4034
		    from:1
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4035
		    to:n
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4036
		    compressTabs:false final:nil
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4037
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4038
    "
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4039
     OperatingSystem compressPath:'.\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4040
     OperatingSystem compressPath:'\foo\bar\baz\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4041
     OperatingSystem compressPath:'foo\bar\baz\..'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4042
     OperatingSystem compressPath:'foo\bar\baz\..\'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4043
     OperatingSystem compressPath:'foo\bar\baz\..\\\'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4044
     OperatingSystem compressPath:'\\\foo\bar\baz\..\\\'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4045
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4046
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4047
    "Modified: 1.11.1996 / 20:13:48 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4048
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4049
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4050
fileSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4051
    "return the character used to separate names in a path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4052
     This character differs for MSDOS and other systems,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4053
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4054
      preparation for the future)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4055
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4056
    ^ $\
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4057
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4058
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4059
getDiskInfoOf:aVolumeName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4060
    "returns a dictionary filled with any of:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4061
	freeBytes
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4062
	totalBytes
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4063
     and possibly additional (OS-specific) information"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4064
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4065
    |info ok sectorsPerCluster bytesPerSector freeClusters totalClusters
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4066
     type|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4067
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4068
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4069
    DWORD __sectorsPerCluster, __bytesPerSector, __freeClusters, __totalClusters;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4070
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4071
    if (__isString(aVolumeName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4072
	if (GetDiskFreeSpace(__stringVal(aVolumeName),
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4073
			     &__sectorsPerCluster,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4074
			     &__bytesPerSector,
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4075
			     &__freeClusters,
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4076
			     &__totalClusters) == TRUE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4077
	    sectorsPerCluster = __MKUINT(__sectorsPerCluster);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4078
	    bytesPerSector = __MKUINT(__bytesPerSector);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4079
	    freeClusters = __MKUINT(__freeClusters);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4080
	    totalClusters = __MKUINT(__totalClusters);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4081
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4082
	    switch (GetDriveType(__stringVal(aVolumeName))) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4083
		case DRIVE_REMOVABLE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4084
		    type = @symbol(removable); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4085
		case DRIVE_FIXED:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4086
		    type = @symbol(fixed); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4087
		case DRIVE_REMOTE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4088
		    type = @symbol(network); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4089
		case DRIVE_CDROM:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4090
		    type = @symbol(cdrom); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4091
		case DRIVE_RAMDISK:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4092
		    type = @symbol(ramdisk); break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4093
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4094
	    ok = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4095
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4096
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4097
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4098
    ok == true ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4099
	info := IdentityDictionary new.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4100
	info at:#sectorsPerCluster put:sectorsPerCluster.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4101
	info at:#bytesPerSector put:bytesPerSector.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4102
	info at:#freeClusters put:freeClusters.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4103
	info at:#totalClusters put:totalClusters.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4104
	info at:#freeBytes put:(freeClusters * sectorsPerCluster * bytesPerSector).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4105
	info at:#totalBytes put:(totalClusters * sectorsPerCluster * bytesPerSector).
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4106
	type notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4107
	    info at:#type put:type
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4108
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4109
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4110
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4111
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
     self getDiskInfoOf:'c:\'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4114
     self getDiskInfoOf:'d:\'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4115
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4116
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4117
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4118
getDriveList
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4119
    "return a list of volumes in the system.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4120
     On unix, no such thing like a volume exists
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4121
     - there, a syntetic list with root, home & current is returned.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4122
     On MSDOS, a list of drive letters is (eventually) returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4123
     On VMS, a list of volumes is (eventually) returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4124
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4125
    |list|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4126
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4127
    list := OrderedCollection new.
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
     * add drive letters as strings to list ...
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4131
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4132
    char buffer[1024];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4133
    char *cp;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4134
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4135
    GetLogicalDriveStrings(1023, buffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4136
    for (cp=buffer; *cp; ) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4137
      __SSEND1(list, @symbol(add:), 0, __MKSTRING(cp));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4138
      cp += strlen(cp) + 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4139
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4140
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4141
    ^ list
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4142
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4143
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4144
getFileVersionInfoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4145
    "retrieves the versionData from an executable or dll.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4146
     The returned value is either a byteArray, which should be
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4147
     processed further with extractVersionValue (VerQueryValue),
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4148
     or nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4149
     This is a WIN32 specific entry, not for common usage."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4150
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4151
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4152
	int sz;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4153
	DWORD dummy;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4154
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4155
	sz = GetFileVersionInfoSize(__stringVal(aPathName), &dummy);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4156
	if (sz > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4157
	    OBJ versionData;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4158
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4159
	    versionData = __BYTEARRAY_UNINITIALIZED_NEW_INT(sz);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4160
	    if (versionData == nil) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4161
		RETURN (nil);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4162
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4163
	    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
  4164
		RETURN (nil);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4165
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4166
	    RETURN (versionData);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4167
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4168
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4169
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4170
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4171
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4172
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4173
getNullDevice
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4174
    "get the name of the null-device."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4175
8755
8e67c864b126 Fix #getNullDevice
Stefan Vogel <sv@exept.de>
parents: 8742
diff changeset
  4176
    ^ 'nul:'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4177
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4178
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4179
infoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4180
    "return some object filled with info for the file 'aPathName';
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4181
     the info (for which corresponding access methods are understood by
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4182
     the returned object) is:
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4183
	 type            - a symbol giving the files type
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4184
	 mode            - numeric access mode
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4185
	 uid             - owners user id
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4186
	 gid             - owners group id
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4187
	 size            - files size
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4188
	 id              - files number (i.e. inode number)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4189
	 accessed        - last access time (as Timestamp)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4190
	 modified        - last modification time (as Timestamp)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4191
	 statusChanged   - last status change time (as Timestamp)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4192
	 alternativeName - (windows only:) the MSDOS name of the file
5133
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
     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
  4195
     all of the information.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4196
     Return nil if such a file does not exist.
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4197
     For symbolic links (if supported by the OS),
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4198
     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
  4199
     use #linkInfoOf: to get info about the link itself.
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
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4202
    |info type mode uid gid size id
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4203
     atime mtime ctime
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4204
     aYr aMon aDay aHr aMin aSec aMS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4205
     mYr mMon mDay mHr mMin mSec mMS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4206
     cYr cMon cDay cHr cMin cSec cMS
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  4207
     fileName alternativeName|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4208
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4209
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4210
    struct stat buf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4211
    int ret;
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  4212
    char alternativeFileNameBuffer[15];
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  4213
    char fileNameBuffer[MAX_PATH+1];
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  4214
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4215
    unsigned INT ino;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4216
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4217
    if (__isString(aPathName)) {
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4218
	HANDLE hFile;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4219
	FILETIME tempFileTime;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4220
	SYSTEMTIME creationTime;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4221
	SYSTEMTIME accessTime;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4222
	SYSTEMTIME modificationTime;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4223
	int modeBits = 0;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4224
	WIN32_FIND_DATA findStruct;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4225
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4226
#ifdef DO_WRAP_CALLS
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4227
	{
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4228
	    char _aPathName[MAXPATHLEN];
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4229
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4230
	    strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4231
	    do {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4232
		__threadErrno = 0;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4233
		hFile = STX_API_CALL2( "FindFirstFile", FindFirstFile, _aPathName, &findStruct);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4234
	    } while ((hFile < 0) && (__threadErrno == EINTR));
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4235
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4236
#else
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4237
	hFile = FindFirstFile(__stringVal(aPathName), &findStruct);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4238
	if (hFile < 0) {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4239
	    __threadErrno = __WIN32_ERR(GetLastError());
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4240
	}
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4241
#endif
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4242
	if (! hFile || (hFile == (HANDLE)(-1)) || (hFile == INVALID_HANDLE_VALUE)) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4243
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4244
	} else {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4245
	    FindClose(hFile);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4246
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4247
	    id = __mkSmallInteger(0);   /* could get it by opening ... */
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4248
	    size = __MKLARGEINT64(1, findStruct.nFileSizeLow, findStruct.nFileSizeHigh);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4249
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4250
	    if (findStruct.cFileName[0] != '\0') {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4251
		bcopy(findStruct.cFileName, fileNameBuffer, MAX_PATH);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4252
		fileNameBuffer[MAX_PATH] = '\0';
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4253
		fileName = __MKSTRING(fileNameBuffer);             /* FULL name */
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4254
	    }
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4255
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4256
	    if (findStruct.cAlternateFileName[0] != '\0') {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4257
		bcopy(findStruct.cAlternateFileName, alternativeFileNameBuffer, 14);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4258
		alternativeFileNameBuffer[14] = '\0';
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4259
		alternativeName = __MKSTRING(alternativeFileNameBuffer); /* DOS name */
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4260
	    }
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4261
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4262
	    /*
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4263
	     * simulate access bits
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4264
	     */
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4265
	    if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4266
		modeBits = 0444;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4267
	    } else {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4268
		modeBits = 0666;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4269
	    }
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4270
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4271
	    if (findStruct.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4272
		type = @symbol(directory);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4273
		modeBits |= 0111;   /* executable */
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4274
	    } else {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4275
		type = @symbol(regular);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4276
	    }
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4277
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4278
	    mode = __mkSmallInteger(modeBits);
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4279
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4280
	    /*
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4281
	     * sigh - convert from stupid time to useful time
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4282
	     */
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4283
	    FileTimeToLocalFileTime(&findStruct.ftCreationTime, &tempFileTime);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4284
	    FileTimeToSystemTime(&tempFileTime, &creationTime);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4285
	    FileTimeToLocalFileTime(&findStruct.ftLastAccessTime, &tempFileTime);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4286
	    FileTimeToSystemTime(&tempFileTime, &accessTime);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4287
	    FileTimeToLocalFileTime(&findStruct.ftLastWriteTime, &tempFileTime);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4288
	    FileTimeToSystemTime(&tempFileTime, &modificationTime);
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4289
	    aYr  = __mkSmallInteger(accessTime.wYear);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4290
	    aMon = __mkSmallInteger(accessTime.wMonth);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4291
	    aDay = __mkSmallInteger(accessTime.wDay);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4292
	    aHr  = __mkSmallInteger(accessTime.wHour);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4293
	    aMin = __mkSmallInteger(accessTime.wMinute);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4294
	    aSec = __mkSmallInteger(accessTime.wSecond);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4295
	    aMS  = __mkSmallInteger(accessTime.wMilliseconds);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4296
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4297
	    mYr  = __mkSmallInteger(modificationTime.wYear);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4298
	    mMon = __mkSmallInteger(modificationTime.wMonth);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4299
	    mDay = __mkSmallInteger(modificationTime.wDay);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4300
	    mHr  = __mkSmallInteger(modificationTime.wHour);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4301
	    mMin = __mkSmallInteger(modificationTime.wMinute);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4302
	    mSec = __mkSmallInteger(modificationTime.wSecond);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4303
	    mMS  = __mkSmallInteger(modificationTime.wMilliseconds);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4304
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4305
	    cYr  = __mkSmallInteger(creationTime.wYear);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4306
	    cMon = __mkSmallInteger(creationTime.wMonth);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4307
	    cDay = __mkSmallInteger(creationTime.wDay);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4308
	    cHr  = __mkSmallInteger(creationTime.wHour);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4309
	    cMin = __mkSmallInteger(creationTime.wMinute);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4310
	    cSec = __mkSmallInteger(creationTime.wSecond);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4311
	    cMS  = __mkSmallInteger(creationTime.wMilliseconds);
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4312
	}
5133
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
%}.
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4315
    mode isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4316
	(self isDirectory:aPathName) ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4317
	    "/ the code above fails for root directories (these do not exist).
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4318
	    "/ simulate
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4319
	    mode := 8r777.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4320
	    type := #directory.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4321
	    uid := gid := 0.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4322
	    size := 0.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4323
	    id := 0.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4324
	    atime := mtime := ctime := Timestamp now.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4325
	].
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4326
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4327
    mode notNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4328
	atime isNil ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4329
	    atime := Timestamp day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4330
	].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4331
	mtime isNil ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4332
	    mtime := Timestamp day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4333
	].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4334
	ctime isNil ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4335
	    ctime := Timestamp day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4336
	].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4337
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4338
	info := FileStatusInfo
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4339
		    type:type
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4340
		    mode:mode
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4341
		    uid:uid
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4342
		    gid:gid
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4343
		    size:size
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4344
		    id:id
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4345
		    accessed:atime
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4346
		    modified:mtime
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4347
		    created:ctime
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4348
		    path:nil
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4349
		    fullName:fileName
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4350
		    alternativeName:alternativeName.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  4351
	^ info
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4352
   ].
6726
3447154f8aa4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6543
diff changeset
  4353
   ^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4354
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4355
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4356
    OperatingSystem infoOf:'c:\windows'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4357
    OperatingSystem infoOf:'stx.exe'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4358
    (OperatingSystem infoOf:'/') uid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4359
    (OperatingSystem infoOf:'/') accessed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4360
   "
6377
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4361
0113dcb902c5 simulate :drive as a directory
Claus Gittinger <cg@exept.de>
parents: 6372
diff changeset
  4362
    "Modified: / 4.2.2002 / 17:15:08 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4363
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4364
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4365
isDirectory:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4366
    "return true, if 'aPathName' is a valid directory path name.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4367
     (i.e. exists and is a directory).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4368
     This also returns true for symbolic links pointing to a directory;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4369
     if you need to check for this, use #linkInfo:."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4370
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4371
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4372
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4373
	int ret;
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  4374
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4375
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4376
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4377
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4378
	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
  4379
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4380
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4381
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4382
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4383
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4384
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4385
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4386
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4387
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4388
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4389
	if (ret < 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4390
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4391
	    RETURN ( false );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4392
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4393
	RETURN ( (ret & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
5133
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
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4396
    ^ self primitiveFailed
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
    "an alternative implementation would be:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4399
	^ (self infoOf:aPathName) type == #directory
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4400
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4401
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4402
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4403
isExecutable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4404
    "return true, if the given file is executable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4405
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4406
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
	int ret;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4410
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4411
	/*
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4412
	 * under windows, there is no executable attribute ...
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4413
	 * so, only check for the files existence here.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4414
	 */
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  4415
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4416
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4417
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4418
	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
  4419
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4420
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4421
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4422
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4423
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4424
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4425
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4426
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4427
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4428
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4429
	if (ret < 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4430
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4431
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4432
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4433
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4434
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4435
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4436
!
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
isReadable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4439
    "return true, if the file/dir 'aPathName' is readable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4440
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4441
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4442
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4443
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4444
	int ret;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4445
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4446
	/*
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4447
	 * under windows, all files are readable ...
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4448
	 * so, only check for the files existence here.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4449
	 */
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  4450
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4451
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4452
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4453
	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
  4454
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4455
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4456
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4457
	} 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
  4458
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4459
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4460
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4461
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4462
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4463
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4464
	if (ret < 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4465
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4466
	    RETURN (false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4467
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4468
	RETURN (true);
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
    ^ self primitiveFailed
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4474
isValidPath:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4475
    "return true, if 'aPathName' is a valid path name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4476
     (i.e. the file or directory exists)"
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
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4479
    struct stat buf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4480
    int ret;
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
    if (__isString(aPathName) || __isSymbol(aPathName) ) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4483
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4484
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4485
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4486
	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
  4487
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4488
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4489
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4490
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4491
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4492
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4493
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4494
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4495
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4496
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4497
	if (ret < 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4498
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4499
	    RETURN ( false );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4500
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4501
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4502
    }
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
    ^ self primitiveFailed
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4507
isWritable:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4508
    "return true, if the given file is writable.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4509
     For symbolic links, the pointed-to-file is checked."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4510
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4511
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4512
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4513
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4514
    if (__isString(aPathName)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4515
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4516
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4517
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4518
	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
  4519
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4520
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4521
	    ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4522
	} while ((ret < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4523
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4524
	ret = GetFileAttributes((char *) __stringVal(aPathName));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4525
	if (ret < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4526
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4527
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4528
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4529
	if (ret < 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  4530
	    @global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4531
	    RETURN ( false );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4532
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4533
	RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true);
5133
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
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4536
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4537
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4538
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4539
linkInfoOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4540
    "return a dictionary filled with info for the file 'aPathName',
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  4541
     If aPathName is invalid, nil is returned.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4542
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4543
     The contents of the dictionary gives info about the link itself,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4544
     on contrast to #infoOf:, which returns the info of the pointed to file
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  4545
     in case of a symbolic link.
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  4546
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  4547
     Same as #infoOf: for windows"
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  4548
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  4549
    ^ self infoOf:aPathName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4550
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4551
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4552
mimeTypeForSuffix:aFileSuffix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4553
    "given a file suffix, return a corresponding mimeType.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4554
     Here, the Registry is consulted.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4555
     Returns nil if no mimeType for the given suffix is known."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4556
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4557
    ^ RegistryEntry
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  4558
	stringValueFor:'Content Type'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  4559
	atKey:('HKEY_CLASSES_ROOT\.' , aFileSuffix)
5133
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
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4562
     self mimeTypeForSuffix:'au'
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  4563
     self mimeTypeForSuffix:'st'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  4564
     self mimeTypeForSuffix:'dll'
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  4565
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4566
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4567
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4568
parentDirectoryName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4569
    "return the name used to refer to parent directories.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4570
     In MSDOS, Unix and other systems this is '..', but maybe different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4571
     for other systems.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4572
     (but those are currently not supported - so this is some
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4573
      preparation for the future)"
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
    ^ '..'
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4578
pathNameOf:pathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4579
    "return the pathName of the argument, aPathString,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4580
     - thats the full pathname of the directory, starting at '/'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4581
     This method needs the path to be valid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4582
     (i.e. all directories must exist, be readable and executable).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4583
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4584
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4585
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4586
    |p path|
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
    "some systems have a convenient function for this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4589
    path := self primPathNameOf:pathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4590
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4591
    path isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4592
	(self isValidPath:pathName) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4593
	    p := pathName.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4594
	    [(p size > 1)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4595
	     and:[p endsWith:(self fileSeparator)]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4596
	    ] whileTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4597
		p := p copyWithoutLast:1.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4598
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4599
	    ^ p
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4600
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4601
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4602
	"/
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4603
	"/ 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
  4604
	"/
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4605
	path := self compressPath:pathName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4606
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4607
    ^ path.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4608
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4609
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4610
     OperatingSystem pathNameOf:'.'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4611
     OperatingSystem pathNameOf:'../smalltalk/../smalltalk'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4612
     OperatingSystem pathNameOf:'../../..'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4613
     OperatingSystem pathNameOf:'..'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4614
     OperatingSystem pathNameOf:'/tmp////'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4615
     OperatingSystem pathNameOf:'/foo/bar'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4616
     OperatingSystem pathNameOf:'/foo/bar/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4617
     OperatingSystem pathNameOf:'/foo/bar//'
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
    "Modified: 29.11.1996 / 18:02:12 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4621
    "Modified: 10.1.1997 / 19:10:42 / cg"
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4624
primIdOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4625
    "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
  4626
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4627
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4628
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4629
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4630
primPathNameOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4631
    "return the pathName of the argument, aPathString,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4632
     - thats the full pathname of the directory, starting at '/'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4633
     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
  4634
     realPath library function.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4635
     Notice: if symbolic links are involved, the result may look different
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4636
     from what you expect."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4637
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4638
%{  /* xxSTACK: 16000 */
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
    if (__isString(aPathName)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4641
	char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4642
	char *pFinal;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4643
	int rslt;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4644
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4645
#ifdef DO_WRAP_CALLS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4646
	char _aPathName[MAXPATHLEN];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4647
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4648
	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
  4649
	do {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4650
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4651
	    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
  4652
	} while ((rslt < 0) && (__threadErrno == EINTR));
8174
299fb336ad5b GetLongPathName - not on NT40
Claus Gittinger <cg@exept.de>
parents: 8173
diff changeset
  4653
#else
299fb336ad5b GetLongPathName - not on NT40
Claus Gittinger <cg@exept.de>
parents: 8173
diff changeset
  4654
	rslt = GetFullPathName(__stringVal(aPathName), sizeof(nameBuffer), nameBuffer, &pFinal);
299fb336ad5b GetLongPathName - not on NT40
Claus Gittinger <cg@exept.de>
parents: 8173
diff changeset
  4655
#endif
299fb336ad5b GetLongPathName - not on NT40
Claus Gittinger <cg@exept.de>
parents: 8173
diff changeset
  4656
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4657
	if (rslt > 0) {
8652
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4658
	    /*
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4659
	     * Attention: GetLongPathName is not available on old NT4.0/W95/W98
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4660
	     */
8653
79c6fe7a21fe GetLongPathName is not avail. on w95,w98 and NT4.0
Claus Gittinger <cg@exept.de>
parents: 8652
diff changeset
  4661
	    static FARPROC entry = NULL;
8652
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4662
#ifdef NO_NT4_0_COMPATIBILITY
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4663
	    entry = (FARPROC) GetLongPathName;
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4664
#else
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  4665
	    if (entry == NULL) {
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  4666
		entry = __get_KERNEL32_functionAddress("GetLongPathNameA");
8652
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4667
	    }
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4668
#endif /* NO_NT4_0_COMPATIBILITY */
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  4669
8652
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4670
	    if (entry) {
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4671
#ifdef DO_WRAP_CALLS
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4672
		do {
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4673
		    __threadErrno = 0;
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4674
		    rslt = STX_API_CALL3( "GetLongPathName", entry, nameBuffer, nameBuffer, sizeof(nameBuffer));
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4675
		} while ((rslt < 0) && (__threadErrno == EINTR));
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4676
#else
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4677
		rslt = (*entry)(nameBuffer, nameBuffer, sizeof(nameBuffer));
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4678
#endif
793cc6e353bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8651
diff changeset
  4679
	    }
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4680
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4681
	if (rslt > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4682
	    RETURN ( __MKSTRING(nameBuffer) );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4683
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4684
	__threadErrno = __WIN32_ERR(GetLastError());
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4685
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4686
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4687
    ^ nil
7102
415388639cdd changes claus
penk
parents: 7080
diff changeset
  4688
"
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4689
self primPathNameOf:'.'
7102
415388639cdd changes claus
penk
parents: 7080
diff changeset
  4690
"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4691
!
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
timeOfLastAccess:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4694
    "return the time, when the file was last accessed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4695
     For nonexistent files, nil is returned."
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
    "could be implemented as:
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4698
	(self infoOf:aPathName) accessed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4699
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4700
    | i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4701
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4702
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  4703
    i notNil ifTrue:[^ i accessTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4704
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4705
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
     OperatingSystem timeOfLastAccess:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4708
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4709
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4710
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4711
timeOfLastChange:aPathName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4712
    "return the time, when the file was last changed.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4713
     For nonexistent files, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4714
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4715
    "could be implemented as:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4716
	(self infoOf:aPathName) modified
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4717
    "
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
    | i|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4720
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4721
    i := self infoOf:aPathName.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  4722
    i notNil ifTrue:[^ i modificationTime].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4723
    ^ nil.
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4726
     OperatingSystem timeOfLastChange:'/'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4727
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4728
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4729
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4730
typeOf:aPathName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4731
    "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
  4732
     nil is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4733
     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
  4734
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4735
    |i|
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4738
     this could have been implemented as:
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4739
	(self infoOf:aPathName) type
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4740
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4741
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4742
    i := self infoOf:aPathName.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4743
    i notNil ifTrue:[^ i type].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4744
    ^ nil.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4745
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4746
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4747
     OperatingSystem typeOf:'/'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4748
     OperatingSystem typeOf:'.'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4749
     OperatingSystem typeOf:'Make.proto'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4750
     OperatingSystem typeOf:'resources/motif.style'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4751
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4752
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4753
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4754
volumeNameOf:aPathString
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4755
    "return the volumeName of the argument, aPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4756
     - thats the name of the volume where aPath is.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4757
     Not all OperatingSystem support/use volumes; on unix,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4758
     this always returns an empty string."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4759
7102
415388639cdd changes claus
penk
parents: 7080
diff changeset
  4760
    aPathString size < 2 ifTrue:[^ ''].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4761
    (aPathString at:2) == $: ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4762
	^ (aPathString at:1) asString.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4763
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4764
    ^ ''
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4765
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4766
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4767
!Win32OperatingSystem class methodsFor:'interrupts & signals'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4768
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4769
blockingTest
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4770
    "this is a test method;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4771
     For testing double CTRL-C in blocking primitives"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4772
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4773
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4774
    while(1) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4775
	printf("blocking...");
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4776
	Sleep(50);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4777
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4778
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4779
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4780
     OperatingSystem blockingTest
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4781
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4782
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4783
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4784
blockingTest2
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4785
    "this is a test method;
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4786
     For testing double CTRL-C in blocking primitives"
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4787
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4788
%{
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4789
    while(1) {
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4790
	printf("blocking...");
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4791
	STX_API_CALL1("Sleep", Sleep, 50);
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4792
    }
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4793
%}.
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4794
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4795
     OperatingSystem blockingTest2
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4796
    "
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4797
!
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  4798
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4799
defaultSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4800
    "revert to the default action on arrival of a (Unix-)signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4801
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4802
     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
  4803
     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
  4804
     default for SIGQUIT (^ \) is to dump core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4805
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4806
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4807
     a signal."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4808
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4809
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4810
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4811
    if (__isSmallInteger(signalNumber)) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4812
#ifdef SIG_DFL
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4813
	signal(__intVal(signalNumber), SIG_DFL);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4814
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4815
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4816
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4817
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4818
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4819
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4820
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4821
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4822
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4823
    "you better save a snapshot image before trying this ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4824
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4825
     'if you hit ^C now, Smalltalk will exit immediately' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4826
     OperatingSystem defaultSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4827
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4828
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4829
     'normal ^C handling again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4830
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4831
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4832
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4833
disableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4834
    "turn off IO interrupts for a filedescriptor"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4835
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4836
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4837
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4838
     or if the OS does not support IO interrupts.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4839
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4840
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4841
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4842
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4843
disableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4844
    "disable (Unix-) signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4845
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4846
     WARNING: for some signals, it is no good idea to disable
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4847
     them; for example, disabling the SIGINT signal turns off ^C
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4848
     handling.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4849
     Also, NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4850
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4851
     a signal.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4852
     Use only for fully debugged stand alone applications."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4853
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4854
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4855
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4856
    if (__isSmallInteger(signalNumber)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4857
	int sigNo = __intVal(signalNumber);
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
	if (sigNo == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4860
	    RETURN (self);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4861
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4862
#ifdef SIG_IGN
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4863
	signal(sigNo, SIG_IGN);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4864
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4865
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4866
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4867
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4868
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4869
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4870
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4871
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4872
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4873
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4874
     'now, ^C is totally ignored ...' printNewline.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4875
     OperatingSystem disableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4876
     1 to:1000000 do:[:i| ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4877
     OperatingSystem enableSignal:(OperatingSystem sigINT).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4878
     '^C handled again.' printNewline
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4879
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4880
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4881
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4882
disableTimer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4883
    "disable timer interrupts.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4884
     WARNING:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4885
	the system will not operate correctly with timer interrupts
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  4886
	disabled, because no scheduling or timeouts are possible."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4887
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4888
%{  /* NOCONTEXT */
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
    extern void __win32ClearTimer();
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
    __win32ClearTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4893
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4894
    ^ true
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4897
enableChildSignalInterrupts
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4898
    "enable childSignal interrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4899
     (SIGCHLD, if the architecture supports it).
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  4900
     After enabling, these signals will send the message
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4901
     'childSignalInterrupt' to the ChildSignalInterruptHandler object."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4902
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4903
    self enableSignal:(self sigCHLD)
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4906
enableIOInterruptsOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4907
    "turn on IO interrupts for a filedescriptor"
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
     this error is triggered on non-integer argument
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4911
     or if the system does not support SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4912
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4913
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4914
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4915
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4916
enableSignal:signalNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4917
    "enable (Unix-)signal processing for signalNumber.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4918
     Dont confuse Unix signals with smalltalk signals.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4919
     The signal will be delivered to one of the standard handlers
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4920
     (SIGINT, SIGQUIT, etc) or to a general handler, which
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4921
     sends #signalInterrupt:.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4922
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4923
     NOTICE that signal numbers are not portable between unix
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4924
     systems - use OperatingSystem sigXXX to get the numeric value for
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4925
     a signal."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4926
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4927
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4928
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4929
#ifdef NSIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4930
# define SIG_LIMIT NSIG
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4931
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4932
# ifdef SIGUSR2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4933
#  define SIG_LIMIT SIGUSR2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4934
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4935
#  ifdef SIGUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4936
#   define SIG_LIMIT SIGUSR
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4937
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4938
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4939
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4940
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4941
#if defined(SIGPOLL) && !defined(SIGIO)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4942
# define SIGIO SIGPOLL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4943
#endif
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
#ifdef SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4946
# define CHILD_SIGNAL   SIGCHLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4947
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4948
# ifdef SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4949
#  define CHILD_SIGNAL  SIGCLD
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4950
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4951
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4952
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4953
    int sigNr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4954
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4955
#if defined(SIGINT) || defined(SIGQUIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4956
# ifndef __signalUserInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4957
    extern void __signalUserInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4958
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4959
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4960
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4961
#ifdef SIGFPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4962
# ifndef __signalFpExceptionInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4963
    extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4964
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4965
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4966
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4967
#ifdef SIGIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4968
# ifndef __signalIoInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4969
    extern void __signalIoInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4970
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4971
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4972
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4973
#ifdef CHILD_SIGNAL
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4974
# ifndef __signalChildInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4975
    extern void __signalChildInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4976
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4977
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4978
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4979
#ifdef SIGPIPE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4980
# ifndef __signalPIPEInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4981
    extern void __signalPIPEInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4982
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4983
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4984
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4985
#ifdef SIGBUS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4986
# ifndef __signalBUSInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4987
    extern void __signalBUSInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4988
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4989
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4990
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4991
#ifdef SIGSEGV
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4992
# ifndef __signalSEGVInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4993
    extern void __signalSEGVInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4994
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4995
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4996
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4997
#if defined(SIGILL) || defined(SIGEMT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4998
# ifndef __signalTrapInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  4999
    extern void __signalTrapInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5000
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5001
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5002
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5003
#ifdef SIGALRM
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5004
# ifndef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5005
#  ifndef __signalTimerInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5006
    extern void __signalTimerInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5007
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5008
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5009
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5010
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5011
#ifndef __signalInterrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5012
    extern void __signalInterrupt(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5013
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5014
    void (*handler)(SIGHANDLER_ARG);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5015
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5016
    if (__isSmallInteger(signalNumber)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5017
     && ((sigNr = __intVal(signalNumber)) >= 0)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5018
#ifdef SIG_LIMIT
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5019
     &&  (sigNr <= SIG_LIMIT)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5020
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5021
    ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5022
	/*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5023
	 * standard signals are forced into standard handlers
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5024
	 * - all others go into general signalInterrupt
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
#if defined(SIGPOLL) && defined(SIGIO)
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5027
	if (sigNr == SIGPOLL)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5028
	    sigNr = SIGIO;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5029
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5030
	switch (sigNr) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5031
	    case 0:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5032
		/* enabling a non-supported signal */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5033
		RETURN (self);
5133
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
#ifdef SIGBREAK
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5036
	    case SIGBREAK:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5037
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5038
#ifdef SIGINT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5039
	    case SIGINT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5040
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5041
#ifdef SIGQUIT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5042
	    case SIGQUIT:
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5043
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5044
#ifdef SIGNALDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5045
		printf("ConsoleSignal %d\n",sigNr);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5046
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5047
		SetConsoleCtrlHandler((PHANDLER_ROUTINE)__signalUserInterruptWIN32,TRUE);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5048
		RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5049
#ifdef SIGFPE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5050
	    case SIGFPE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5051
		handler = __signalFpExceptionInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5052
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5053
#endif
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
#ifdef SIGPIPE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5056
	    case SIGPIPE:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5057
		handler = __signalPIPEInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5058
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5059
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5060
#ifdef SIGBUS
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5061
	    case SIGBUS:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5062
		handler = __signalBUSInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5063
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5064
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5065
#ifdef SIGSEGV
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5066
	    case SIGSEGV:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5067
		handler = __signalSEGVInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5068
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5069
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5070
#ifdef SIGILL
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5071
	    case SIGILL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5072
		handler = __signalTrapInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5073
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5074
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5075
#ifdef SIGEMT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5076
	    case SIGEMT:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5077
		handler = __signalTrapInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5078
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5079
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5080
#ifdef SIGIO
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5081
	    case SIGIO:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5082
		handler = __signalIoInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5083
		break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5084
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5085
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5086
#ifdef CHILD_SIGNAL
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5087
	    case CHILD_SIGNAL:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5088
		handler = __signalChildInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5089
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5090
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5091
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5092
	    default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5093
		handler = __signalInterrupt;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5094
		break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5095
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5096
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5097
	{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5098
#ifdef HAS_SIGACTION
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5099
	    struct sigaction act;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5100
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5101
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5102
	     * 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
  5103
	     * thread switch, another thread can do a garbage collect
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5104
	     * and restarted system calls may write into old
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5105
	     * (collected) addresses.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5106
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5107
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5108
	    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
  5109
	    sigemptyset(&act.sa_mask);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5110
	    act.sa_handler = handler;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5111
	    sigaction(sigNr, &act, 0);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5112
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5113
# ifdef HAS_SIGVEC
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5114
	    struct sigvec vec;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5115
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5116
	    vec.sv_flags = SV_INTERRUPT;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5117
	    sigemptyset(&vec.sv_mask);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5118
	    vec.sv_handler = handler;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5119
	    sigvec(sigNr, &vec, NULL);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5120
# else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5121
#  ifdef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5122
#   ifdef SIGNALDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5123
	    printf("signal %d can't change handler\n",sigNr);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5124
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5125
#  else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5126
	    (void) signal(sigNr, handler);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5127
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5128
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5129
#endif
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5130
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5131
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5132
	/*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5133
	 * maybe, we should Return the old enable-status
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5134
	 * as boolean here ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5135
	 */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5136
	RETURN (self);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5137
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5138
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5139
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5140
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5141
     this error is triggered on non-integer argument, or
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5142
     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
  5143
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5144
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5145
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5146
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5147
enableTimer:milliSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5148
    "setup for a timerInterrupt, to be signalled after some (real) time."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5149
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5150
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5151
    extern void __win32SetTimer();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5152
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5153
    if (__isSmallInteger(milliSeconds)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  5154
	__win32SetTimer( __intVal(milliSeconds) );
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5155
	RETURN (true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5156
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5157
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5158
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5159
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5160
6535
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  5161
isFatalSignal:aNumber
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  5162
   "return true if a signal with number aNumber is a fatal signal,
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  5163
    i.e. some severe internal error occured"
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  5164
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  5165
   ^ (aNumber == self sigSEGV)
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  5166
     or:[aNumber == self sigILL
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  5167
     or:[aNumber == self sigBUS]]
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  5168
!
f6b834cb8c62 New: #isFatalSignal:
Stefan Vogel <sv@exept.de>
parents: 6378
diff changeset
  5169
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5170
killProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5171
    "kill a process.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5172
     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
  5173
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5174
     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
  5175
	      you have to fetch the processes exitstatus with
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5176
	      OperatingSystem>>getStatusOfProcess:aProcessId."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5177
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5178
    self terminateProcess:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5179
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5180
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5181
sendSignal:signalNumber to:processId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5182
    "send a unix signal to some process (maybe myself).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5183
     Returns false if any error occurred, true otherwise.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5184
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5185
     Do not confuse UNIX signals with Smalltalk-Signals.
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
     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
  5188
	      you may have to fetch the processes exitstatus with
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5189
	      OperatingSystem>>getStatusOfProcess:aProcessId
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5190
	      if the signal terminates that process."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5191
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
    "/ either invalid argument (non-integers)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5194
    "/ or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5195
    "/
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5196
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5197
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5198
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5199
terminateProcess:processHandle
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5200
    "terminate a process.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5201
     The process has a chance to do some cleanup.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5202
     WIN32:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5203
	 Under unix, we have terminateProcess, which does a soft
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5204
	 terminate (giving the process a chance to cleanup) and
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5205
	 killProcess, which does a hard terminate.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5206
	 Under WIN32, both (currently) use the TerminateProcess
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5207
	 function, which unconditionally causes a process to exit.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5208
	 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
  5209
	 Use it only in extreme circumstances. The state of
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5210
	 global data maintained by dynamic-link libraries (DLLs)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5211
	 may be compromised if TerminateProcess is used.
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  5212
     TODO: send it a WM_QUIT instead, to allow for proper shutdown."
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  5213
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5214
    self terminateProcess:processHandle exitCode:0
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5215
!
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5216
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5217
terminateProcess:processHandle exitCode:exitCode
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  5218
    "terminate a process.
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  5219
     The process should have a chance to do some cleanup.
7065
f4c4e4b2ffa1 checkin from browser
penk
parents: 7062
diff changeset
  5220
     WIN32:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5221
	 Under unix, we have terminateProcess, which does a soft
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5222
	 terminate (giving the process a chance to cleanup) and
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5223
	 killProcess, which does a hard terminate.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5224
	 Under WIN32, both (currently) use the TerminateProcess
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5225
	 function, which unconditionally causes a process to exit.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5226
	 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
  5227
	 Use it only in extreme circumstances. The state of
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5228
	 global data maintained by dynamic-link libraries (DLLs)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5229
	 may be compromised if TerminateProcess is used.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5230
     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
  5231
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5232
%{
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5233
    if (__isExternalAddressLike(processHandle) ) {
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5234
	HANDLE hProcess = _HANDLEVal(processHandle);
5133
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
#ifdef PROCESS1DEBUGWIN32
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5237
	printf("TerminateProcess handle: %x\n", hProcess);
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5238
#endif
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5239
	if (hProcess != 0) {
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5240
	    TerminateProcess(hProcess, __intVal(exitCode));
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5241
	} else {
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5242
	    fprintf(stderr, "Win32OS [warning]: wrong hProcess in TerminateProcess\n");
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5243
	}
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5244
    } else {
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5245
	fprintf(stderr, "Win32OS [warning]: wrong processHandle in TerminateProcess\n");
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5246
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5247
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5248
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5249
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5250
    "Modified: / 27.1.1998 / 20:05:47 / cg"
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
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5253
terminateProcessGroup:processGroupHandle
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5254
    "terminate a process group.
7645
fd98d4cfa617 terminateProcess and closePid are now two separate operations.
Claus Gittinger <cg@exept.de>
parents: 7638
diff changeset
  5255
     The processes should have a chance to do some cleanup.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5256
     WIN32:
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5257
	 The processGroup is terminated by sending it a CTRL-C
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5258
	 using GenerateConsoleCtrlEvent."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5259
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5260
%{
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5261
    if (__isExternalAddressLike(processGroupHandle) ) {
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5262
	HANDLE hProcessGroup = _HANDLEVal(processGroupHandle);
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5263
	DWORD processGroupId;
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5264
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5265
	if (hProcessGroup != (HANDLE)0) {
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5266
	    processGroupId = __intVal( ((struct __Win32OperatingSystem__Win32ProcessHandle_struct *)(processGroupHandle))->pid );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5267
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5268
#ifdef PROCESS1DEBUGWIN32
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5269
	    printf("TerminateProcessGroup processGroupHandle: %x (%d)\n", hProcessGroup, processGroupId);
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5270
#endif
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5271
	    GenerateConsoleCtrlEvent(CTRL_C_EVENT, processGroupId);
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5272
	} else {
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5273
	    fprintf(stderr, "Win32OS [warning]: wrong hProcessGroup in TerminateProcessGroup \n");
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5274
	}
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5275
    } else {
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5276
	fprintf(stderr, "Win32OS [warning]: wrong processGroupHandle in TerminateProcessGroup \n");
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  5277
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5278
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5279
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5280
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5281
!Win32OperatingSystem class methodsFor:'ipc support'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5282
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5283
makePipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5284
    "make a pipe, return array with two filedescriptors on success,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5285
     nil on failure.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5286
     This is a lowLevel entry, not for public use.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5287
     See ExternalStream>>makePipe for a more user-friendly, public interface."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5288
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5289
    |fd1 fd2|
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5290
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5291
%{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5292
    HANDLE   pipeRead  = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5293
    HANDLE   pipeWrite = (HANDLE)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5294
8667
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  5295
    SECURITY_ATTRIBUTES sa;
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  5296
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  5297
    ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  5298
    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  5299
    sa.lpSecurityDescriptor = NULL;
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  5300
    sa.bInheritHandle = TRUE;
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  5301
c5b62518d233 changed security attributes - does not make a difference
penk
parents: 8659
diff changeset
  5302
    if( ! CreatePipe( &pipeRead, &pipeWrite, &sa, 0 ) ) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  5303
	@global(LastErrorNumber) = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5304
	RETURN ( nil );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5305
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5306
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5307
#ifdef USE_HANDLES
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5308
    fd1 = __MKEXTERNALADDRESS(pipeRead);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5309
    fd2 = __MKEXTERNALADDRESS(pipeWrite);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5310
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5311
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5312
     * make fileDescriptors from handles
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5313
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5314
# ifdef PROCESSDEBUGWIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5315
    printf("piperead %x\n",pipeRead);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5316
    printf("pipewrite %x\n",pipeWrite);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5317
# endif
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  5318
    fd1 = __mkSmallInteger(_open_osfhandle(pipeRead, O_BINARY));
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  5319
    fd2 = __mkSmallInteger(_open_osfhandle(pipeWrite, O_BINARY));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5320
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5321
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5322
    fd1 notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5323
	^ Array with:fd1 with:fd2.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5324
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5325
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5326
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5327
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5328
!Win32OperatingSystem class methodsFor:'misc'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5329
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5330
closePid:pid
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5331
    "free pid resource"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5332
%{
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5333
    if (__isExternalAddressLike(pid) ) {
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5334
	HANDLE __pid = _HANDLEVal(pid);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5335
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5336
	if (__pid != 0) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5337
#ifdef PROCESSDEBUGWIN32
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5338
	    printf("Close ProcessHandle %x\n", __pid);
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5339
#endif
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  5340
	    CloseHandle(__pid);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5341
	    _HANDLEVal(pid) = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5342
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5343
    }
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
    ^ true.
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
    "Created: 28.1.1998 / 14:23:04 / md"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5348
    "Modified: 28.1.1998 / 14:27:18 / md"
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
!Win32OperatingSystem class methodsFor:'os queries'!
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
executableFileExtensions
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5354
    "return a collection of extensions for executable program files.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5355
     Only req'd for msdos like systems ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5356
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5357
    ^ #('com' 'exe')
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
    "Created: 2.5.1997 / 11:42:29 / cg"
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5362
getDomainName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5363
    "return the domain this host is in.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5364
     Notice:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5365
	not all systems support this; on some, 'unknown' is returned."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5366
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5367
    |name idx hostName k|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5368
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5369
    DomainName notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5370
	^ DomainName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5371
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5372
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5373
    name := self getEnvironment:'DOMAIN'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5374
    name isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5375
	name := self getEnvironment:'DOMAINNAME'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5376
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5377
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5378
    name isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5379
	"/ sometimes, we can extract the domainName from the hostName ...
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5380
	hostName := self primGetHostName.
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5381
	hostName notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5382
	    idx := hostName indexOf:$..
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5383
	    idx ~~ 0 ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5384
		name := hostName copyFrom:idx+1.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5385
	    ]
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5386
	].
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5387
	name isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5388
	    "/ ok, search the registry ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5389
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5390
	    "/ under NT, it is found there ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5391
	    k := RegistryEntry key:'HKEY_LOCAL_MACHINE\System'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5392
	    k notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5393
		k subKeysDo:[:subKey |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5394
		    subKey subKeysDo:[:subSubKey |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5395
			|tcp params|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5396
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5397
			(subSubKey path asLowercase endsWith:'services') ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5398
			    tcp := subSubKey subKeyNamed:'tcpip'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5399
			    tcp notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5400
				params := tcp subKeyNamed:'parameters'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5401
				params notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5402
				    name := params valueNamed:'Domain'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5403
				    params close.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5404
				].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5405
				tcp close.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5406
			    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5407
			]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5408
		    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5409
		]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5410
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5411
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5412
	name isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5413
	    "/ under Win95/Win98, it is found there ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5414
	    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
  5415
	    k notNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5416
		name := k valueNamed:'Domain'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5417
		k close.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5418
	    ]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5419
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5420
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5421
	name isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5422
	    'Win32OperatingSystem [warning]: cannot find out domainname' errorPrintCR.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5423
	    name := 'unknown'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5424
	]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5425
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5426
    DomainName := name.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5427
    ^ name
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
    "
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5430
     DomainName := nil.
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5431
     OperatingSystem getDomainName
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5432
     OperatingSystem getHostName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5433
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5434
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5435
    "Modified: 26.4.1996 / 10:04:54 / stefan"
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5438
getEnvironment:aStringOrSymbol
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5439
    "get an environment string"
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
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5442
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5443
    char *env;
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 (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5446
	char buff[512];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5447
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5448
	env = NULL;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5449
	if (GetEnvironmentVariable(__stringVal(aStringOrSymbol),
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5450
				   buff,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5451
				   sizeof(buff)-1)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5452
	    env = buff;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5453
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5454
	if (env) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5455
	    RETURN ( __MKSTRING(env) );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5456
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5457
    }
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
.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5460
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5461
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5462
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5463
     OperatingSystem getEnvironment:'LANG'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5464
     OperatingSystem getEnvironment:'LOGIN'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5465
     OperatingSystem getEnvironment:'HOME'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5466
     OperatingSystem getEnvironment:'NNTPSERVER'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5467
     OperatingSystem getEnvironment:'MAIL'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5468
     OperatingSystem getEnvironment:'PATH'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5469
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5470
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5471
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5472
getHostName
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5473
    "return the hostname we are running on - if there is
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5474
     a HOST environment variable, we are much faster here ...
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5475
     Notice:
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5476
	not all systems support this; on some, 'unknown' is returned."
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5477
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5478
    |name idx|
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5479
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5480
    HostName notNil ifTrue:[
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5481
	^ HostName
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5482
    ].
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5483
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5484
    name := self primGetHostName.
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5485
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5486
    "/ on some systems, the hostname already contains the domain.
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5487
    "/ decompose it here.
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5488
    idx := name indexOf:$..
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5489
    idx ~~ 0 ifTrue:[
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5490
	DomainName := name copyFrom:(idx+1).
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  5491
	name := name copyTo:(idx-1).
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5492
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5493
    HostName := name.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5494
    ^ name
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5495
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5496
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5497
     OperatingSystem getHostName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5498
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5499
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5500
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5501
getLanguage
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5502
    "return the domain this host is in.
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5503
     Notice:
9177
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5504
        not all systems support this; on some, 'unknown' is returned."
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5505
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5506
    |lang|
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5507
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5508
    lang := self getEnvironment:'LANG'.
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5509
    (lang isNil or:[lang = 'default']) ifTrue:[
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5510
        "/ ok, search the registry ...
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5511
        "/ under XP, it is found there ...
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5512
        lang := RegistryEntry
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5513
                    stringValueFor:'sLanguage'
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5514
                    atKey:'HKEY_CURRENT_USER\Control Panel\International'.
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5515
        lang notNil ifTrue:[
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5516
            lang := self mapLanguage:lang.
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5517
        ].
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5518
    ].
9177
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5519
    ^ lang
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5520
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5521
    "
e19dffa97449 getLanguage fix
Claus Gittinger <cg@exept.de>
parents: 9176
diff changeset
  5522
     OperatingSystem getLanguage 
7775
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5523
    "
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5524
    "Modified: 26.4.1996 / 10:04:54 / stefan"
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5525
!
7a245107a599 Get language from registry
Stefan Vogel <sv@exept.de>
parents: 7749
diff changeset
  5526
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5527
getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5528
    "return a dictionary filled with values from the locale information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5529
     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
  5530
     Possible fields are:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5531
	decimalPoint                    <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5532
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5533
	thousandsSep                    <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5534
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5535
	internationalCurrencySymbol     <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5536
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5537
	currencySymbol                  <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5538
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5539
	monetaryDecimalPoint            <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5540
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5541
	monetaryThousandsSeparator      <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5542
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5543
	positiveSign                    <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5544
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5545
	negativeSign                    <String>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5546
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5547
	internationalFractionalDigits   <Integer>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5548
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5549
	fractionalDigits                <Integer>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5550
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5551
	positiveSignPrecedesCurrencySymbol      <Boolean>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5552
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5553
	negativeSignPrecedesCurrencySymbol      <Boolean>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5554
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5555
	positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5556
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5557
	negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5558
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5559
	positiveSignPosition                            <Symbol>
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5560
							one of: #parenthesesAround,
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5561
								#signPrecedes,
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5562
								#signSuceeds,
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5563
								#signPrecedesCurrencySymbol,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5564
								#signSuceedsCurrencySymbol
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5565
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5566
	negativeSignPosition                            <like above>
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5567
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5568
     it is up to the application to deal with undefined values.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5569
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5570
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5571
     it should be used by applications as required.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5572
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5573
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5574
    |info val|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5575
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5576
    LocaleInfo notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5577
	"/ 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
  5578
	"/ support this.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5579
	^ LocaleInfo
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5580
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5581
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5582
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5583
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5584
    char *decimalPoint;         /* something like "." (US) or "," (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5585
    char *thousandsSep;         /* something like "," (US) or "." (german) */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5586
    char *intCurrencySymbol;    /* international currency symbol; something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5587
    char *currencySymbol;       /* local currency symbol;         something like "USD "  "DM  " */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5588
    char *monDecimalPoint;      /* money: decimal point */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5589
    char *monThousandsSep;      /* money: thousands sep */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5590
    char *positiveSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5591
    char *negativeSign;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5592
    int   intFractDigits;       /* money: international digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5593
    int   fractDigits;          /* money: local digits after decPoint */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5594
    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
  5595
    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
  5596
    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
  5597
    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
  5598
    int   csPosSignPosition;    /* money: 0: ()'s around the value & currency symbol */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5599
    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
  5600
				/*        2: sign succeeds the value & currency symbol */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5601
				/*        3: sign immediately precedes the currency symbol */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5602
				/*        4: sign immediately suceeds the currency symbol */
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5603
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5604
#if defined(HAS_LOCALECONV)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5605
    struct lconv *conf;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5606
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5607
    conf = localeconv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5608
    if (conf) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5609
	decimalPoint = conf->decimal_point;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5610
	thousandsSep = conf->thousands_sep;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5611
	intCurrencySymbol = conf->int_curr_symbol;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5612
	currencySymbol = conf->currency_symbol;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5613
	monDecimalPoint = conf->mon_decimal_point;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5614
	monThousandsSep = conf->mon_thousands_sep;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5615
	positiveSign = conf->positive_sign;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5616
	negativeSign = conf->negative_sign;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5617
	intFractDigits = conf->int_frac_digits;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5618
	fractDigits = conf->frac_digits;
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5619
	csPosPrecedes = conf->p_cs_precedes;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5620
	csNegPrecedes = conf->n_cs_precedes;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5621
	csPosSepBySpace = conf->p_sep_by_space;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5622
	csNegSepBySpace = conf->n_sep_by_space;
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5623
	csPosSignPosition = conf->p_sign_posn;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5624
	csNegSignPosition = conf->n_sign_posn;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5625
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5626
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5627
    decimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5628
    thousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5629
    intCurrencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5630
    currencySymbol = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5631
    monDecimalPoint = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5632
    monThousandsSep = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5633
    positiveSign =  (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5634
    negativeSign =(char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5635
    intFractDigits = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5636
    fractDigits = -1;
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5637
    csPosPrecedes = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5638
    csNegPrecedes = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5639
    csPosSepBySpace = -1;
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5640
    csNegSepBySpace = -1;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5641
    csPosSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5642
    csNegSignPosition = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5643
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5644
    if (decimalPoint) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5645
	val = __MKSTRING(decimalPoint);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5646
	__AT_PUT_(info, @symbol(decimalPoint), val);
5133
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
    if (thousandsSep) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5649
	val = __MKSTRING(thousandsSep);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5650
	__AT_PUT_(info, @symbol(thousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5651
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5652
    if (intCurrencySymbol) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5653
	val = __MKSTRING(intCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5654
	__AT_PUT_(info, @symbol(internationCurrencySymbol), val);
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
    if (currencySymbol) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5657
	val = __MKSTRING(currencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5658
	__AT_PUT_(info, @symbol(currencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5659
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5660
    if (monDecimalPoint) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5661
	val = __MKSTRING(monDecimalPoint);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5662
	__AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5663
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5664
    if (monThousandsSep) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5665
	val = __MKSTRING(monThousandsSep);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5666
	__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5667
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5668
    if (positiveSign) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5669
	val = __MKSTRING(positiveSign);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5670
	__AT_PUT_(info, @symbol(positiveSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5671
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5672
    if (negativeSign) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5673
	val = __MKSTRING(negativeSign);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5674
	__AT_PUT_(info, @symbol(negativeSign), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5675
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5676
    if (intFractDigits >= 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  5677
	__AT_PUT_(info, @symbol(internationalFractionalDigits),  __mkSmallInteger(intFractDigits));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5678
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5679
    if (fractDigits >= 0) {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  5680
	__AT_PUT_(info, @symbol(fractionalDigits),  __mkSmallInteger(fractDigits));
5133
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
    if (csPosPrecedes >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5683
	if (csPosPrecedes == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5684
	    val = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5685
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5686
	    val = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5687
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5688
	__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5689
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5690
    if (csNegPrecedes >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5691
	if (csNegPrecedes == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5692
	    val = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5693
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5694
	    val = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5695
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5696
	__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5697
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5698
    if (csPosSepBySpace >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5699
	if (csPosSepBySpace == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5700
	    val = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5701
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5702
	    val = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5703
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5704
	__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5705
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5706
    if (csNegSepBySpace >= 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5707
	if (csNegSepBySpace == 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5708
	    val = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5709
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5710
	    val = true;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5711
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5712
	__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5713
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5714
    switch (csPosSignPosition) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5715
	case 0:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5716
	    val = @symbol(parenthesesAround);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5717
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5718
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5719
	case 1:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5720
	    val = @symbol(signPrecedes);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5721
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5722
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5723
	case 2:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5724
	    val = @symbol(signSuceeds);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5725
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5726
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5727
	case 3:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5728
	    val = @symbol(signPrecedesCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5729
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5730
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5731
	case 4:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5732
	    val = @symbol(signSuceedsCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5733
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5734
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5735
	default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5736
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5737
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5738
    if (val != nil) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5739
	__AT_PUT_(info, @symbol(positiveSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5740
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5741
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5742
    switch (csNegSignPosition) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5743
	case 0:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5744
	    val = @symbol(parenthesesAround);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5745
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5746
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5747
	case 1:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5748
	    val = @symbol(signPrecedes);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5749
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5750
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5751
	case 2:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5752
	    val = @symbol(signSuceeds);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5753
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5754
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5755
	case 3:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5756
	    val = @symbol(signPrecedesCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5757
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5758
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5759
	case 4:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5760
	    val = @symbol(signSuceedsCurrencySymbol);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5761
	    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5762
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5763
	default:
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5764
	    val = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5765
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5766
    if (val != nil) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5767
	__AT_PUT_(info, @symbol(negativeSignPosition), val);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5768
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5769
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5770
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5771
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
     OperatingSystem getLocaleInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5774
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5775
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5776
    "Created: 23.12.1995 / 14:19:20 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5777
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5778
7287
b10efc6c9407 Fix spelling (getNetworkMACAddresses)
Stefan Vogel <sv@exept.de>
parents: 7199
diff changeset
  5779
getNetworkMACAddresses
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5780
    "return a dictionary filled with
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5781
	key -> name of interface
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5782
	value -> the MAC adress (as ByteArray)
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5783
     for each interface
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5784
    "
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5785
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5786
    |info nAdapters rawData entry
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5787
     name description macAddress ipAddress ipAddressMask|
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5788
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5789
    rawData := Array new:50.
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5790
%{
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5791
#ifndef NO_GETADAPTERSINFO
8319
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  5792
/*
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  5793
 * temporary undef String to avoid a #define-conflict
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  5794
 * between ST/X's String and Windows String typedef
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  5795
 */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5796
# undef String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5797
# undef Context
8319
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  5798
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5799
    IP_ADAPTER_INFO AdapterInfo[32];
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5800
    DWORD dwBufLen = sizeof(AdapterInfo);
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5801
    DWORD dwStatus;
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5802
    static FARPROC entry2 = NULL;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5803
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5804
    /*
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5805
     * Attention: GetAdaptersInfo is not available on old NT4.0/W95/W98
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5806
     */
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5807
#ifdef NO_NT4_0_COMPATIBILITY
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5808
    entry2 = (FARPROC) GetAdaptersInfo;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5809
#else
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5810
    if (entry2 == NULL) {
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5811
	entry2 = __get_iphlpapi_functionAddress("GetAdaptersInfo");
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5812
    }
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5813
#endif /* NO_NT4_0_COMPATIBILITY */
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5814
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5815
    if (entry2) {
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5816
	dwStatus = (*entry2)(
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5817
				AdapterInfo,                 // [out] buffer to receive data
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5818
				&dwBufLen);                  // [in] size of receive data buffer
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5819
	if (dwStatus == ERROR_SUCCESS) {
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5820
	    PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5821
	    unsigned char *bP;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5822
	    int nA = 0;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5823
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5824
	    bP = __byteArrayVal(rawData);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5825
	    do {
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5826
		name = __MKSTRING(pAdapterInfo->AdapterName);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5827
		description = __MKSTRING(pAdapterInfo->Description);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5828
		macAddress = __MKBYTEARRAY(pAdapterInfo->Address, 6);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5829
		ipAddress = __MKSTRING(pAdapterInfo->IpAddressList.IpAddress.String);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5830
		ipAddressMask = __MKSTRING(pAdapterInfo->IpAddressList.IpMask.String);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5831
		entry = __ARRAY_NEW_INT(5);
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5832
/*
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5833
 * back to ST/X's String definition
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5834
 */
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5835
# ifdef __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5836
#  define String __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5837
# endif
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5838
# ifdef __DEF_String
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5839
#  define Context __DEF_Context
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5840
# endif
8654
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5841
		__ArrayInstPtr(entry)->a_element[0] = name; __STORE(entry, name);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5842
		__ArrayInstPtr(entry)->a_element[1] = description; __STORE(entry, description);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5843
		__ArrayInstPtr(entry)->a_element[2] = macAddress; __STORE(entry, macAddress);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5844
		__ArrayInstPtr(entry)->a_element[3] = ipAddress; __STORE(entry, ipAddress);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5845
		__ArrayInstPtr(entry)->a_element[4] = ipAddressMask; __STORE(entry, ipAddressMask);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5846
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5847
		__ArrayInstPtr(rawData)->a_element[nA] = entry; __STORE(rawData, entry);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5848
		nA++;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5849
		pAdapterInfo = pAdapterInfo->Next;
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5850
	    } while(pAdapterInfo);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5851
	    nAdapters = __mkSmallInteger(nA);
872098a9943e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8653
diff changeset
  5852
	}
8319
2d179dc8dc3f Fix #getNetworkMACAdress for XP/2k
Claus Gittinger <cg@exept.de>
parents: 8270
diff changeset
  5853
    }
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  5854
#endif /* NO_GETADAPTERSINFO */
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5855
%}.
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5856
    info := Dictionary new.
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5857
    nAdapters notNil ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5858
	1 to:nAdapters do:[:i |
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  5859
	    |entry name description macAddr ipAddr|
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5860
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5861
	    entry := rawData at:i.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5862
	    name := entry at:1.
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  5863
	    "/ description := entry at:2.
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5864
	    macAddr := entry at:3.
8843
373303414c54 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8800
diff changeset
  5865
	    "/ ipAddr := entry at:4.
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5866
	    info at:name put:macAddr.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5867
	].
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5868
    ].
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5869
    ^ info
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5870
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5871
    "
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5872
     OperatingSystem getNetworkMACAddresses
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  5873
    "
6542
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5874
!
ecfe70e462fe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6535
diff changeset
  5875
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5876
getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5877
    "return the (unix-)processId"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5878
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5879
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5880
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5881
    int pid = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5882
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5883
    pid = GetCurrentProcessId() & 0x3FFFFFFF;
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  5884
    RETURN ( __mkSmallInteger(pid) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5885
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5886
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5887
     OperatingSystem getProcessId
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5888
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5889
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5890
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5891
getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5892
    "if supported by the OS, return the systemID;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5893
     a unique per machine identification.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5894
     WARNING:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5895
	not all systems support this; on some, 'unknown' is returned."
5133
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
%{  /* NO_CONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5898
#if defined(HAS_GETHOSTID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5899
    int runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5900
    OBJ arr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5901
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5902
    runningId = gethostid();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5903
    arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5904
    *(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5905
    RETURN (arr);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5906
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5907
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5908
    {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5909
	char buffer[128];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5910
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5911
	buffer[0] = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5912
	if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5913
	    buffer[127] = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5914
	    if (strlen(buffer) > 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5915
		RETURN(__MKSTRING(buffer));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5916
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  5917
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5918
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5919
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5920
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5921
    ^ 'unknown'
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5924
     OperatingSystem getSystemID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5925
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5926
!
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
getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5929
    "return info on the system weare running on.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5930
     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
  5931
     otherwise, some simulated info is returned.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5932
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5933
     WARNING:
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5934
       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
  5935
       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
  5936
       OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5937
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5938
       This method is mainly provided to augment error reports with some system
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  5939
       information.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5940
       (in case of system/version specific OS errors, conditional workarounds and patches
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5941
	may be based upon this info).
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5942
       Your application should NOT depend upon this in any way.
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
     The returned info may (or may not) contain:
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5945
	#system -> some operating system identification (irix, Linux, nt, win32s ...)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5946
	#version -> OS version (some os version identification)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5947
	#release -> OS release (3.5, 1.2.1 ...)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5948
	#node   -> some host identification (hostname)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5949
	#domain  -> domain name (hosts domain)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5950
	#machine -> type of machine (i586, mips ...)
5133
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
     win32:
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5953
	#physicalRam -> total amount of physical memory
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5954
	#freeRam -> amount of free memory
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5955
	#swapSize -> size of swapSpace (page file)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5956
	#freeSwap -> free bytes in swapSpace
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5957
	#virtualRam -> total amount of virtual memory
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5958
	#freeVirtual -> amount of free virtual memory
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5959
	#memoryLoad -> percentage of memory usage (useless)
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5960
    "
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5961
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5962
    |sys node rel ver mach dom info arch
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5963
     physicalRam freeRam swapSize freeSwap
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  5964
     virtualRam freeVirtual memoryLoad numberOfCPUs|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5965
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5966
%{  /* STACK: 4096 */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5967
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5968
    char vsnBuffer[32];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5969
    char *s;
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5970
    int winVer, verMinor, verMajor;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5971
    DWORD vsn;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5972
    SYSTEM_INFO sysInfo;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5973
    MEMORYSTATUS memStatus;
8416
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  5974
    int len;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5975
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5976
    vsn = GetVersion();
6740
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5977
    winVer = LOWORD(vsn);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5978
    verMinor = HIBYTE(winVer);
809af7f7f2b9 getSystemInfo: knows about XP
Claus Gittinger <cg@exept.de>
parents: 6726
diff changeset
  5979
    verMajor = LOBYTE(winVer);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5980
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5981
    if (HIWORD(vsn) & 0x8000) {
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5982
	s = "win95";
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5983
    } else {
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5984
	if ((verMajor > 5)
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5985
	 || ((verMajor == 5) && (verMinor >= 1))) {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5986
	    s = "xp";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5987
	} else {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5988
	    s = "nt";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  5989
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5990
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5991
    sys = __MKSTRING(s);
8416
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  5992
    len = snprintf(vsnBuffer, sizeof(vsnBuffer), "%d.%d", verMajor, verMinor);
77f3289fc2c7 Use snprintf for security (paranoia)
Stefan Vogel <sv@exept.de>
parents: 8412
diff changeset
  5993
    rel = __MKSTRING_L(vsnBuffer, len);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5994
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5995
    GetSystemInfo(&sysInfo);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5996
    memStatus.dwLength = sizeof(memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5997
    GlobalMemoryStatus(&memStatus);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5998
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  5999
    memoryLoad = __MKUINT(memStatus.dwMemoryLoad);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6000
    physicalRam = __MKUINT(memStatus.dwTotalPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6001
    freeRam = __MKUINT(memStatus.dwAvailPhys);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6002
    swapSize = __MKUINT(memStatus.dwTotalPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6003
    freeSwap = __MKUINT(memStatus.dwAvailPageFile);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6004
    virtualRam = __MKUINT(memStatus.dwTotalVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6005
    freeVirtual = __MKUINT(memStatus.dwAvailVirtual);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6006
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6007
#if defined(__BORLANDC__) && (__BORLANDC__ <= 1339)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6008
    /* BorlandC3 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6009
    switch (sysInfo.u.s.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6010
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6011
    /* MSC, BorlandC4 ... */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6012
    switch (sysInfo.wProcessorArchitecture)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6013
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6014
    {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6015
#ifdef PROCESSOR_ARCHITECTURE_INTEL
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6016
	case PROCESSOR_ARCHITECTURE_INTEL:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6017
	    s = "intel";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6018
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6019
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6020
#ifdef PROCESSOR_ARCHITECTURE_MIPS
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6021
	case PROCESSOR_ARCHITECTURE_MIPS:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6022
	    s = "mips";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6023
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6024
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6025
#ifdef PROCESSOR_ARCHITECTURE_ALPHA
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6026
	case PROCESSOR_ARCHITECTURE_ALPHA:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6027
	    s = "alpha";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6028
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6029
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6030
#ifdef PROCESSOR_ARCHITECTURE_ALPHA64
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6031
	case PROCESSOR_ARCHITECTURE_ALPHA64:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6032
	    s = "alpha64";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6033
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6034
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6035
#ifdef PROCESSOR_ARCHITECTURE_PPC
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6036
	case PROCESSOR_ARCHITECTURE_PPC:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6037
	    s = "ppc";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6038
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6039
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6040
#ifdef PROCESSOR_ARCHITECTURE_ARM
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6041
	case PROCESSOR_ARCHITECTURE_ARM:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6042
	    s = "arm";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6043
	    break;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6044
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6045
#ifdef PROCESSOR_ARCHITECTURE_SHX
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6046
	case PROCESSOR_ARCHITECTURE_SHX:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6047
	    s = "shx";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6048
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6049
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6050
#ifdef PROCESSOR_ARCHITECTURE_IA64
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6051
	case PROCESSOR_ARCHITECTURE_IA64:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6052
	    s = "ia64";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6053
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6054
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6055
#ifdef PROCESSOR_ARCHITECTURE_MSIL
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6056
	case PROCESSOR_ARCHITECTURE_MSIL:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6057
	    s = "msil";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6058
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6059
#endif
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6060
	default:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6061
	    s = "unknown";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6062
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6063
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6064
    arch = __MKSTRING(s);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6065
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6066
    switch (sysInfo.dwProcessorType) {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6067
#ifdef PROCESSOR_INTEL_386
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6068
	case PROCESSOR_INTEL_386:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6069
	    s = "i386";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6070
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6071
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6072
#ifdef PROCESSOR_INTEL_486
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6073
	case PROCESSOR_INTEL_486:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6074
	    s = "i486";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6075
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6076
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6077
#ifdef PROCESSOR_INTEL_PENTIUM
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6078
	case PROCESSOR_INTEL_PENTIUM:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6079
	    s = "i586";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6080
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6081
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6082
#ifdef PROCESSOR_INTEL_860
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6083
	case PROCESSOR_INTEL_860:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6084
	    s = "i860";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6085
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6086
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6087
#ifdef PROCESSOR_INTEL_IA64
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6088
	case PROCESSOR_INTEL_IA64:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6089
	    s = "ia64";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6090
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6091
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6092
#ifdef PROCESSOR_MIPS_R2000
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6093
	case PROCESSOR_MIPS_R2000:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6094
	    s = "r2000";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6095
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6096
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6097
#ifdef PROCESSOR_MIPS_R3000
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6098
	case PROCESSOR_MIPS_R3000:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6099
	    s = "r3000";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6100
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6101
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6102
#ifdef PROCESSOR_MIPS_R4000
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6103
	case PROCESSOR_MIPS_R4000:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6104
	    s = "r4000";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6105
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6106
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6107
#ifdef PROCESSOR_ALPHA_21064
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6108
	case PROCESSOR_ALPHA_21064:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6109
	    s = "alpha21064";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6110
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6111
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6112
#ifdef PROCESSOR_ARM720
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6113
	case PROCESSOR_ARM720:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6114
	    s = "arm720";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6115
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6116
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6117
#ifdef PROCESSOR_ARM820
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6118
	case PROCESSOR_ARM820:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6119
	    s = "arm820";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6120
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6121
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6122
#ifdef PROCESSOR_ARM920
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6123
	case PROCESSOR_ARM920:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6124
	    s = "arm920";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6125
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6126
#endif
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6127
#ifdef PROCESSOR_ARM_7TDMI
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6128
	case PROCESSOR_ARM_7TDMI:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6129
	    s = "arm70001";
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6130
	    break;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6131
#endif
8901
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6132
#ifdef PROCESSOR_PPC_601
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6133
	case PROCESSOR_PPC_601:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6134
	    s = "ppc601";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6135
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6136
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6137
#ifdef PROCESSOR_PPC_603
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6138
	case PROCESSOR_PPC_603:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6139
	    s = "ppc603";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6140
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6141
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6142
#ifdef PROCESSOR_PPC_604
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6143
	case PROCESSOR_PPC_604:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6144
	    s = "ppc604";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6145
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6146
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6147
#ifdef PROCESSOR_PPC_620
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6148
	case PROCESSOR_PPC_620:
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6149
	    s = "ppc620";
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6150
	    break;
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6151
#endif
824a89d0b5c7 alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents: 8889
diff changeset
  6152
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6153
	default:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6154
	    sprintf(vsnBuffer, "%d", sysInfo.dwProcessorType);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6155
	    s = vsnBuffer;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6156
	    break;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6157
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6158
    mach = __MKSTRING(s);
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  6159
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  6160
    numberOfCPUs = __MKUINT(sysInfo.dwNumberOfProcessors);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6161
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6162
    sys isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6163
	sys := self getSystemType.
5133
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
    node isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6166
	node := self getHostName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6167
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6168
    dom isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6169
	dom := self getDomainName.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6170
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6171
    mach isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6172
	mach := self getCPUType.
5133
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
    arch isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6175
	arch := 'unknown'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6176
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6177
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6178
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6179
    info at:#system put:sys.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6180
    info at:#node put:node.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6181
    rel notNil ifTrue:[info at:#release put:rel].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6182
    ver notNil ifTrue:[info at:#version put:ver].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  6183
    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
  6184
    arch notNil ifTrue:[info at:#architecture put:arch].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6185
    dom notNil ifTrue:[info at:#domain put:dom].
7860
d08a47772aa1 *** empty log message ***
ca
parents: 7852
diff changeset
  6186
    numberOfCPUs notNil ifTrue:[info at:#numberOfCPUs put:numberOfCPUs].
5133
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
    info at:#memoryLoad put:memoryLoad.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6189
    info at:#physicalRam put:physicalRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6190
    info at:#freeRam put:freeRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6191
    info at:#swapSize put:swapSize.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6192
    info at:#freeSwap put:freeSwap.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6193
    info at:#virtualRam put:virtualRam.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6194
    info at:#freeVirtual put:freeVirtual.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6195
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6196
    info at:#osType put:(self getOSType).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6197
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6198
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
     OperatingSystem getSystemInfo
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6201
    "
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
getSystemType
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6205
    "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
  6206
     This is almost the same as getOSType, but the returned string
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6207
     is slightly different for some systems (i.e. iris vs. irix).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6208
     Dont depend on this - use getOSType. I dont really see a point
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6209
     here ...
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6210
     (except for slight differences between next/mach and other machs)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6211
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6212
    ^ 'win32'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6213
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6214
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6215
     OperatingSystem getSystemType
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
!
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
getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6220
    "internal interface - only for Windows based systems.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6221
     Return the windows directory
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6222
     (which - depending on the system - may be \WINNT, \WINDOWS or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6223
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6224
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6225
%{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6226
    char buffer[MAXPATHLEN];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6227
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6228
    if (GetWindowsDirectory(buffer, MAXPATHLEN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6229
	RETURN (__MKSTRING(buffer));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6230
    }
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
    ^ nil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6233
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
     OperatingSystem getWindowsDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6236
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6237
!
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
getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6240
    "internal interface - only for Windows based systems.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6241
     Return the windows system directory
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6242
     (which - depending on the system - may be \WINNT\SYSTEM32,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6243
      \WINDOWS\SYSTEM or whatever)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6244
     On non-windows systems, nil is returned."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6245
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6246
%{
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6247
    char buffer[MAXPATHLEN];
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
    if (GetSystemDirectory(buffer, MAXPATHLEN)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6250
	RETURN (__MKSTRING(buffer));
5133
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
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6253
    ^ nil
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6256
     OperatingSystem getWindowsSystemDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6257
    "
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6260
hasConsole
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6261
    "return true, if there is some kind of console available
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6262
     (i.e. for proper stdIn, stdOut and stdErr handling).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6263
     This only returns false when running únder windows, and
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6264
     the system is running as a pure windows application.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6265
     If false, the miniDebugger is useless and not used."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6266
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6267
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6268
    extern int __getNoConsoleFlag();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6269
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6270
    RETURN ( __getNoConsoleFlag() ? false : true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6271
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6272
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6273
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6274
isMSDOSlike
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6275
    "return true, if the OS we're running on is msdos like
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6276
     (in contrast to unix-like or vms-like).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6277
     This returns true for any of msdos, win32s, win95,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6278
     winNT and os/2."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6279
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6280
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6281
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6282
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6283
isMSWINDOWSNTlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6284
    "This returns true if running in a Windows-NT system."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6285
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6286
%{   /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6287
     if (__isWinNT)
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6288
	RETURN(true);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6289
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6290
     ^ false.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6291
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6292
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6293
isMSWINDOWSlike
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6294
    "return true, if running on a MS-Windows like system.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6295
     This returns true for any of win32s, win95 and winNT."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6296
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6297
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6298
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6299
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6300
maxFileNameLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6301
    "return the max number of characters in a filename.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6302
     CAVEAT:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6303
	 Actually, the following is somewhat wrong - some systems
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6304
	 support different sizes, depending on the volume.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6305
	 We return a somewhat conservative number here.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6306
	 Another entry, to query for volume specific max
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6307
	 will be added in the future."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6308
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6309
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6310
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6311
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6312
     * TODO: newer systems provide a query function for this ... use it
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6313
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6314
     /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6315
      * mhmh - depends on the filesystem type
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6316
      */
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  6317
     RETURN ( __mkSmallInteger(MAXFILELEN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6318
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6319
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6320
     OperatingSystem maxFileNameLength
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6321
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6322
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6323
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6324
maxPathLength
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6325
    "return the max number of characters in a pathName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6326
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6327
%{  /* NOCONTEXT */
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  6328
    RETURN ( __mkSmallInteger(MAXPATHLEN) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6329
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6330
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6331
     OperatingSystem maxPathLength
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6332
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6333
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6334
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6335
pathSeparator
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6336
    "return the character which separates items in the PATH variable"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6337
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6338
    ^ $;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6339
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6340
    "Created: 2.5.1997 / 11:36:47 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6341
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6342
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6343
platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6344
    "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
  6345
     This returns #unix for all unix derivatives,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6346
     #os2, #win32, #vms or #mac for the others.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6347
     I.e. it is much less specific than getOSType or getSystemType."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6348
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6349
    ^ #win32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6350
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6351
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6352
     OperatingSystem platformName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6353
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6354
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6355
    "Modified: 20.6.1997 / 17:37:26 / cg"
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
7158
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6358
primGetDomainName
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6359
%{
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6360
#if 0   /* not needed */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6361
    HINSTANCE hNetApi32 = LoadLibrary("netapi32.dll");
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6362
    DWORD (__stdcall *pfnNetApiBufferFree)(LPVOID Buffer);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6363
    DWORD (__stdcall *pfnNetWkstaGetInfo)(LPWSTR servername, DWORD level, void *bufptr);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6364
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6365
    if (hNetApi32) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6366
	pfnNetApiBufferFree = (DWORD (__stdcall *)(void *)) GetProcAddress(hNetApi32, "NetApiBufferFree");
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6367
	pfnNetWkstaGetInfo = (DWORD (__stdcall *)(LPWSTR, DWORD, void *)) GetProcAddress(hNetApi32, "NetWkstaGetInfo");
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6368
    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6369
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6370
    if (hNetApi32 && pfnNetWkstaGetInfo && pfnNetApiBufferFree) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6371
	/* this way is more reliable, in case user has a local account. */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6372
	char dname[256];
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6373
	DWORD dnamelen = sizeof(dname);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6374
	struct {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6375
	    DWORD   wki100_platform_id;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6376
	    LPWSTR  wki100_computername;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6377
	    LPWSTR  wki100_langroup;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6378
	    DWORD   wki100_ver_major;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6379
	    DWORD   wki100_ver_minor;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6380
	} *pwi;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6381
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6382
	/* NERR_Success *is* 0*/
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6383
	if (0 == pfnNetWkstaGetInfo(NULL, 100, &pwi)) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6384
	    if (pwi->wki100_langroup && *(pwi->wki100_langroup)) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6385
		WideCharToMultiByte(CP_ACP, NULL, pwi->wki100_langroup,
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6386
				    -1, (LPSTR)dname, dnamelen, NULL, NULL);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6387
	    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6388
	    else {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6389
		WideCharToMultiByte(CP_ACP, NULL, pwi->wki100_computername,
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6390
				    -1, (LPSTR)dname, dnamelen, NULL, NULL);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6391
	    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6392
	    pfnNetApiBufferFree(pwi);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6393
	    FreeLibrary(hNetApi32);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6394
	    RETURN (__MKSTRING(dname));
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6395
	}
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6396
	FreeLibrary(hNetApi32);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6397
    } else {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6398
	/* Win95 doesn't have NetWksta*(), so do it the old way */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6399
	char name[256];
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6400
	DWORD size = sizeof(name);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6401
	if (hNetApi32)
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6402
	    FreeLibrary(hNetApi32);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6403
	if (GetUserName(name,&size)) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6404
	    char sid[1024];
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6405
	    DWORD sidlen = sizeof(sid);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6406
	    char dname[256];
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6407
	    DWORD dnamelen = sizeof(dname);
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6408
	    SID_NAME_USE snu;
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6409
	    if (LookupAccountName(NULL, name, (PSID)&sid, &sidlen,
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6410
				  dname, &dnamelen, &snu)) {
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6411
		RETURN (__MKSTRING(dname));             /* all that for this */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6412
	    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6413
	}
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6414
    }
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6415
#endif /* not needed */
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6416
%}.
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6417
    ^ nil
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6418
!
2fd29d71796d Apply ca-changes of AbstractOperatingSystem
penk
parents: 7118
diff changeset
  6419
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6420
primGetHostName
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6421
    "return the hostname we are running on - if there is
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6422
     a HOST environment variable, we are much faster here ...
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6423
     Notice:
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6424
	not all systems support this; on some, 'unknown' is returned."
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6425
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6426
    |name|
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6427
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6428
%{  /* STACK: 2048 */
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6429
#if defined(HAS_GETHOSTNAME)
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6430
    char buffer[256];
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6431
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6432
    if (gethostname(buffer, sizeof(buffer)) == 0) {
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6433
	name = __MKSTRING(buffer);
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6434
    }
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6435
#else
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6436
    char buffer[128];
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
  6437
    DWORD buffSize = sizeof(buffer);
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6438
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6439
    if (GetComputerName(buffer, &buffSize) == TRUE) {
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6440
	name = __MKSTRING(buffer);
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6441
    }
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6442
#endif
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6443
%}.
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6444
    name isNil ifTrue:[
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6445
	name := self getEnvironment:'HOST'.
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6446
	name isNil ifTrue:[
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6447
	    name := self getEnvironment:'HOSTNAME'.
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6448
	    name isNil ifTrue:[
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6449
		name := self getEnvironment:'COMPUTERNAME'.
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6450
		name isNil ifTrue:[
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6451
		    'Win32OperatingSystem [warning]: cannot find out hostname' errorPrintCR.
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6452
		    name := 'unknown'.
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6453
		]
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6454
	    ]
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6455
	]
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6456
    ].
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6457
    ^ name
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6458
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6459
    "
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6460
     OperatingSystem primGetHostName
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6461
    "
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6462
!
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6463
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6464
setLocaleInfo:anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6465
    "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
  6466
     (internal in ST/X only - the OS's settings remain unaffected)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6467
     See description of fields in #getLocaleInfo.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6468
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6469
     Notice, that (for now), the system does not use this information;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6470
     it should be used by applications as required."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6471
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6472
    LocaleInfo := anInfoDictionary
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6473
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6474
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6475
     |d|
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
     d := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6478
     d at:#decimalPoint                 put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6479
     d at:#thousandsSeparator           put:','         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6480
     d at:#currencySymbol               put:'USD'       .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6481
     d at:#monetaryDecimalPoint         put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6482
     d at:#monetaryThousandsSeparator   put:'.'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6483
     d at:#fractionalDigits             put:2           .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6484
     d at:#positiveSign                 put:'+'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6485
     d at:#negativeSign                 put:'-'         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6486
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6487
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6488
     OperatingSystem setLocaleInfo:d
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6489
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6490
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6491
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6492
supportsChildInterrupts
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6493
    "return true, if the OS supports childProcess termination signalling
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6494
     through interrupts (i.e. SIGCHILD)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6495
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6496
%{  /* NOCONTEXT */
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6497
#if defined(SIGCHLD) || defined(SIGCLD)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6498
    RETURN (true);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6499
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6500
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6501
    ^ false
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
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6504
     OperatingSystem supportsChildInterrupts
5133
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
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6507
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6508
supportsFileOwnerGroups
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6509
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6510
     group ownership - all OS's except windows do"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6511
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6512
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6513
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6514
    "Created: / 10.9.1998 / 17:57:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6515
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6516
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6517
supportsFileOwners
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6518
    "return true, if the OS's file system supports file
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6519
     ownership - all OS's except windows do"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6520
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6521
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6522
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6523
    "Created: / 10.9.1998 / 17:55:16 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6524
    "Modified: / 10.9.1998 / 17:57:11 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6525
!
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
supportsIOInterrupts
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6528
    "return true, if the OS supports IO availability interrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6529
     (i.e. SIGPOLL/SIGIO).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6530
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6531
     Currently, this mechanism does not work on all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6532
     systems ...
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
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6536
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6537
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6538
     OperatingSystem supportsIOInterrupts
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6539
    "
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6542
supportsNonBlockingIO
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6543
    "return true, if the OS supports nonblocking IO."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6544
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6545
    ^ false
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
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6548
     OperatingSystem supportsNonBlockingIO
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6549
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6550
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6551
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6552
supportsSelect
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6553
    "return true, if the OS supports selecting on multiple
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6554
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6555
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6556
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6557
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6558
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6559
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6560
# if defined(WIN32S)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6561
    RETURN (false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6562
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6563
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6564
    ^ true
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6567
     OperatingSystem supportsSelect
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
!
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
supportsSelectOnPipes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6572
    "return true, if the OS supports selecting on pipe
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6573
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6574
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6575
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6576
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6577
    ^ false
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
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6580
     OperatingSystem supportsSelectOnPipes
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6581
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6582
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6583
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6584
    "Created: / 14.12.1999 / 19:43:13 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6585
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6586
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6587
supportsSelectOnSockets
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6588
    "return true, if the OS supports selecting on socket
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6589
     filedescriptors via select.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6590
     If false is returned, ProcessorScheduler will poll in 50ms
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6591
     intervals for I/O becoming ready."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6592
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6593
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6594
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6595
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6596
     OperatingSystem supportsSelectOnSockets
5133
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
    "Modified: / 14.12.1999 / 19:41:03 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6600
!
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
supportsVolumes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6603
    "return true, if the OS supports disk volumes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6604
     False is returned for UNIX, true for MSDOS and VMS"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6605
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6606
    ^ true
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6607
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6608
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6609
!Win32OperatingSystem class methodsFor:'path queries'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6610
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6611
defaultPackagePath
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6612
    |pPath pkgDirPath dirs p|
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6613
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6614
    pPath := super defaultPackagePath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6615
    pkgDirPath := self stxPackageDirPath.
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6616
    pkgDirPath notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6617
	"/ and also add the packageDirPath from the registry ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6618
	dirs := pkgDirPath asCollectionOfSubstringsSeparatedBy:$;.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6619
	dirs do:[:aDir |
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6620
	    (pPath includes:aDir) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6621
		pPath add:aDir.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6622
	    ]
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6623
	]
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6624
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6625
	#(
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6626
	    '\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6627
	    '\programme\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6628
	    '\programme\eXept\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6629
	    '\programs\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6630
	    '\programs\eXept\smalltalk'
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6631
	) do:[:d | |dd|
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6632
	    dd := d asFilename constructString:'packages'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6633
	    (pPath includes:dd) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6634
		pPath add:dd.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6635
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6636
	    dd := (d asFilename construct:Smalltalk versionString) constructString:'packages'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6637
	    (pPath includes:dd) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6638
		pPath add:dd.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6639
	    ].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6640
	].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6641
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6642
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6643
    "/ under windows, the commandName includes the path - good.
5922
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  6644
    p := Smalltalk commandName.
c36b3ecb61f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5918
diff changeset
  6645
    p notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6646
	p := p asFilename directory constructString:'packages'.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6647
	(pPath includes:p) ifFalse:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6648
	    pPath add:p.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6649
	]
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6650
    ].
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6651
    pPath := pPath select:[:p | p asFilename exists].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6652
    ^ pPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6653
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6654
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6655
     self defaultPackagePath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6656
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6657
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6658
    "Created: / 24.12.1999 / 00:10:41 / cg"
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6659
    "Modified: / 24.12.1999 / 00:33:26 / cg"
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6660
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6661
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6662
defaultSystemPath
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  6663
    |sysPath libDirPath|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6664
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6665
    sysPath := super defaultSystemPath.
9014
f4df89a42724 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9013
diff changeset
  6666
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  6667
    libDirPath := self stxLibDirPath.
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  6668
    libDirPath notNil ifTrue:[
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6669
	"/ and also add the libDirPath from the registry ...
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6670
	(sysPath includes:libDirPath) ifFalse:[
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6671
	    sysPath add:libDirPath
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6672
	].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  6673
    ].
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  6674
    #(
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6675
	'\programs\eXept\smalltalk'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6676
	'\programme\eXept\smalltalk'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6677
	'\programs\smalltalk'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6678
	'\programme\smalltalk'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6679
	'\smalltalk'
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6680
    ) do:[:dir |
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6681
	|vsnDir|
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6682
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6683
	(dir asFilename isDirectory) ifTrue:[
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6684
	    vsnDir := dir , '\' , Smalltalk versionString.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6685
	    (vsnDir asFilename isDirectory) ifTrue:[
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6686
		(sysPath includes:vsnDir) ifFalse:[
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6687
		    sysPath add:vsnDir.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6688
		]
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6689
	    ].
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6690
	    (sysPath includes:dir) ifFalse:[
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6691
		sysPath add:dir.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6692
	    ].
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6693
	]
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6694
    ].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  6695
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6696
    ^ sysPath
5136
faa3c9f42b8b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5135
diff changeset
  6697
5147
305aa6d3926a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
  6698
    "Modified: / 24.12.1999 / 00:29:18 / cg"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6699
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6700
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6701
stxBinDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6702
    "ask the registry for the binary directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6703
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6704
    |k p|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6705
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6706
    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
  6707
    k notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6708
	p := k valueNamed:'BinDir'.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6709
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6710
    ^ p
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
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6713
     OperatingSystem stxBinDirPath
5133
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
!
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
stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6718
    "ask the registry for the lib directory"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6719
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6720
    (Array
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6721
	with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X\' , Smalltalk versionString)
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6722
	with:('HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'))
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  6723
    do:[:eachKeyToTry |
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6724
	|k p|
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6725
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6726
	k := RegistryEntry key:eachKeyToTry.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6727
	k notNil ifTrue:[
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6728
	    p := k valueNamed:'LibDir'.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6729
	    k closeKey.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6730
	    ^ p
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6731
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6732
    ].
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9014
diff changeset
  6733
    ^ nil
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6734
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6735
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6736
     OperatingSystem stxLibDirPath
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6737
    "
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6738
!
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6739
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6740
stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6741
    "ask the registry for the package directory"
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6742
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6743
    |k p|
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6744
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6745
    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
  6746
    k notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6747
	p := k valueNamed:'PackageDirPath'.
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6748
    ].
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6749
    ^ p
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6750
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6751
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6752
     OperatingSystem stxPackageDirPath
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6753
    "
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6754
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5142
diff changeset
  6755
    "Created: / 24.12.1999 / 00:11:12 / cg"
5133
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6758
!Win32OperatingSystem class methodsFor:'private'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6759
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6760
mapLanguage:aWindowsLanguageString
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6761
    "map a windows language string to ISO languageCode_languageTerritory format"
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6762
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6763
    |windowsLanguageString|
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6764
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6765
    windowsLanguageString := aWindowsLanguageString asUppercase.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6766
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6767
    #('DEU'     'de_DE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6768
      'DES'     'de_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6769
      'DEA'     'de_AT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6770
      'DAN'     'da_DA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6771
      'ENA'     'en_AU'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6772
      'ENC'     'en_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6773
      'ENG'     'en_GB'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6774
      'ENI'     'en_IR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6775
      'ENU'     'en_US'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6776
      'ENZ'     'en_NZ'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6777
      'FRA'     'fr_FR'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6778
      'FRB'     'fr_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6779
      'FRC'     'fr_CA'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6780
      'FRS'     'fr_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6781
      'ITA'     'it_IT'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6782
      'ITS'     'it_CH'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6783
      'ESM'     'es_MX'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6784
      'ESN'     'es_ES'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6785
      'ESP'     'es'            "Castillian"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6786
      'NLB'     'nl_BE'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6787
      'NLD'     'nl_NL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6788
      'CSY'     'cs_CS'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6789
      'ELL'     'el_EL'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6790
      'NON'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6791
      'NOR'     'no_NO'
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6792
     ) pairWiseDo:[:key :mappedValue|
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6793
	key = windowsLanguageString ifTrue:[
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6794
	    ^ mappedValue
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6795
	]
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6796
    ].
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6797
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6798
    "no mapping"
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6799
    ^ windowsLanguageString.
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6800
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6801
    "
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  6802
     self mapLanguage:'DEU'
7777
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6803
    "
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6804
!
d40ef40238d1 Language stuff
Stefan Vogel <sv@exept.de>
parents: 7775
diff changeset
  6805
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6806
osProcessStatusClass
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6807
    ^ OSProcessStatus
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6808
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6809
    "Created: / 12.6.1998 / 16:30:43 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6810
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6811
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
  6812
!Win32OperatingSystem class methodsFor:'registry support'!
9013
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6813
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6814
registryEntry
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6815
    "provide access to the registryEntry class"
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6816
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6817
    ^ RegistryEntry
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6818
! !
7e4f88f6c1a5 comments
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  6819
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
  6820
!Win32OperatingSystem class methodsFor:'serial port support'!
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
  6821
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
  6822
serialPortAccessor
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
  6823
    "provide access to the serial port class"
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
  6824
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
  6825
    ^ Win32SerialPortHandle
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
  6826
! !
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
  6827
9115
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
  6828
!Win32OperatingSystem class methodsFor:'shell operations'!
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
  6829
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6830
shellExecute:hwnd lpOperation:lpOperation lpFile:lpFile lpParameters:lpParameters lpDirectory:lpDirectory nShowCmd:nShowCmd
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6831
	"Opens or prints the specified file, which can be an executable or document file.
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6832
		HINSTANCE ShellExecute(
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6833
			HWND hwnd,                      // handle to parent window
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6834
			LPCTSTR lpOperation,    // pointer to string that specifies operation to perform
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6835
			LPCTSTR lpFile,         // pointer to filename or folder name string
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6836
			LPCTSTR lpParameters,   // pointer to string that specifies executable-file parameters
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6837
			LPCTSTR lpDirectory,    // pointer to string that specifies default directory
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6838
			INT nShowCmd                    // whether file is shown when opened
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6839
		);"
9115
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
  6840
"/        <apicall: long 'ShellExecuteA' (long char* char* char* char* ulong) module:'shell32.dll'>
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
  6841
%{
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6842
	if (((lpOperation == nil) || __isString(lpOperation))
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6843
	 && ((lpFile == nil) || __isString(lpFile))
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6844
	 && ((lpParameters == nil) || __isString(lpParameters))
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6845
	 && ((lpDirectory == nil) || __isString(lpDirectory))
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6846
	 && __isSmallInteger(nShowCmd)) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6847
	    HANDLE __hwnd = 0;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6848
	    char *__lpOperation   = (lpOperation != nil) ? __stringVal(lpOperation) : NULL;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6849
	    char *__lpFile        = (lpFile != nil) ? __stringVal(lpFile) : NULL;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6850
	    char *__lpParameters  = (lpParameters != nil) ? __stringVal(lpParameters) : NULL;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6851
	    char *__lpDirectory   = (lpDirectory != nil) ? __stringVal(lpDirectory) : NULL;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6852
	    unsigned long __nShowCmd = __intVal(nShowCmd);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6853
	    long result;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6854
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6855
	    if (hwnd != nil) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6856
		if (__isExternalAddressLike(hwnd)) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6857
		    HANDLE __hwnd = (HANDLE)(__externalAddressVal(hwnd));
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6858
		} else
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6859
		    goto badArgument;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6860
	    }
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6861
	    result = ShellExecuteA(__hwnd, __lpOperation, __lpFile, __lpParameters, __lpDirectory, __nShowCmd);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6862
	    RETURN (__MKINT(result));
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6863
	}
9115
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
  6864
badArgument: ;
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
  6865
%}.
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  6866
	self primitiveFailed
9115
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
  6867
! !
65f7004dae93 WIn32Shell and IUnknown stuff
Claus Gittinger <cg@exept.de>
parents: 9113
diff changeset
  6868
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
  6869
!Win32OperatingSystem class methodsFor:'socket support'!
8270
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
  6870
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
  6871
socketAccessor
9093
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
  6872
    "provide access to the socket handle class"
cba833917516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9092
diff changeset
  6873
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
  6874
    ^ Win32SocketHandle
8270
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
  6875
! !
df0083a70225 temporary kludge for SOcketAccessor/SocketHandle
ca
parents: 8265
diff changeset
  6876
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6877
!Win32OperatingSystem class methodsFor:'system management'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6878
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6879
exitWindows
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6880
    "do not use - may be removed without notice"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6881
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6882
    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
  6883
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6884
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6885
exitWindows:how confirm:confirmationMessageOrNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6886
    "this method is temporary -
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6887
     since my windows system menu crashes so often
7850
087b4ca01736 comment & unneeded method removed
ca
parents: 7841
diff changeset
  6888
     (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
  6889
     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
  6890
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6891
    confirmationMessageOrNil notNil ifTrue:[
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6892
	(Dialog confirm:confirmationMessageOrNil) ifFalse:[
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6893
	    ^ false
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6894
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6895
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6896
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6897
    int flag;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6898
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6899
    if (how == @symbol(shutdown)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6900
	flag = EWX_SHUTDOWN;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6901
    } else if (how == @symbol(reboot)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6902
	flag = EWX_REBOOT;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6903
    } else if (how == @symbol(logoff)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6904
	flag = EWX_LOGOFF;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6905
    } else if (how == @symbol(forceShutdown)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6906
	flag = EWX_SHUTDOWN | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6907
    } else if (how == @symbol(forceReboot)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6908
	flag = EWX_REBOOT | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6909
    } else if (how == @symbol(forceLogoff)) {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6910
	flag = EWX_LOGOFF | EWX_FORCE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6911
    } else {
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
  6912
	RETURN (false);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6913
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6914
    RETURN ((ExitWindowsEx(flag, 0) == TRUE) ? true : false);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6915
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6916
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6917
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6918
!Win32OperatingSystem class methodsFor:'time and date'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6919
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6920
computeDatePartsOf:osTime for:aBlock
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6921
    "compute year, month and day from the OS time, osTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6922
     and evaluate the argument, a 3-arg block with these.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6923
     Conversion is to localtime including any daylight saving adjustments."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6924
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6925
    |year month day osSeconds|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6926
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6927
    osSeconds := osTime // 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6928
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6929
    struct tm* tmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6930
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6931
    TIME_T tt;
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
    t = __longIntVal(osSeconds);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6934
    tt = (TIME_T)t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6935
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6936
    tmPtr = localtime(&tt);
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  6937
    year = __mkSmallInteger(tmPtr->tm_year + 1900);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  6938
    month = __mkSmallInteger(tmPtr->tm_mon + 1);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  6939
    day = __mkSmallInteger(tmPtr->tm_mday);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6940
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6941
    aBlock value:year value:month value:day
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6942
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
     OperatingSystem computeDatePartsOf:0 for:[:y :m :d |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  6945
	y printCR. m printCR. d printCR
5133
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
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6950
computeOSTimeFromUTCYear:y month:m day:d hour:h minute:min second:s millisecond:millis
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6951
    "return the OS-dependent time for the given time and day.
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6952
     The arguments are assumed to be in localtime including
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6953
     any daylight saving adjustings."
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6954
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6955
    |osSeconds|
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6956
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6957
%{
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6958
    struct tm tm;
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6959
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6960
    if (__bothSmallInteger(y, m)
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6961
     && __bothSmallInteger(d, h)
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6962
     && __bothSmallInteger(min, s)) {
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6963
	TIME_T t;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6964
	int utcOffset;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6965
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6966
	tm.tm_hour = __intVal(h);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6967
	tm.tm_min = __intVal(min);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6968
	tm.tm_sec = __intVal(s);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6969
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6970
	tm.tm_year = __intVal(y) - 1900;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6971
	tm.tm_mon = __intVal(m) - 1;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6972
	tm.tm_mday = __intVal(d);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6973
	tm.tm_isdst = -1;
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6974
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6975
	if (tm.tm_isdst == 0) {
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6976
	    utcOffset = __MKINT(TIMEZONE(tmPtr));
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6977
	} else {
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6978
#ifdef HAS_ALTZONE
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6979
	    utcOffset = __MKINT(altzone);
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6980
#else
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6981
	    utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6982
#endif
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6983
	}
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6984
	t = mktime(&tm);
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6985
	osSeconds = __MKUINT((INT)t);
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6986
    }
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6987
%}.
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6988
    osSeconds notNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  6989
	^ osSeconds * 1000 + millis
8640
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6990
    ].
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6991
    ^ self primitiveFailed
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6992
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6993
    "
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6994
     OperatingSystem computeOSTimeFromUTCYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6995
    "
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6996
!
dc4023c8650c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8476
diff changeset
  6997
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  6998
computeOSTimeFromYear:y month:m day:d hour:h minute:min seconds:s millis:millis
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  6999
    "return the OS-dependent time for the given time and day.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7000
     The arguments are assumed to be in localtime including
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7001
     any daylight saving adjustings."
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
    |osSeconds|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7004
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7005
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7006
    struct tm tm;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7007
    TIME_T t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7008
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7009
    if (__bothSmallInteger(y, m)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7010
     && __bothSmallInteger(d, h)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7011
     && __bothSmallInteger(min, s)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7012
	tm.tm_hour = __intVal(h);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7013
	tm.tm_min = __intVal(min);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7014
	tm.tm_sec = __intVal(s);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7015
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7016
	tm.tm_year = __intVal(y) - 1900;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7017
	tm.tm_mon = __intVal(m) - 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7018
	tm.tm_mday = __intVal(d);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7019
	tm.tm_isdst = -1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7020
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7021
	t = mktime(&tm);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7022
	osSeconds = __MKUINT((INT)t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7023
    }
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
    osSeconds notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7026
	^ osSeconds * 1000 + millis
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7027
    ].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7028
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7029
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7030
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7031
     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
  7032
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7033
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7034
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7035
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7036
computeTimePartsOf:osTime for:aBlock
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7037
    "compute hours, minutes, seconds and milliseconds from the osTime
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7038
     and evaluate the argument, a 4-arg block with these.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7039
     Conversion is to localtime including any daylight saving adjustments."
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
    |hours minutes seconds millis osSeconds|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7042
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7043
    osSeconds := osTime // 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7044
    millis := osTime \\ 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7045
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7046
    struct tm *tmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7047
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7048
    TIME_T tt;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7049
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7050
    t = __longIntVal(osSeconds);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7051
    tt = (TIME_T)t;
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
    tmPtr = localtime(&tt);
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7054
    hours = __mkSmallInteger(tmPtr->tm_hour);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7055
    minutes = __mkSmallInteger(tmPtr->tm_min);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7056
    seconds = __mkSmallInteger(tmPtr->tm_sec);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7057
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7058
    aBlock value:hours value:minutes value:seconds value:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7059
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
     OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7062
	h printCR. m printCR. s printCR. millis printCR
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7063
     ]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7064
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7065
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7066
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7067
computeUTCTimeAndDateFrom:osTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7068
    "given an OS-dependent time in osTime, return an Array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7069
     containing year, month, day, hour, minute and seconds,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7070
     offset to UTC, daylight savings time flag, milliseconds,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7071
     dayInYear (1..) and dayInWeek (1..).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7072
     Conversion is to UTC."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7073
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7074
    |low hi year month day hours minutes seconds millis utcOffset
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7075
     dst yDay wDay osSeconds ret|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7076
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7077
    millis := osTime \\ 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7078
    osSeconds := osTime // 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7079
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7080
    struct tm *tmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7081
    struct tm *gmTmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7082
    long t;
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
    t = __longIntVal(osSeconds);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7085
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7086
    tmPtr = gmtime(&t);
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7087
    hours = __mkSmallInteger(tmPtr->tm_hour);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7088
    minutes = __mkSmallInteger(tmPtr->tm_min);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7089
    seconds = __mkSmallInteger(tmPtr->tm_sec);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7090
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7091
    year = __mkSmallInteger(tmPtr->tm_year + 1900);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7092
    month = __mkSmallInteger(tmPtr->tm_mon + 1);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7093
    day = __mkSmallInteger(tmPtr->tm_mday);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7094
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7095
    yDay = __mkSmallInteger(tmPtr->tm_yday + 1);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7096
    wDay = __mkSmallInteger(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
5133
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
    if (tmPtr->tm_isdst == 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7099
	dst = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7100
	utcOffset = __MKINT(TIMEZONE(tmPtr));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7101
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7102
	dst = true;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7103
#ifdef HAS_ALTZONE
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7104
	utcOffset = __MKINT(altzone);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7105
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7106
	utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7107
#endif
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
    "I would love to have SELF-like inline objects ..."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7111
    ret := Array new:11.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7112
    ret at:1 put:year.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7113
    ret at:2 put:month.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7114
    ret at:3 put:day.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7115
    ret at:4 put:hours.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7116
    ret at:5 put:minutes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7117
    ret at:6 put:seconds.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7118
    ret at:7 put:utcOffset.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7119
    ret at:8 put:dst.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7120
    ret at:9 put:millis.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7121
    ret at:10 put:yDay.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7122
    ret at:11 put:wDay.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7123
    ^ ret
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7124
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7125
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7126
     OperatingSystem computeUTCTimeAndDateFrom:0
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7130
computeUTCTimePartsOf:osTime for:aBlock
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7131
    "compute hours, minutes, seconds and milliseconds from the osTime
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7132
     and evaluate the argument, a 4-arg block with these.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7133
     Conversion is to UTC."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7134
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7135
    |hours minutes seconds millis osSeconds|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7136
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7137
    osSeconds := osTime // 1000.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7138
    millis := osTime \\ 1000.
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
    struct tm *tmPtr;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7141
    long t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7142
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7143
    t = __longIntVal(osSeconds);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7144
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7145
    tmPtr = gmtime(&t);
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7146
    hours = __mkSmallInteger(tmPtr->tm_hour);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7147
    minutes = __mkSmallInteger(tmPtr->tm_min);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7148
    seconds = __mkSmallInteger(tmPtr->tm_sec);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7149
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7150
    aBlock value:hours value:minutes value:seconds value:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7151
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7152
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7153
     OperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli |
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7154
	h printCR. m printCR. s printCR. milli printCR
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7157
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7158
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7159
getMillisecondTime
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7160
    "This returns the millisecond timers value.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7161
     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
  7162
     LargeInteger arithmetic when doing timeouts and delays.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7163
     Since this value is wrapping around in regular intervals, this can only be used for
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7164
     short relative time deltas.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7165
     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
  7166
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7167
     BAD DESIGN:
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7168
	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
  7169
	and these computations moved there.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7170
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7171
     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
  7172
     interface. For compatibility with ST-80, use Time millisecondClockValue.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7173
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7174
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7175
%{  /* NOCONTEXT */
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
    long t = 0;
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
#if !defined(HAS_GETTIMEOFDAY)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7180
# if defined(HAS_FTIME)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7181
    struct timeb timebuffer;
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
    ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7184
    t = (timebuffer.time * 1000) + timebuffer.millitm;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7185
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7186
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7187
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7188
# ifndef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7189
#  ifdef WIN32
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7190
    t = GetTickCount();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7191
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7192
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7193
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7194
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7195
# ifndef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7196
#  ifdef MSDOS_LIKE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7197
#   ifdef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7198
    struct timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7199
    ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7200
#   else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7201
    struct _timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7202
    _ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7203
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7204
    t = (timebuffer.time * 1000) + timebuffer.millitm;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7205
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7206
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7207
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7208
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7209
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7210
#ifndef HAVE_TIME
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7211
    /* assume HAS_GETTIMEOFDAY
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7212
     * - will result in a linkage error
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7213
     * if not fixed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7214
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7215
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7216
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7217
     * bsd time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7218
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7219
    struct timeval tb;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7220
    struct timezone tzb;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7221
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7222
    gettimeofday(&tb, &tzb);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7223
    t = tb.tv_sec*1000 + tb.tv_usec/1000;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7224
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7225
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7226
#undef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7227
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7228
    RETURN ( __mkSmallInteger(t & 0x1FFFFFFF) );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7229
%}
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7230
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7231
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7232
getOSTime
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7233
    "This returns the OS time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7234
     The base of the returned value is not consistent across
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7235
     different OS's - some return the number of millis since jan, 1st 1970;
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7236
     others since 1900. The Time classes are prepared for this, and
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7237
     converts as appropriate (by using my fromOSTime: conversion methods).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7238
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7239
     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
  7240
     interface. For compatibility with ST-80, use Time>>millisecondClockValue.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7241
     or use instances of Time, Date or Timestamp to work with.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7242
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7243
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7244
    |seconds millis|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7245
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7246
%{
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
    long t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7249
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7250
#if !defined(HAS_GETTIMEOFDAY)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7251
# if defined(HAS_FTIME)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7252
    struct timeb timebuffer;
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
    ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7255
    seconds = __MKUINT(timebuffer.time);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7256
    millis = __MKUINT(timebuffer.millitm);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7257
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7258
# endif
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
# ifndef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7261
#  ifdef MSDOS_LIKE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7262
#   ifdef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7263
    struct timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7264
    ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7265
#   else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7266
    struct _timeb timebuffer;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7267
    _ftime(&timebuffer);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7268
#   endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7269
    seconds = __MKUINT(timebuffer.time);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7270
    millis = __MKUINT(timebuffer.millitm);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7271
#   define HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7272
#  endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7273
# endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7274
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7275
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7276
#ifndef HAVE_TIME
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7277
    /* assume HAS_GETTIMEOFDAY
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7278
     * - will result in a linkage error
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7279
     * if not fixed.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7280
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7281
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7282
     * bsd time
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7283
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7284
    struct timeval tb;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7285
    struct timezone tzb;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7286
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7287
    gettimeofday(&tb, &tzb);
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
    seconds = __MKUINT(tb.tv_sec);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7290
    millis = __MKUINT(tb.tv_usec / 1000);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7291
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7292
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7293
#undef HAVE_TIME
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7294
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7295
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7296
    ^ (seconds * 1000) + millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7297
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7298
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7299
     OperatingSystem getOSTime printCR.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7300
     Delay waitForSeconds:0.2.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7301
     OperatingSystem getOSTime printCR.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7302
    "
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7305
sleep:numberOfSeconds
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7306
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7307
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7308
    "cease ANY action for some time. This suspends the whole smalltalk
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7309
     (unix-) process for some time.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7310
     Not really useful since not even low-prio processes and interrupt
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7311
     handling will run during the sleep.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7312
     Use either OperatingSystem>>millisecondDelay: (which makes all
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7313
     threads sleep, but handles interrupts) or use a Delay (which makes
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7314
     only the calling thread sleep)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7315
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7316
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7317
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7318
    if (__isSmallInteger(numberOfSeconds)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7319
	sleep(__intVal(numberOfSeconds));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7320
	RETURN ( self );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7321
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7322
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7323
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7324
     argument not integer
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7325
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7326
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7327
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7328
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7329
     OperatingSystem sleep:2
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7330
    "
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7331
!
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7332
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7333
timeInfoFromSeconds:osSeconds milliseconds:osMilliseconds localTime:isLocalTime
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7334
    "return a timeInfo structure containing values for the given
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7335
     OS-second value.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7336
     An internal helper"
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7337
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7338
    |year month day hours minutes seconds utcOffset
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7339
     dst yDay wDay info|
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7340
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7341
%{
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7342
    struct tm *tmPtr;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7343
    struct tm *gmTmPtr;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7344
    INT t;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7345
    TIME_T tt;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7346
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7347
    t = __longIntVal(osSeconds);
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7348
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7349
    /* try cache */
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7350
    {
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7351
	OBJ lastSeconds, lastTimeInfo;
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7352
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7353
	lastSeconds = @global(LastTimeInfoSeconds);
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7354
	if (lastSeconds
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7355
	 && (__longIntVal(lastSeconds) == t)
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7356
	 && (@global(LastTimeInfoMilliseconds) == osMilliseconds)
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7357
	 && (@global(LastTimeInfoIsLocal) == isLocalTime)
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7358
	) {
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7359
	    lastTimeInfo = @global(LastTimeInfo);
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7360
	    if (lastTimeInfo != nil) {
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7361
		RETURN (lastTimeInfo);
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7362
	    }
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7363
	}
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7364
    }
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7365
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7366
    tt = (TIME_T)t;
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7367
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7368
    if (isLocalTime == true) {
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7369
	tmPtr = localtime(&tt);
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7370
#ifdef WINDOWS_IS_POSIX_CONFORM_WHICH_IT_IS_NOT
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7371
	utcOffset = __MKINT(tmPtr->tm_gstoff);
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7372
#else
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7373
	{
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7374
	    TIME_ZONE_INFORMATION tzInfo;
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7375
	    int gstoffMinutes = 0;
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7376
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7377
	    switch (GetTimeZoneInformation(&tzInfo)) {
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7378
		default:
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7379
		case TIME_ZONE_ID_UNKNOWN:
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7380
		    fprintf(stderr, "Win32OperatingSystem [warning]: unknown timezone\n");
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7381
		    break;
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7382
		case TIME_ZONE_ID_STANDARD:
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7383
		    gstoffMinutes = tzInfo.Bias;
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7384
		    /* printf("standard\n");  */
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7385
		    break;
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7386
		case TIME_ZONE_ID_DAYLIGHT:
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7387
		    gstoffMinutes = tzInfo.Bias;
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7388
		    /* printf("daylight\n");  */
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7389
		    break;
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7390
	    }
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7391
	    /* printf("utcOffset: %d\n", gstoffMinutes); */
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7392
	    utcOffset = __MKINT(gstoffMinutes*60);
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7393
	}
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7394
#endif
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7395
    } else {
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7396
	tmPtr = gmtime(&tt);
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7397
	utcOffset = __mkSmallInteger(0);
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7398
    }
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7399
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7400
    hours = __mkSmallInteger(tmPtr->tm_hour);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7401
    minutes = __mkSmallInteger(tmPtr->tm_min);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7402
    seconds = __mkSmallInteger(tmPtr->tm_sec);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7403
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7404
    year = __mkSmallInteger(tmPtr->tm_year + 1900);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7405
    month = __mkSmallInteger(tmPtr->tm_mon + 1);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7406
    day = __mkSmallInteger(tmPtr->tm_mday);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7407
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7408
    yDay = __mkSmallInteger(tmPtr->tm_yday+1);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7409
    wDay = __mkSmallInteger(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7410
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7411
    dst = (tmPtr->tm_isdst == 0) ? false : true;
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7412
#ifdef THIS_IS_WRONG
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7413
    if (dst == true) {
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7414
	utcOffset = __MKINT(__intVal(utcOffset) + 3600);
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7415
    }
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7416
#endif
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7417
%}.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7418
    info := self timeInfoClass new.
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7419
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7420
    info
9025
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7421
	year:year
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7422
	month:month
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7423
	day:day
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7424
	hours:hours
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7425
	minutes:minutes
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7426
	seconds:seconds
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7427
	milliseconds:osMilliseconds
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7428
	utcOffset:utcOffset
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7429
	dst:dst
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7430
	dayInYear:yDay
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7431
	dayInWeek:wDay.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7432
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7433
    LastTimeInfo := info.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7434
    LastTimeInfoSeconds := osSeconds.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7435
    LastTimeInfoMilliseconds := osMilliseconds.
e9fff455ecfb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9021
diff changeset
  7436
    LastTimeInfoIsLocal := isLocalTime.
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7437
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7438
    ^ info
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7439
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7440
    "
8889
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7441
     OperatingSystem timeInfoFromSeconds:0 milliseconds:0 localTime:false
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7442
     OperatingSystem xtimeInfoFromSeconds:0 milliseconds:0 localTime:false
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7443
     OperatingSystem xtimeInfoFromSeconds:3600 milliseconds:0 localTime:true
934feccecfb3 timezone stuff fixed
Claus Gittinger <cg@exept.de>
parents: 8881
diff changeset
  7444
     OperatingSystem xtimeInfoFromSeconds:Timestamp now utcSecondsSince1970 milliseconds:0 localTime:true
7638
a211d1f10797 *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 7535
diff changeset
  7445
    "
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7446
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7447
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7448
!Win32OperatingSystem class methodsFor:'users & groups'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7449
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7450
getEffectiveGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7451
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7452
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7453
    "return the current users (thats you) effective numeric group id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7454
     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
  7455
     as a setuid program (of which you should think about twice)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7456
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7457
    ^ self getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7458
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7459
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7460
     OperatingSystem getEffectiveGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7461
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7462
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7463
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7464
getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7465
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7466
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7467
    "return the current users (thats you) effective numeric user id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7468
     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
  7469
     as a setuid program (of which you should think about twice)."
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
    ^ self getUserID
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
     OperatingSystem getEffectiveUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7475
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7476
!
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
getFullUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7479
    "{ Pragma: +optSpace }"
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
    "return a string with the users full name - if available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7482
     If not, return the login name as a fallBack."
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
    |info gecos|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7485
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7486
    info := self userInfoOf:userID.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7487
    (info notNil
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7488
    and:[info includesKey:#gecos]) ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7489
	gecos := info at:#gecos.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7490
	(gecos includes:$,) ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7491
	    ^ gecos copyTo:(gecos indexOf:$,) - 1
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7492
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7493
	^ gecos
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7494
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7495
    ^ self getUserNameFromID:userID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7496
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7497
    "
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7498
     OperatingSystem getFullUserNameFromID:0
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7499
     OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID)
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7500
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7501
     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7502
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7503
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7504
    "Modified: 15.7.1996 / 12:44:21 / cg"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7505
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7506
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7507
getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7508
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7509
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7510
    "return the current users (thats you) numeric group id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7511
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7512
    ^ 1 "just a dummy for systems which do not have groupIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7513
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7514
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7515
     OperatingSystem getGroupID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7516
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7517
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7518
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7519
getGroupNameFromID:aNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7520
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7521
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7522
    "return the group-name-string for a given numeric group-id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7523
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7524
    ^ '???' "just a dummy for systems which do not have groupIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7525
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7526
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7527
     OperatingSystem getGroupNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7528
     OperatingSystem getGroupNameFromID:10
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7529
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7530
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7531
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7532
getHomeDirectory
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7533
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7534
5264
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
  7535
    "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
  7536
     This uses the value of the HOME environment variable,
8412
cb1f92123250 Fix getting home directory if it is on a network share.
Stefan Vogel <sv@exept.de>
parents: 8360
diff changeset
  7537
     or HOMESHARE or HOMEDRIVE:HOMEPATH as a fallBack.
5264
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
  7538
     If not set, return the current directory."
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7539
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7540
    |dir drv path|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7541
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7542
    dir := self getEnvironment:'HOME'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7543
    dir isNil ifTrue:[
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7544
	"for NT/WIN2K/XP users:
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7545
	 if HOME is nil, try first HOMEHSARE and then HOMEDRIVE and HOMEPATH"
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7546
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7547
	dir := self getEnvironment:'HOMESHARE'.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7548
	dir isNil ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7549
	    ((drv := self getEnvironment:'HOMEDRIVE') notNil
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7550
	     and:[(path := self getEnvironment:'HOMEPATH') notNil]) ifTrue:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7551
		dir := drv , path
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7552
	    ] ifFalse:[
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7553
		dir := '.'.
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7554
	    ].
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7555
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7556
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7557
    ^ dir
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
    "
8642
dd598b080b6a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8640
diff changeset
  7560
     OperatingSystem getHomeDirectory
5133
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
5264
9a90c499e329 return the currentDir as default fallBack for the getHomeDir query.
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
  7563
    "Modified: / 16.2.2000 / 09:17:55 / cg"
5133
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7566
getLoginName
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7567
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7568
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7569
    "return a string with the users login name (thats yours)"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7570
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7571
%{  /* NOCONTEXT */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7572
    static char cachedName[64];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7573
    static firstCall = 1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7574
#ifndef __BORLANDC__
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7575
    extern char *getenv();
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7576
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7577
    char *name = (char *)0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7578
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7579
    if (firstCall) {
9094
c4d084167915 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9093
diff changeset
  7580
	DWORD nameSize = sizeof(cachedName);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7581
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7582
	if (GetUserName(cachedName, &nameSize) == TRUE) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7583
	    name = cachedName;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7584
	    firstCall = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7585
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7586
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7587
	name = cachedName;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7588
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7589
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7590
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7591
     * try a few common environment variables ...
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
    if (! name || (name[0] == 0) ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7594
	name = getenv("LOGIN");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7595
	if (! name || (name[0] == 0) ) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7596
	    name = getenv("LOGNAME");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7597
	    if (! name || (name[0] == 0) ) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7598
		name = getenv("USER");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7599
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7600
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7601
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7602
    /*
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7603
     * nope - I really font know who you are.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7604
     */
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7605
    if (! name || (name[0] == 0) ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7606
	name = "you";
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7607
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7608
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7609
    RETURN ( __MKSTRING(name) );
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
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7612
     OperatingSystem getLoginName
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7616
getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7617
    "{ Pragma: +optSpace }"
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
    "return the current users (thats you) numeric user id"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7620
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7621
    ^ 1 "just a dummy for systems which do not have userIDs"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7622
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7623
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7624
     OperatingSystem getUserID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7625
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7626
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7627
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7628
getUserNameFromID:aNumber
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7629
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7630
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7631
    "return the user-name-string for a given numeric user-id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7632
     This is the login name, not the fullName."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7633
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7634
    aNumber == self getUserID ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7635
	^ self getLoginName
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7636
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7637
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7638
    ^ '? (' , aNumber printString , ')'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7639
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7640
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7641
     OperatingSystem getUserNameFromID:0
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7642
     OperatingSystem getUserNameFromID:100
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7643
     OperatingSystem getUserNameFromID:9991
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7644
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7645
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7646
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7647
userInfoOf:aNameOrID
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7648
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7649
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7650
    "return a dictionary filled with userinfo. The argument can be either
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7651
     a string with the users name or its numeric id.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7652
     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
  7653
     Portable applications may want to check the systemType and NOT depend
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7654
     on all keys to be present in the returned dictionary."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7655
8659
d8f5821a6d6d *** empty log message ***
penk
parents: 8656
diff changeset
  7656
    |info name "uid gid" dir|
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7657
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7658
    info := IdentityDictionary new.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7659
    name isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7660
	aNameOrID == self getUserID ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7661
	    name := self getLoginName
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7662
	].
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7663
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7664
    name notNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7665
	info at:#name put:name.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7666
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7667
	info at:#name put:'unknown'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7668
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7669
    dir isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7670
	aNameOrID == self getUserID ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7671
	    dir := self getHomeDirectory
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7672
	]
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7673
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7674
    dir notNil ifTrue:[info at:#dir put:dir].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7675
    "/ uid notNil ifTrue:[info at:#uid put:uid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7676
    "/ gid  notNil ifTrue:[info at:#gid put:gid].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7677
    ^ info
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7678
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7679
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7680
     OperatingSystem userInfoOf:'root'
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7681
     OperatingSystem userInfoOf:1
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7682
     OperatingSystem userInfoOf:'claus'
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7683
     OperatingSystem userInfoOf:'fooBar'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7684
     OperatingSystem userInfoOf:(OperatingSystem getUserID)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7685
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7686
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7687
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7688
!Win32OperatingSystem class methodsFor:'waiting for events'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7689
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7690
blockingChildProcessWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7691
     "return true, if childProcessWait: blocks, if no children are ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7692
      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
  7693
      a subprocesses status (to avoid blocking)."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7694
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7695
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7696
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7697
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7698
childProcessWait:blocking pid:pidToWait
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7699
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7700
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7701
    "get status changes from child processes.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7702
     Return an OSProcessStatus or nil, if no process has terminated.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7703
     If blocking is true, we wait until a process changed state,
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7704
     otherwise we return immediately.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7705
     Note that win32 needs to know the HANDLE of the process on which
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7706
     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
  7707
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7708
    |pid status code core|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7709
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7710
    DWORD endStatus;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7711
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  7712
    if (__isExternalAddressLike(pidToWait) ) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7713
	HANDLE __pidToWait = _HANDLEVal(pidToWait);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7714
	int t;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7715
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  7716
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7717
	printf("childProcessWait %x b %d\n",__pidToWait,blocking==true);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7718
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7719
	t = blocking==true ? INFINITE : 0;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7720
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7721
#ifdef DO_WRAP_CALLS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7722
	do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7723
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7724
	    endStatus = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, __pidToWait, t);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7725
	} while ((endStatus < 0) && (__threadErrno == EINTR));
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7726
#else
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7727
	endStatus = WaitForSingleObject(__pidToWait, t);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7728
	if (endStatus < 0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7729
	    __threadErrno = __WIN32_ERR(GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7730
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7731
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7732
	if ( endStatus == WAIT_TIMEOUT ) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7733
	    if (blocking==true)
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7734
		status = @symbol(timeout);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7735
	    else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7736
		status = @symbol(continue);
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  7737
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7738
		printf("ret nil\n");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7739
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7740
		RETURN(nil);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7741
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7742
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7743
	    status = @symbol(exit);
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  7744
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7745
	    printf("exit\n");
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7746
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7747
	    if (endStatus == WAIT_OBJECT_0) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7748
		if (GetExitCodeProcess(__pidToWait, &endStatus)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7749
		    if (endStatus == STILL_ACTIVE) {
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7750
			RETURN(nil);
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7751
		    }
8650
bc8e2cdcb777 processGroup termiantion (leftover child processes)
Claus Gittinger <cg@exept.de>
parents: 8642
diff changeset
  7752
#ifdef PROCESSDEBUG_CHILDPROCESSWAIT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7753
		    printf("exit %d\n",endStatus);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7754
#endif
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7755
		    code = __mkSmallInteger(endStatus);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7756
		} else {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7757
		    code = __mkSmallInteger(GetLastError());
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7758
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7759
	    } else {
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7760
		code = __mkSmallInteger(-1);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7761
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7762
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7763
	core = false;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7764
	pid = pidToWait;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7765
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7766
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7767
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7768
    (status isNil or:[pid isNil]) ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7769
	^ self primitiveFailed
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7770
    ].
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7771
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7772
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7773
"/ show:' code: '; show:code; show:' core:'; showCR:core.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7774
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7775
    ^ OSProcessStatus pid:pid status:status code:code core:core
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7776
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7777
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7778
     OperatingSystem childProcessWait:false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7779
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7780
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7781
    "Created: 5.1.1996 / 16:39:14 / stefan"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7782
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7783
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7784
numAvailableForReadOn:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7785
    "return the number of bytes available for reading, without blocking."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7786
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7787
    ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0]
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7788
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7789
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7790
readCheck:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7791
    "return true, if data is available on a filedescriptor
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7792
     (i.e. read is possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7793
     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
  7794
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7795
    ^ super readCheck:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7796
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7797
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7798
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7799
    "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
  7800
     reading, writeFdArray to become ready for writing, or exceptFdArray to
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7801
     arrive exceptional data (i.e. out-of-band data).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7802
     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
  7803
     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
  7804
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7805
     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
  7806
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7807
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7808
#define MAXHANDLE 128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7809
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7810
    int i;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7811
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7812
    OBJ fd, retFd;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7813
    int ret;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7814
    int numHandles = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7815
    DWORD res;
7865
67ea99d5edcc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7860
diff changeset
  7816
    HANDLE hArray[MAXHANDLE+1];
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7817
    int    retArray[MAXHANDLE];
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7818
    int    readCount;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7819
    int    writeCount;
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7820
    int    exceptCount;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7821
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7822
    if (__isNonNilObject(readFdArray)) {
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
  7823
	if (! __isArrayLike(readFdArray)) goto fail;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7824
	readCount = __arraySize(readFdArray);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7825
    } else {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7826
	readCount = 0;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7827
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7828
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7829
    if (__isNonNilObject(writeFdArray)) {
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
  7830
	if (! __isArrayLike(writeFdArray)) goto fail;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7831
	writeCount = __arraySize(writeFdArray);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7832
    } else {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7833
	writeCount = 0;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7834
    }
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7835
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7836
    if (__isNonNilObject(exceptFdArray)) {
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
  7837
	if (! __isArrayLike(exceptFdArray)) goto fail;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7838
	exceptCount = __arraySize(exceptFdArray);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7839
    } else {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7840
	exceptCount = 0;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7841
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7842
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7843
    for (i = 0; (i < readCount) && (numHandles < MAXHANDLE);i++) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7844
	fd = __ArrayInstPtr(readFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7845
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7846
	if (fd != nil) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7847
	    if (__isExternalAddressLike(fd)) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7848
		hArray  [numHandles] = _HANDLEVal(fd);
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7849
		retArray[numHandles] = i;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7850
		++numHandles;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7851
	    } else {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7852
		if (_canReadWithoutBlocking (__intVal(fd) ) ) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7853
		    RETURN (fd);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7854
		}
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7855
	    }
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7856
	}
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7857
    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7858
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7859
    for (i = 0; (i < writeCount) && (numHandles < MAXHANDLE);i++) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7860
	fd = __ArrayInstPtr(writeFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7861
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7862
	if (fd != nil) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7863
	    if (__isExternalAddressLike(fd)) {
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7864
		hArray  [numHandles] = _HANDLEVal(fd);
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7865
		retArray[numHandles] = i + 10000;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7866
		++numHandles;
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7867
	    } else {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7868
		if (_canWriteWithoutBlocking (__intVal(fd) ) ) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7869
		    RETURN (fd);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7870
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7871
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7872
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7873
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7874
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7875
    for (i = 0; (i < exceptCount) && (numHandles < MAXHANDLE);i++) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7876
	fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7877
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7878
	if (fd != nil) {
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7879
	    if (__isExternalAddressLike(fd)) {
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7880
		hArray  [numHandles] = _HANDLEVal(fd);
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7881
		retArray[numHandles] = i + 20000;
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7882
		++numHandles;
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7883
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7884
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7885
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7886
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7887
    if (__isSmallInteger(millis)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7888
	t = __intVal(millis);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7889
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7890
	if (t <= 0 && numHandles == 0) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7891
	    RETURN (nil);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7892
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7893
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7894
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7895
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7896
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7897
#ifdef SELECT3DEBUGWIN32
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7898
    printf("wait Handles = %d timeout = %d\n",numHandles, t);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7899
#endif
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7900
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7901
    res = __vmWait (numHandles, hArray, MAXHANDLE, t);
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7902
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7903
    if (numHandles) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7904
	if (res == WAIT_FAILED) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7905
#ifdef SELECT2DEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7906
	    printf("- error %d; ret nil\n",GetLastError());
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7907
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7908
	    if (__threadErrno == EINTR) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7909
		__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7910
		@global(LastErrorNumber) = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7911
	    } else {
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7912
		__threadErrno = EBADF;
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7913
		if (@global(InfoPrinting) == true) {
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  7914
		    fprintf(stderr, "Win32OS [info]: select errno = %d\n", __threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7915
		}
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  7916
		@global(LastErrorNumber) = __mkSmallInteger(__threadErrno);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7917
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7918
	    RETURN ( nil );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7919
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7920
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7921
	if (res == WAIT_TIMEOUT) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7922
#ifdef SELECT3DEBUGWIN32
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7923
	    printf("- timeOut; ret nil\n" );
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7924
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7925
	    goto polling;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7926
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7927
9026
49a370c4ceb9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  7928
	if (res == numHandles) {
49a370c4ceb9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  7929
	    if (1 /* @global(InfoPrinting) == true */) {
49a370c4ceb9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  7930
		fprintf(stderr, "Win32OS [info]: plugIn event has been handled\n");
49a370c4ceb9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  7931
	    }
49a370c4ceb9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  7932
	    __threadErrno = 0;
49a370c4ceb9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  7933
	    @global(LastErrorNumber) = nil;
49a370c4ceb9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  7934
	    RETURN ( nil );
49a370c4ceb9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  7935
	}
49a370c4ceb9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9025
diff changeset
  7936
	if ((res < 0) || (res > numHandles)) {
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7937
#ifdef SELECTDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7938
	    printf("- res=%d error1 %d\n", res, GetLastError());
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7939
#endif
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7940
	    __threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7941
	    @global(LastErrorNumber) = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7942
	    RETURN ( nil );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7943
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7944
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7945
	ret = res;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7946
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7947
	if (ret < numHandles) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7948
	    int fd = retArray[ret];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7949
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7950
	    @global(LastErrorNumber) = nil;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7951
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7952
#ifdef SELECTDEBUGWIN32
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7953
	    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
  7954
#endif
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7955
	    if (fd < 10000) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7956
		RETURN ( __ArrayInstPtr(readFdArray)->a_element[fd] );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7957
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7958
	    if (fd < 20000) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7959
		RETURN ( __ArrayInstPtr(writeFdArray)->a_element[fd-10000] );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7960
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7961
	    RETURN ( __ArrayInstPtr(exceptFdArray)->a_element[fd-20000] );
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7962
	}
8792
6852892b27cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8783
diff changeset
  7963
	fprintf(stderr, "Win32OS [info]: wait Handles ret = %d error2 %d\n", ret, GetLastError());
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7964
	goto fail;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7965
    } else {
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7966
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7967
polling:
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  7968
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7969
	for (i=0; i < readCount;i++) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7970
	    fd = __ArrayInstPtr(readFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7971
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7972
	    if (fd != nil) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7973
		if (! __isExternalAddressLike(fd)) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7974
		    if (_canReadWithoutBlocking (__intVal(fd)) ) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7975
			RETURN (fd);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7976
		    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7977
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7978
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7979
	}
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7980
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7981
	for (i=0; i < writeCount;i++) {
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7982
	    fd = __ArrayInstPtr(writeFdArray)->a_element[i];
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7983
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7984
	    if (fd != nil) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7985
		if (! __isExternalAddressLike(fd)) {
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7986
		    if (_canWriteWithoutBlocking (__intVal(fd)) ) {
7840
a57bac3c9c68 getNetworkMacAddress
ca
parents: 7825
diff changeset
  7987
			RETURN (fd);
7825
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7988
		    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7989
		}
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7990
	    }
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7991
	}
b58ba4e4dcd6 bugfix in selectOnAnyReadable:writable:exception:withTimeOut:
ca
parents: 7777
diff changeset
  7992
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7993
	@global(LastErrorNumber) = nil;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  7994
	RETURN ( nil );
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7995
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7996
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7997
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7998
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  7999
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8000
     timeout argument not integer,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8001
     or any fd-array nonNil and not an array
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8002
     or not supported by OS
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8003
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8004
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8005
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8006
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8007
setBlocking:aBoolean on:fd
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8008
    "{ Pragma: +optSpace }"
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8009
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8010
    "set/clear the blocking attribute - if set (which is the default)
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8011
     a read on the fileDescriptor will block until data is available.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8012
     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
  8013
     nil."
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8014
8656
d359953f3dd7 temp kludge: setBlocking
ca
parents: 8654
diff changeset
  8015
    ^ self "/ primitiveFailed
5133
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
waitForMultipleObjects:fdOrHandleArray withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8019
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8020
     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
  8021
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8022
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8023
     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
  8024
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8025
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8026
#ifndef MAXHANDLE
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8027
# define MAXHANDLE 128
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8028
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8029
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8030
    DWORD res;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8031
    HANDLE hArray[MAXHANDLE];
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8032
    INT i, count;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8033
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8912
diff changeset
  8034
    if (! __isArrayLike(fdOrHandleArray)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8035
	goto fail;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8036
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8037
    count = __arraySize(fdOrHandleArray);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8038
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8039
    for (i=0; i<count; i++) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8040
	OBJ fdOrHandle = __ArrayInstPtr(fdOrHandleArray)->a_element[i];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8041
	HANDLE h;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8042
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8043
	if (__isExternalAddressLike(fdOrHandle)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8044
	    h = _HANDLEVal(fdOrHandle);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8045
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8046
	    if (__isSmallInteger(fdOrHandle)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8047
		h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8048
	    } else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8049
		goto fail;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8050
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8051
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8052
	hArray[i] = h;
5133
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8055
    if (__isSmallInteger(millis)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8056
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8057
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8058
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8059
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8060
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8061
#ifdef DO_WRAP_CALLS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8062
    do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8063
	__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8064
	res = STX_API_CALL4( "WaitForMultipleObjects", WaitForMultipleObjects, count, hArray, FALSE, t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8065
    } while ((res < 0) && (__threadErrno == EINTR));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8066
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8067
    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
  8068
    if (res < 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8069
	__threadErrno = __WIN32_ERR(GetLastError());
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  8070
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8071
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8072
    if (res == WAIT_FAILED) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8073
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8074
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8075
    if (res == WAIT_TIMEOUT) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8076
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8077
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8078
    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
  8079
	RETURN (__ArrayInstPtr(fdOrHandleArray)->a_element[res-WAIT_OBJECT_0]);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8080
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8081
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8082
    RETURN (nil);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8083
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8084
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8085
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8086
     invalid arg,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8087
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8088
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8089
!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8090
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8091
waitForSingleObject:fdOrHandle withTimeout:millis
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8092
    "wait for an fd to become ready.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8093
     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
  8094
     Zero time can be used to poll a file-
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8095
     descriptors (i.e. to check if I/O possible without blocking).
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8096
     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
  8097
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8098
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8099
    INT t;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8100
    DWORD res;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8101
    HANDLE h = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8102
7662
32a1185158f3 process handles
Claus Gittinger <cg@exept.de>
parents: 7645
diff changeset
  8103
    if (__isExternalAddressLike(fdOrHandle)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8104
	h = _HANDLEVal(fdOrHandle);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8105
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8106
	if (__isSmallInteger(fdOrHandle)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8107
	    h = (HANDLE) _get_osfhandle (__intVal(fdOrHandle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8108
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8109
	    goto fail;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8110
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8111
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8112
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8113
    if (__isSmallInteger(millis)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8114
	t = __intVal(millis);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8115
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8116
	t = INFINITE;
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8117
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8118
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8119
#ifdef DO_WRAP_CALLS
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8120
    do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8121
	__threadErrno = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8122
	res = STX_API_CALL2( "WaitForSingleObject", WaitForSingleObject, h,  t);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8123
    } while ((res < 0) && (__threadErrno == EINTR));
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8124
#else
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8125
    res = WaitForSingleObject(h, t);
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  8126
    if (res < 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8127
	__threadErrno = __WIN32_ERR(GetLastError());
6259
164d7efc1eb2 api call stuff (more calls wrapped; care for EINTR)
Claus Gittinger <cg@exept.de>
parents: 6095
diff changeset
  8128
    }
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8129
#endif
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8130
    if (res == WAIT_FAILED) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8131
	RETURN (nil);
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8132
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8133
    if (res == WAIT_TIMEOUT) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8134
	RETURN (nil);
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
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8137
    RETURN (fdOrHandle);
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8138
fail: ;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8139
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8140
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8141
     invalid arg,
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8142
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8143
    ^ self primitiveFailed
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8144
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  8145
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8146
!Win32OperatingSystem::FileStatusInfo class methodsFor:'instance creation'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8147
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8148
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
  8149
    ^ self basicNew
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8150
	type:t mode:m uid:u gid:g size:s
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8151
	id:i accessed:aT modified:mT created:cT
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8152
	path:lP alternativeName:name2
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8153
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8154
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8155
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
  8156
    ^ self basicNew
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8157
	type:t mode:m uid:u gid:g size:s
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8158
	id:i accessed:aT modified:mT created:cT
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8159
	path:lP
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8160
	fullName:fullName
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8161
	alternativeName:name2
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8162
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8163
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8164
!Win32OperatingSystem::FileStatusInfo methodsFor:'accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8165
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8166
accessTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8167
    "return accessed"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8168
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8169
    ^ accessed
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8170
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8171
    "Created: / 1.2.2002 / 11:05:49 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8172
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8173
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8174
alternativeName
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8175
    "return the files other name (DOS name on windows).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8176
     Nil if there is no other name"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8177
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8178
    ^ alternativeName
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8179
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8180
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8181
creationTime
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8182
    ^ created
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8183
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8184
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8185
fileSize
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8186
    "return size"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8187
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8188
    ^ size
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8189
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8190
    "Created: / 1.2.2002 / 11:06:15 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8191
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8192
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8193
fixedHeaderSize
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8194
    "return the fixedHeaderSize (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8195
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8196
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8197
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8198
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8199
fullName
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8200
    "return the files real name (non-DOS name on windows).
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8201
     Nil if there is no other name"
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8202
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8203
    ^ fullName
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8204
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8205
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8206
gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8207
    "return gid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8208
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8209
    ^ gid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8210
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8211
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8212
id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8213
    "return id"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8214
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8215
    ^ id
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8216
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8217
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8218
mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8219
    "return mode"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8220
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8221
    ^ mode
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8222
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8223
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8224
modificationTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8225
    "return modified"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8226
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8227
    ^ modified
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8228
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8229
    "Created: / 1.2.2002 / 11:06:33 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8230
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8231
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8232
numLinks
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8233
    "DOS has no hardLinks - return 1"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8234
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8235
    ^ 1
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8236
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8237
    "Created: / 1.2.2002 / 11:07:04 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8238
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8239
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8240
path
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8241
    "for symbolic links only: return the path where the symbolic link points to"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8242
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8243
    ^ path
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8244
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8245
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8246
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8247
recordAttributes
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8248
    "return the recordAttributes (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8249
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8250
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8251
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8252
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8253
recordFormat
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8254
    "return the recordFormat (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8255
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8256
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8257
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8258
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8259
recordFormatNumeric
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8260
    "return the recordFormat as numeric (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8261
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8262
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8263
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8264
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8265
recordSize
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8266
    "return the recordSize (VMS only; nil everywhere else)"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8267
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8268
    ^ nil
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8269
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8270
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8271
size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8272
    "return size"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8273
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8274
    ^ size
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8275
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8276
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8277
statusChangeTime
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8278
    "return statusChanged"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8279
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8280
    ^ statusChanged ? modified
6372
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8281
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8282
    "Created: / 1.2.2002 / 11:07:27 / cg"
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8283
!
9cd3ac764491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  8284
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8285
type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8286
    "return type"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8287
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8288
    ^ type
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8289
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8290
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8291
uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8292
    "return uid"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8293
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8294
    ^ uid
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8295
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8296
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8297
!Win32OperatingSystem::FileStatusInfo methodsFor:'backward compatibility'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8298
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8299
accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8300
    "return accessed"
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8301
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8302
    <resource: #obsolete>
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8303
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8304
    self obsoleteMethodWarning:'use #accessTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8305
    ^ accessed
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8306
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8307
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8308
at:key
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8309
    "backward compatibility access: in previous releases, IdentityDictionaries
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8310
     were used to hold my information. Allow access via key messages.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8311
     This method will vanish - use the proper access protocol."
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8312
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8313
    ^ self perform:key
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8314
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8315
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8316
modified
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8317
    <resource: #obsolete>
9061
20af48b9b295 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9026
diff changeset
  8318
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8319
    self obsoleteMethodWarning:'use #modificationTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8320
    ^ modified
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8321
!
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8322
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8323
statusChanged
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8324
    <resource: #obsolete>
9061
20af48b9b295 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9026
diff changeset
  8325
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8326
    self obsoleteMethodWarning:'use #statusChangeTime'.
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8327
    ^ statusChanged
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8328
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8329
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8330
!Win32OperatingSystem::FileStatusInfo methodsFor:'private accessing'!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8331
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8332
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
  8333
    type := t.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8334
    mode := m.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8335
    uid := u.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8336
    gid := g.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8337
    size := s.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8338
    id := i.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8339
    accessed := aT.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8340
    modified := mT.
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
  8341
    created := cT.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8342
    path := lP.
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8343
    alternativeName := name2.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8344
!
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8345
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8346
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
  8347
    type := t.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8348
    mode := m.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8349
    uid := u.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8350
    gid := g.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8351
    size := s.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8352
    id := i.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8353
    accessed := aT.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8354
    modified := mT.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8355
    created := cT.
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8356
    path := lP.
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  8357
    fullName := name1.
7062
44e3fe28aea0 *** empty log message ***
penk
parents: 6799
diff changeset
  8358
    alternativeName := name2.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8359
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8360
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8361
!Win32OperatingSystem::FileStatusInfo methodsFor:'queries'!
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8362
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8363
isBlockSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8364
    ^ type == #characterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8365
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8366
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8367
isCharacterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8368
    ^ type == #characterSpecial
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8369
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8370
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8371
isDirectory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8372
    ^ type == #directory
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8373
!
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8374
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8375
isFifo
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8376
    ^ type == #fifo
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8377
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8378
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8379
isRegular
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8380
    ^ type == #regular
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8381
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8382
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8383
isSocket
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8384
    ^ type == #socket
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8385
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8386
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8387
isSymbolicLink
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8388
    ^ type == #symbolicLink
8476
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8389
!
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8390
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8391
isUnknown
4eb96fd9727a #linkInfoOf returns info even if a file is not a symbolic link.
Stefan Vogel <sv@exept.de>
parents: 8416
diff changeset
  8392
    ^ type == #unknown
6799
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8393
! !
568d31641c88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6791
diff changeset
  8394
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
  8395
!Win32OperatingSystem::OSProcessStatus class methodsFor:'documentation'!
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
  8396
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8397
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8398
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8399
    This is an auxillary class, that holds information about status changes of
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8400
    operating system processes (these are no smalltalk processes!!).
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8401
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8402
    [Instance variables:]
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8403
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8404
	pid     <Integer>       OS-Process identifier
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8405
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8406
	status  <Symbol>        either #exit #signal #stop #continue
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8407
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8408
	code    <Integer>       either exitcode or signalnumber
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8409
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8410
	core    <Boolean>       true if core has been dumped
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8411
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8412
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8413
    [author:]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8414
	Stefan Vogel
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8415
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8416
    [see also:]
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  8417
	OperatingSystem
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8418
"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8419
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8420
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8421
!Win32OperatingSystem::OSProcessStatus class methodsFor:'instance creation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8422
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8423
pid:pid status:status code:code core:core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8424
    "private interface for Win32OperatingSystem"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8425
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8426
    ^ self new pid:pid status:status code:code core:core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8427
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8428
    "Created: 28.12.1995 / 14:16:14 / stefan"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8429
    "Modified: 30.4.1996 / 18:25:00 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8430
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8431
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8432
processCreationFailure
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8433
    "private interface for Win32OperatingSystem"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8434
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8435
    ^ self new pid:-1 status:#failure code:-1 core:false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8436
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8437
    "Created: 28.12.1995 / 14:35:29 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8438
    "Modified: 30.4.1996 / 18:25:05 / cg"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8439
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8440
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8441
!Win32OperatingSystem::OSProcessStatus methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8442
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8443
code
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8444
    "return the exitcode / signalNumber"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8445
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8446
    ^ code
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8447
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8448
    "Created: 28.12.1995 / 14:05:07 / stefan"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8449
    "Modified: 30.4.1996 / 18:26:23 / cg"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8450
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8451
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8452
core
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8453
    "return true if core has been dumped, false otherwise"
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8454
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8455
    ^ core == true
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8456
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8457
    "Modified: 28.12.1995 / 14:14:38 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8458
!
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8459
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8460
pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8461
    "return the pid"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8462
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8463
    ^ pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8464
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8465
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8466
    "Modified: 30.4.1996 / 18:26:30 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8467
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8468
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8469
status
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8470
    "return status as a Symbol;
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8471
     one of #exit #signal #stop #continue"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8472
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8473
    ^ status
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8474
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8475
    "Created: 28.12.1995 / 14:05:07 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8476
    "Modified: 30.4.1996 / 18:26:54 / cg"
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8477
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8478
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8479
!Win32OperatingSystem::OSProcessStatus methodsFor:'initialization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8480
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8481
pid:newPid status:newStatus code:newCode core:newCore
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8482
    pid := newPid.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8483
    status := newStatus.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8484
    code := newCode.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8485
    core := newCore.
6275
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8486
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8487
    "Created: 28.12.1995 / 14:18:22 / stefan"
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8488
! !
8f08b99e7aaa comments
Claus Gittinger <cg@exept.de>
parents: 6271
diff changeset
  8489
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8490
!Win32OperatingSystem::OSProcessStatus methodsFor:'private-OS interface'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8491
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8492
code:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8493
    "set the exitCode"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8494
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8495
    code := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8496
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8497
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8498
    "Modified: 30.4.1996 / 18:25:18 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8499
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8500
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8501
core:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8502
    "set core"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8503
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8504
    core := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8505
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8506
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8507
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8508
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8509
pid:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8510
    "set pid"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8511
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8512
    pid := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8513
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8514
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8515
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8516
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8517
status:something
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8518
    "set status"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8519
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8520
    status := something.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8521
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8522
    "Created: 28.12.1995 / 14:05:07 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8523
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8524
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8525
!Win32OperatingSystem::OSProcessStatus methodsFor:'queries'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8526
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8527
couldNotExecute
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8528
    "return true when a command could not be executed"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8529
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8530
    ^ status == #exit and:[code = 127].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8531
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8532
    "Created: 28.12.1995 / 15:43:17 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8533
    "Modified: 30.4.1996 / 18:27:03 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8534
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8535
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8536
stillAlive
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8537
    "true if process is still alive"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8538
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8539
    ^ status == #stop or:[status == #continue]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8540
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8541
    "Created: 28.12.1995 / 14:27:26 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8542
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8543
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8544
success
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8545
    "true if process terminated successfully"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8546
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8547
    ^ status == #exit and:[code = 0]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8548
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8549
    "Created: 28.12.1995 / 14:13:05 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8550
    "Modified: 28.12.1995 / 14:13:41 / stefan"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8551
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8552
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8553
!Win32OperatingSystem::RegistryEntry class methodsFor:'defaults'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8554
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8555
rootKeyNames
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8556
    "returns a collection of root keyNames"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8557
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8558
    ^ #(
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8559
	'HKEY_CLASSES_ROOT'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8560
	'HKEY_CURRENT_USER'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8561
	'HKEY_LOCAL_MACHINE'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8562
	'HKEY_USERS'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8563
	'HKEY_PERFORMANCE_DATA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8564
	'HKEY_CURRENT_CONFIG'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8565
	'HKEY_DYN_DATA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8566
      )
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8567
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8568
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8569
separator
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8570
    "returns the registry-key-path separator character"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8571
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8572
    ^$\
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8573
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8574
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8575
!Win32OperatingSystem::RegistryEntry class methodsFor:'documentation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8576
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8577
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8578
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8579
    Interface to a WIN32 registry.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8580
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8581
    As this is a private class, access it via
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8582
	Win32OperatingSystem registryEntry
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8583
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8584
    [author:]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8585
	Claus Gittinger (initial version & cleanup)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8586
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8587
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8588
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8589
examples
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8590
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8591
    retrieve an existing entry by key:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8592
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8593
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8594
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8595
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8596
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8597
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8598
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8599
    retrieve a non-existing entry by key:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8600
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8601
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8602
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8603
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\xxx'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8604
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8605
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8606
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8607
    ask a keys value:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8608
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8609
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8610
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8611
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8612
	Transcript show:'Windows serial NR:'; showCR:(k valueNamed:'ProductId').
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8613
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8614
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8615
	Transcript showCR:(k valueNamed:'CurrentVersion').
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8616
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8617
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8618
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8619
    create a sub-key (if not already present):
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8620
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8621
	|k subKey|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8622
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8623
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8624
	subKey := k createSubKeyNamed:'RegistryDemo'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8625
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8626
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8627
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8628
    change a keys value:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8629
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8630
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8631
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8632
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8633
	k valueNamed:'FooBarBaz' put:'a foo bar baz string'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8634
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8635
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8636
    delete a value:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8637
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8638
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8639
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8640
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\RegistryDemo'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8641
	k deleteValueNamed:'FooBarBaz'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8642
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8643
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8644
    delete a key:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8645
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8646
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8647
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8648
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8649
	k deleteSubKeyNamed:'RegistryDemo'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8650
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8651
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8652
    enumerate keys:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8653
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8654
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8655
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8656
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8657
	k subKeysDo:[:subKey |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8658
	    Transcript showCR:subKey path
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8659
	]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8660
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8661
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8662
    enumerate all keys (recursive):
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8663
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8664
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8665
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8666
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\Software'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8667
	k allSubKeysDo:[:subKey |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8668
	    Transcript showCR:subKey path
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8669
	]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8670
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8671
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8672
    fetch value by index:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8673
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8674
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8675
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8676
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8677
	Transcript showCR:(k valueNameAtIndex:0)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8678
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8679
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8680
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8681
    enumerate value names:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8682
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8683
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8684
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8685
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8686
	k valueNamesDo:[:nm  |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8687
	   Transcript showCR:nm.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8688
	]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8689
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8690
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8691
    enumerate values:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8692
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8693
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8694
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8695
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8696
	k valueNamesAndValuesDo:[:nm :val |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8697
	    Transcript showCR:(nm , ' -> ' , val storeString).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8698
	]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8699
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8700
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8701
    search for a value (where does NT store the domain ?):
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8702
									[exBegin]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8703
	|k|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8704
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8705
	k := Win32OperatingSystem registryEntry key:'HKEY_LOCAL_MACHINE\System'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8706
	k subKeysDo:[:subKey |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8707
	    subKey subKeysDo:[:subSubKey |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8708
		|tcp params|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8709
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8710
		(subSubKey path asLowercase endsWith:'services') ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8711
		    tcp := subSubKey subKeyNamed:'tcpip'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8712
		    tcp notNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8713
			params := tcp subKeyNamed:'parameters'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8714
			params notNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8715
			    Transcript showCR:'Domain is found in ' , params path ,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8716
					' value: ' , (params valueNamed:'Domain').
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8717
			    params close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8718
			].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8719
			tcp close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8720
		    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8721
		]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8722
	    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8723
	]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8724
									[exEnd]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8725
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8726
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8727
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8728
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8729
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8730
!Win32OperatingSystem::RegistryEntry class methodsFor:'initialization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8731
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8732
initialize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8733
    Lobby := Registry new.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8734
    ObjectMemory addDependent:self.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8735
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8736
    HKEY_CLASSES_ROOT     := %{ __MKEXTERNALADDRESS(HKEY_CLASSES_ROOT) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8737
    HKEY_CURRENT_USER     := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_USER) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8738
    HKEY_LOCAL_MACHINE    := %{ __MKEXTERNALADDRESS(HKEY_LOCAL_MACHINE) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8739
    HKEY_USERS            := %{ __MKEXTERNALADDRESS(HKEY_USERS) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8740
    HKEY_PERFORMANCE_DATA := %{ __MKEXTERNALADDRESS(HKEY_PERFORMANCE_DATA) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8741
    HKEY_CURRENT_CONFIG   := %{ __MKEXTERNALADDRESS(HKEY_CURRENT_CONFIG) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8742
    HKEY_DYN_DATA         := %{ __MKEXTERNALADDRESS(HKEY_DYN_DATA) %}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8743
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8744
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8745
	self initialize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8746
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8747
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8748
    "Created: / 19.5.1999 / 21:39:57 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8749
    "Modified: / 19.5.1999 / 22:45:31 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8750
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8751
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8752
rootKeyValueFor:specialKeyStringOrSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8753
    "returns one of the root keys or nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8754
     (these are shared and not finalized, as opposed to all other keys)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8755
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8756
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8757
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8758
    specialKeyStringOrSymbol = #'HKEY_CLASSES_ROOT' ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8759
	^ HKEY_CLASSES_ROOT.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8760
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8761
    specialKeyStringOrSymbol = #'HKEY_CURRENT_USER' ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8762
	^ HKEY_CURRENT_USER.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8763
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8764
    specialKeyStringOrSymbol = #'HKEY_LOCAL_MACHINE' ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8765
	^ HKEY_LOCAL_MACHINE.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8766
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8767
    specialKeyStringOrSymbol = #'HKEY_USERS' ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8768
	^ HKEY_USERS.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8769
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8770
    specialKeyStringOrSymbol = #'HKEY_PERFORMANCE_DATA' ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8771
	^ HKEY_PERFORMANCE_DATA.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8772
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8773
    specialKeyStringOrSymbol = #'HKEY_CURRENT_CONFIG' ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8774
	^ HKEY_CURRENT_CONFIG.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8775
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8776
    specialKeyStringOrSymbol = #'HKEY_DYN_DATA' ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8777
	^ HKEY_DYN_DATA.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8778
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8779
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8780
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8781
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8782
    "Created: / 19.5.1999 / 21:40:30 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8783
    "Modified: / 24.12.1999 / 00:02:06 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8784
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8785
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8786
update:something with:aParameter from:changedObject
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8787
    "handle image restarts and refetch registry handles"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8788
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8789
    (something == #returnFromSnapshot) ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8790
	self initialize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8791
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8792
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8793
    "Created: 15.6.1996 / 15:14:03 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8794
    "Modified: 24.2.1997 / 22:08:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8795
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8796
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8797
!Win32OperatingSystem::RegistryEntry class methodsFor:'instance creation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8798
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8799
immediateHandle:aHandleValue
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8800
    |h newEntry|
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8801
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8802
    aHandleValue isInteger ifTrue:[
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8803
        h := ExternalAddress newAddress:aHandleValue    
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8804
    ] ifFalse:[
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8805
        h := aHandleValue    
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8806
    ].
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8807
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8808
    "/ rootKeys are not registered for RegClose ...
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8809
    newEntry := self basicNew setHandle:h path:nil.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8810
    newEntry registerForFinalization.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8811
    ^ newEntry.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8812
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8813
    "
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8814
     RegistryEntry immediateHandle:16r80000002
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8815
    "
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8816
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8817
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8818
key:aKeyNamePath
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8819
    "retrieve an entry by full path name (starting at a root)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8820
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8821
    |idx first rest root|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8822
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8823
    HKEY_CLASSES_ROOT isNil ifTrue:[self initialize].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8824
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8825
    idx := aKeyNamePath indexOf:(self separator).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8826
    idx == 0 ifTrue:[
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  8827
	first := aKeyNamePath.
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  8828
	rest := nil.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8829
    ] ifFalse:[
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  8830
	first := aKeyNamePath copyTo:idx-1.
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  8831
	rest := aKeyNamePath copyFrom:idx+1
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8832
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8833
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8834
    first := first asUppercase.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8835
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8836
    "/ the first is a pseudo name
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8837
    root := self rootKey:first.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8838
    root isNil ifTrue:[
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  8839
	^ nil
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8840
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8841
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8842
    rest size == 0 ifTrue:[
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  8843
	^ root
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8844
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8845
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8846
    ^ root subKeyNamed:rest.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8847
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8848
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8849
     self key:'HKEY_LOCAL_MACHINE'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8850
     self key:'HKEY_LOCAL_MACHINE\Software'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8851
     self key:'HKEY_LOCAL_MACHINE\Software\Borland\'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8852
     self key:'HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\3.2.5\Directory'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8853
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') valueNamed:''
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8854
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8855
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8856
    "Modified: / 24.12.1999 / 00:01:52 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8857
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8858
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8859
rootKey:aRootKeyStringOrSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8860
    "retrieve one of the root entries by name"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8861
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8862
    |keyVal|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8863
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8864
    keyVal := self rootKeyValueFor:aRootKeyStringOrSymbol.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8865
    keyVal isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8866
    "/ rootKeys are not registered for RegClose ...
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8867
    ^ self basicNew setHandle:keyVal path:aRootKeyStringOrSymbol.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8868
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8869
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8870
     RegistryEntry rootKey:#'HKEY_LOCAL_MACHINE'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8871
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8872
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8873
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8874
!Win32OperatingSystem::RegistryEntry class methodsFor:'misc queries'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8875
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8876
classIDOf:applicationName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8877
    |k clsIDString|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8878
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8879
    k := self key:'HKEY_CLASSES_ROOT\',applicationName,'\CLSID'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8880
    k isNil ifTrue:[ ^ nil ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8881
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8882
    clsIDString := k defaultValue.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8883
    k close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8884
    ^ UUID fromString:clsIDString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8885
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8886
    "
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  8887
     self classIDOf:'MicrosoftWorks.WordProcessor'
9167
aaf9ce008153 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9166
diff changeset
  8888
     self classIDOf:'AcroPDF.PDF'
aaf9ce008153 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9166
diff changeset
  8889
     self classIDOf:'PDF.PdfCtrl.5'
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8890
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8891
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8892
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8893
executableForMimeType:mimeType
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8894
    "given a mimeType, retrieve the path to an application from the registry"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8895
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8896
    |k suffix|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8897
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8898
    k := self key:'HKEY_CLASSES_ROOT\MIME\Database\Content Type\',mimeType.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8899
    k notNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8900
	suffix := k valueNamed:'extension'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8901
	suffix notNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8902
	    ^ self executableForSuffix:suffix
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8903
	].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8904
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8905
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8906
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8907
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8908
     Win32OperatingSystem::RegistryEntry executableForMimeType:'application/pdf'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8909
     Win32OperatingSystem::RegistryEntry executableForMimeType:'audio/mp3'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8910
     Win32OperatingSystem::RegistryEntry executableForMimeType:'video/avi'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8911
     Win32OperatingSystem::RegistryEntry executableForMimeType:'application/x-zip-compressed'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8912
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8913
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8914
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8915
executableForSuffix:suffixArg
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8916
    "given a suffix, retrieve the path to an application from the registry"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8917
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8918
    |k fkey cmd suffix|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8919
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8920
    suffix := suffixArg.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8921
    (suffix startsWith:'.') ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8922
	suffix := suffix copyFrom:2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8923
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8924
    k := self key:'HKEY_CLASSES_ROOT\.',suffix.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8925
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8926
    k notNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8927
	fkey := (k valueNamed:'').
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8928
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8929
    fkey isNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8930
	fkey := suffix,'_auto_file'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8931
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8932
    fkey notEmptyOrNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8933
	k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , fkey , '\shell\open\command').
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8934
	k notNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8935
	    cmd := k valueNamed:''
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8936
	].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8937
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8938
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8939
    ^ cmd
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8940
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8941
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8942
     self executableForSuffix:'pdf'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8943
     self executableForSuffix:'zip'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8944
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8945
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8946
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8947
!Win32OperatingSystem::RegistryEntry class methodsFor:'registry access'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8948
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8949
stringValueFor:valueName atKey:keyPath
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8950
    "convenient accessing method;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8951
     Looks for a string value under keyPath;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8952
     returns nil if either not found, or no string value"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8953
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8954
    |k v|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8955
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8956
    k := self key:keyPath.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8957
    k isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8958
    v := k valueNamed:valueName.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8959
    k close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8960
    v isString ifFalse:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8961
    ^ v
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8962
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8963
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8964
     self
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8965
	stringValueFor:'Content Type'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8966
	atKey:'HKEY_CLASSES_ROOT\.au'
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
  8967
    "
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
  8968
! !
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
  8969
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8970
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8971
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8972
handleValue
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8973
    ^ handle address
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8974
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  8975
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8976
name
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8977
    "return the keys name component (subKey name within my
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8978
     parent key)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8979
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8980
    |idx|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8981
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8982
    idx := path lastIndexOf:(self class separator).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8983
    idx == 0 ifTrue:[^ path].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8984
    ^ path copyFrom:idx+1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8985
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8986
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8987
path
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8988
    "return the keys full key path name"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8989
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8990
    ^ path.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8991
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8992
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8993
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing subkeys'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8994
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8995
createSubKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8996
    "create a new key below mySelf and return a new registry entry for it.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8997
     If it already exists, return it.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8998
     Return nil if the new key cannot be created."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  8999
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9000
    |newEntry subHandle|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9001
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9002
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9003
    HKEY myKey, subKey = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9004
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9005
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9006
     && (__isString(subKeyString) || __isSymbol(subKeyString))) {
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9007
        myKey = (HKEY)__externalAddressVal(__INST(handle));
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9008
        if (RegCreateKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9009
            subHandle = __MKEXTERNALADDRESS(subKey);
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9010
        }
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9011
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9012
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9013
    subHandle notNil ifTrue:[
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9014
        newEntry := self class basicNew
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9015
                        setHandle:subHandle
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9016
                        path:(path , self class separator asString , subKeyString).
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9017
        newEntry registerForFinalization.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9018
        ^ newEntry.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9019
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9020
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9021
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9022
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9023
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9024
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9025
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9026
     sub := top createSubKeyNamed:'FooBarBaz'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9027
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9028
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9029
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9030
deleteSubKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9031
    "delete a key below mySelf.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9032
     Return true on success."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9033
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9034
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9035
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9036
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9037
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9038
     && (__isString(subKeyString) || __isSymbol(subKeyString))) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9039
	myKey = (HKEY)__externalAddressVal(__INST(handle));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9040
	if (RegDeleteKey(myKey, __stringVal(subKeyString)) == ERROR_SUCCESS) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9041
	    RETURN (true);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9042
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9043
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9044
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9045
    ^ false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9046
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9047
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9048
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9049
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9050
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9051
     sub := top createSubKeyNamed:'FooBarBaz'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9052
     top deleteSubKeyNamed:'FooBarBaz'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9053
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9054
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9055
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9056
remoteKeyOnHost:hostName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9057
    "return the corresponding registry entry from
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9058
     a remote computers registry."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9059
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9060
    |newEntry remoteHandle|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9061
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9062
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9063
    HKEY myKey, remoteKey = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9064
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9065
    if (__isExternalAddressLike(__INST(handle)) && __isString(hostName)) {
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9066
        myKey = (HKEY)__externalAddressVal(__INST(handle));
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9067
        if (RegConnectRegistry(__stringVal(hostName), myKey, &remoteKey) == ERROR_SUCCESS) {
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9068
            remoteHandle = __MKEXTERNALADDRESS(remoteKey);
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9069
        }
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9070
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9071
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9072
    remoteHandle notNil ifTrue:[
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9073
        newEntry := self class basicNew setHandle:remoteHandle path:path.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9074
        newEntry registerForFinalization.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9075
        ^ newEntry.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9076
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9077
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9078
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9079
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9080
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9081
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9082
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9083
     remote := top remoteKeyOnHost:'BETTI'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9084
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9085
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9086
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9087
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9088
     top := self key:'HKEY_USERS'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9089
     remote := top remoteKeyOnHost:'BETTI'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9090
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9091
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9092
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9093
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9094
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9095
     remote := top remoteKeyOnHost:'JOSHUA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9096
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9097
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9098
     |top remote|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9099
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9100
     top := self key:'HKEY_USERS'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9101
     remote := top remoteKeyOnHost:'JOSHUA'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9102
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9103
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9104
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9105
subKeyAtIndex:subKeyIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9106
    "return a new registry entry below mySelf for the given subKey index.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9107
     Return nil if no such key exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9108
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9109
    |subKeyName subKeyClassName|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9110
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9111
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9112
    HKEY myKey, subKey = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9113
    char nameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9114
    DWORD nameSize = sizeof(nameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9115
    char classNameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9116
    DWORD classNameSize = sizeof(classNameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9117
    FILETIME modificationTime;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9118
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9119
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9120
     && __isSmallInteger(subKeyIndex)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9121
	myKey = (HKEY)__externalAddressVal(__INST(handle));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9122
	if (RegEnumKeyEx(myKey, __intVal(subKeyIndex),
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9123
			 nameBuffer, &nameSize,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9124
			 NULL,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9125
			 classNameBuffer, &classNameSize,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9126
			 &modificationTime) == ERROR_SUCCESS) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9127
	    nameBuffer[nameSize] = '\0';
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9128
	    classNameBuffer[classNameSize] = '\0';
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9129
	    subKeyName = __MKSTRING(nameBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9130
	    subKeyClassName = __MKSTRING(classNameBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9131
	} else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9132
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9133
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9134
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9135
    subKeyName isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9136
    ^ self subKeyNamed:subKeyName.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9137
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9138
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9139
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9140
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9141
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9142
     sub := top subKeyAtIndex:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9143
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9144
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9145
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9146
subKeyNamed:subKeyString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9147
    "return a new registry entry below mySelf with the given subKey.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9148
     Return nil if no such key exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9149
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9150
    |newEntry subHandle|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9151
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9152
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9153
    HKEY myKey, subKey = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9154
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9155
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9156
     && (__isString(subKeyString) || __isSymbol(subKeyString))) {
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9157
        myKey = (HKEY)__externalAddressVal(__INST(handle));
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9158
        if (RegOpenKey(myKey, __stringVal(subKeyString), &subKey) == ERROR_SUCCESS) {
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9159
            subHandle = __MKEXTERNALADDRESS(subKey);
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9160
        }
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9161
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9162
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9163
    subHandle notNil ifTrue:[
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9164
        newEntry := self class basicNew
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9165
                        setHandle:subHandle
9188
e1d727ed4ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9186
diff changeset
  9166
                        path:((path ? '?') , self class separator asString , subKeyString).
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9167
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9168
        newEntry registerForFinalization.
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9169
        ^ newEntry.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9170
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9171
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9172
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9173
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9174
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9175
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9176
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9177
     sub := top subKeyNamed:'Software'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9178
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9179
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9180
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9181
!Win32OperatingSystem::RegistryEntry methodsFor:'accessing values'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9182
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9183
defaultValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9184
    ^ self valueNamed:''
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9185
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9186
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9187
     (self key:'HKEY_CLASSES_ROOT\MicrosoftWorks.WordProcessor\CLSID') defaultValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9188
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9189
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9190
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9191
deleteValueNamed:aValueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9192
    "delete a value.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9193
     Return true on success."
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9194
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9195
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9196
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9197
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9198
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9199
     && (__isString(aValueName) || __isSymbol(aValueName))) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9200
	myKey = (HKEY)__externalAddressVal(__INST(handle));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9201
	if (RegDeleteValue(myKey, __stringVal(aValueName)) == ERROR_SUCCESS) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9202
	    RETURN (true);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9203
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9204
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9205
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9206
    ^ false
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9207
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9208
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9209
valueNameAtIndex:valueIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9210
    "return a values name for the given value index.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9211
     Return nil if no such value exists"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9212
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9213
    |valueName|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9214
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9215
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9216
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9217
    char nameBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9218
    DWORD nameSize = sizeof(nameBuffer) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9219
    DWORD valueType;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9220
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9221
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9222
     && __isSmallInteger(valueIndex)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9223
	myKey = (HKEY)__externalAddressVal(__INST(handle));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9224
	if (RegEnumValue(myKey, __intVal(valueIndex),
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9225
			 nameBuffer, &nameSize,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9226
			 NULL,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9227
			 &valueType,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9228
			 NULL, NULL) == ERROR_SUCCESS) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9229
	    nameBuffer[nameSize] = '\0';
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9230
	    valueName = __MKSTRING(nameBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9231
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9232
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9233
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9234
    ^ valueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9235
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9236
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9237
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9238
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9239
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9240
     sub := top subKeyAtIndex:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9241
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9242
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9243
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9244
valueNamed:aValueName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9245
    "retrieve a value; the returned object depends upon the type:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9246
	REG_BINARY      -> ByteArray
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9247
	REG_SZ          -> String
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9248
	REG_MULTI_SZ    -> Array of strings
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9249
	REG_DWORD       -> Integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9250
	REG_NONE        -> nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9251
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9252
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9253
    |data stringArray|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9254
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9255
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9256
    DWORD valueType;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9257
    union {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9258
	DWORD dWord;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9259
	unsigned char dWordBytes[4];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9260
	unsigned char smallDataBuffer[256];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9261
    } quickData;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9262
    int val;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9263
    DWORD dataSize = sizeof(quickData);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9264
    unsigned char *dataBuffer = NULL;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9265
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9266
    if (__isExternalAddressLike(__INST(handle))
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9267
     && (__isString(aValueName) || __isSymbol(aValueName))) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9268
	int ret;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9269
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9270
	myKey = (HKEY)__externalAddressVal(__INST(handle));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9271
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9272
	/*
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9273
	 * try to get it with one call ...
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9274
	 */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9275
	ret = RegQueryValueEx(myKey, __stringVal(aValueName),
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9276
			 NULL,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9277
			 &valueType,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9278
			 (char *)&quickData,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9279
			 &dataSize);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9280
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9281
	if (ret == ERROR_MORE_DATA) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9282
	    /*
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9283
	     * nope - need another one ...
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9284
	     */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9285
	    switch (valueType) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9286
		case REG_BINARY:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9287
		case REG_MULTI_SZ:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9288
		    data = __BYTEARRAY_UNINITIALIZED_NEW_INT(dataSize);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9289
		    dataBuffer = __ByteArrayInstPtr(data)->ba_element;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9290
		    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9291
		case REG_SZ:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9292
		    data = __MKEMPTYSTRING(dataSize-1);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9293
		    dataBuffer = __stringVal(data);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9294
		    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9295
	    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9296
	    if (dataBuffer) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9297
		ret = RegQueryValueEx(myKey, __stringVal(aValueName),
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9298
				 NULL,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9299
				 &valueType,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9300
				 dataBuffer, &dataSize);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9301
	    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9302
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9303
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9304
	if (ret == ERROR_SUCCESS) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9305
	    switch (valueType) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9306
		case REG_NONE:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9307
		    /* RETURN (@symbol(none));  */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9308
		    RETURN (nil);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9309
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9310
		case REG_BINARY:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9311
		    /*
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9312
		     * did we get it with the first call ?
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9313
		     */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9314
		    if (! dataBuffer) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9315
			data = __MKBYTEARRAY(quickData.smallDataBuffer, dataSize);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9316
		    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9317
		    RETURN (data);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9318
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9319
		case REG_SZ:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9320
		case REG_EXPAND_SZ:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9321
		    /*
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9322
		     * did we get it with the first call ?
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9323
		     */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9324
		    if (! dataBuffer) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9325
			data = __MKSTRING_L(quickData.smallDataBuffer, dataSize-1);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9326
		    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9327
		    RETURN (data);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9328
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9329
#if 0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9330
		case REG_DWORD:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9331
		    /* int in native format */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9332
		    RETURN (__MKUINT(quickData.dWord));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9333
#endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9334
		case REG_DWORD_LITTLE_ENDIAN:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9335
		    val = quickData.dWordBytes[3];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9336
		    val = (val << 8) | quickData.dWordBytes[2];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9337
		    val = (val << 8) | quickData.dWordBytes[1];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9338
		    val = (val << 8) | quickData.dWordBytes[0];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9339
		    RETURN (__MKUINT(val));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9340
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9341
		case REG_DWORD_BIG_ENDIAN:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9342
		    val = quickData.dWordBytes[0];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9343
		    val = (val << 8) | quickData.dWordBytes[1];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9344
		    val = (val << 8) | quickData.dWordBytes[2];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9345
		    val = (val << 8) | quickData.dWordBytes[3];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9346
		    RETURN (__MKUINT(val));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9347
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9348
		case REG_MULTI_SZ:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9349
		    {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9350
			char *cp, *cp0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9351
			int ns = 0, i;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9352
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9353
			cp0 = dataBuffer ? dataBuffer : quickData.smallDataBuffer;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9354
			cp = cp0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9355
			while (*cp) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9356
			    while (*cp++) ;;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9357
			    ns++;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9358
			    cp++;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9359
			}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9360
			stringArray = __ARRAY_NEW_INT(ns);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9361
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9362
			i = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9363
			while (*cp0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9364
			    OBJ s;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9365
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9366
			    cp = cp0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9367
			    while (*cp++) ;;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9368
			    s = __MKSTRING(cp0); __ArrayInstPtr(stringArray)->a_element[i] = s; __STORE(stringArray, s);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9369
			    cp++;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9370
			    cp0 = cp;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9371
			    i++;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9372
			}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9373
			RETURN (stringArray);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9374
		    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9375
	    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9376
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9377
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9378
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9379
    ^ nil
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9380
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9381
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9382
     |key|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9383
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9384
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9385
     key valueNamed:'CurrentVersion'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9386
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9387
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9388
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9389
valueNamed:aValueName put:datum
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9390
    "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
  9391
	ByteArray       -> REG_BINARY
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9392
	String          -> REG_SZ
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9393
	Array of string -> REG_MULTI_SZ
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9394
	Integer         -> REG_DWORD
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9395
	nil             -> REG_NONE
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9396
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9397
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9398
    |data stringArray|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9399
%{
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9400
    HKEY myKey;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9401
    DWORD valueType = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9402
    int val;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9403
    DWORD dataSize = -1;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9404
    unsigned char *dataPointer = NULL;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9405
    int datumOk = 1, mustFreeData = 0;
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9406
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9407
    if (__isExternalAddressLike(__INST(handle))
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9408
     && (__isString(aValueName) || __isSymbol(aValueName))) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9409
	int ret;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9410
	OBJ cls;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9411
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9412
	myKey = (HKEY)__externalAddressVal(__INST(handle));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9413
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9414
	if (datum == nil) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9415
	    valueType = REG_NONE;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9416
	    dataSize = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9417
	} else if (__isSmallInteger(datum)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9418
	    valueType = REG_DWORD;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9419
	    val = __intVal(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9420
	    dataPointer = (unsigned char *)(&val);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9421
	    dataSize = sizeof(val);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9422
	} else if (__isString(datum) || __isSymbol(datum)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9423
	    valueType = REG_SZ;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9424
	    dataPointer = __stringVal(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9425
	    dataSize = __stringSize(datum) + 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9426
	} else if (__Class(datum) == ByteArray) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9427
	    valueType = REG_BINARY;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9428
	    dataPointer = __ByteArrayInstPtr(datum)->ba_element;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9429
	    dataSize = __byteArraySize(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9430
	} else if (__Class(datum) == LargeInteger) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9431
	    valueType = REG_DWORD;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9432
	    val = __longIntVal(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9433
	    if (val) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9434
		dataPointer = (unsigned char *)(&val);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9435
		dataSize = sizeof(val);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9436
	    } else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9437
		datumOk = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9438
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9439
	} else if (__Class(datum) == Array) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9440
	    int i = 0, ns = 0, totalSize = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9441
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9442
	    valueType = REG_MULTI_SZ;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9443
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9444
	    /*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9445
	     * must allocate a local buffer
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9446
	     * find size ...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9447
	     */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9448
	    for (i=0; i<__arraySize(datum); i++) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9449
		OBJ s = __ArrayInstPtr(datum)->a_element[i];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9450
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9451
		if (__isString(datum) || __isSymbol(datum)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9452
		    totalSize += __stringSize(datum) + 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9453
		} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9454
		    datumOk = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9455
		    break;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9456
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9457
		ns++;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9458
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9459
	    if (datumOk) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9460
		char *cp;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9461
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9462
		/*
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9463
		 * allocate and fill...
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9464
		 */
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9465
		totalSize ++;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9466
		dataPointer = (char *)(malloc(totalSize));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9467
		mustFreeData = 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9468
		cp = dataPointer;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9469
		for (i=0; i<__arraySize(datum); i++) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9470
		    OBJ s = __ArrayInstPtr(datum)->a_element[i];
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9471
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9472
		    strcpy(cp, __stringVal(s));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9473
		    cp += __stringSize(datum);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9474
		    *cp++ = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9475
		}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9476
		*cp++ = '\0';
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9477
		dataSize = totalSize;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9478
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9479
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9480
	    datumOk = 0;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9481
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9482
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9483
	if (datumOk) {
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
  9484
	    ret = RegSetValueEx(myKey, __stringVal(aValueName),
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9485
				0, valueType,
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9486
				dataPointer, dataSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9487
	    if (mustFreeData) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9488
		free(dataPointer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9489
	    }
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9490
	    RETURN ((ret == ERROR_SUCCESS) ? true : false);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9491
	}
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9492
    }
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9493
%}.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9494
    ^ false
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9495
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9496
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9497
     |key|
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9498
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9499
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9500
     key valueNamed:'CurrentVersion' put:'3.5.2'
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9501
    "
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9502
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9503
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9504
!Win32OperatingSystem::RegistryEntry methodsFor:'enumeration'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9505
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9506
allSubKeysDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9507
    "recursively evaluate aBlock for all subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9508
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9509
    |idx subEntry|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9510
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9511
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9512
    [true] whileTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9513
	subEntry := self subKeyAtIndex:idx.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9514
	subEntry isNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9515
	    ^self
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9516
	].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9517
	aBlock value:subEntry.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9518
	subEntry allSubKeysDo:aBlock.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9519
	subEntry close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9520
	idx := idx + 1.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9521
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9522
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9523
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9524
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9525
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9526
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9527
     top allSubKeysDo:[:subEntry |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9528
	Transcript showCR:subEntry path
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9529
     ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9530
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9531
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9532
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9533
subKeys
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9534
    "return a collection of subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9535
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9536
    |idx subEntry subKeys|
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9537
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9538
    subKeys := OrderedCollection new.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9539
    self subKeysDo:[:k | subKeys add:k].
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9540
    ^ subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9541
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9542
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9543
     |top sub|
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9544
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9545
     top := self key:'HKEY_LOCAL_MACHINE'.
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9546
     top subKeys
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9547
    "
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9548
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9549
    "Created: / 23.12.1999 / 22:15:22 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9550
    "Modified: / 23.12.1999 / 22:15:44 / cg"
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9551
!
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
  9552
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9553
subKeysDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9554
    "evaluate aBlock for all subKeys below the receiver"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9555
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9556
    |idx subEntry|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9557
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9558
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9559
    [true] whileTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9560
	subEntry := self subKeyAtIndex:idx.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9561
	subEntry isNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9562
	    ^self
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9563
	].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9564
	aBlock value:subEntry.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9565
	subEntry close.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9566
	idx := idx + 1.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9567
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9568
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9569
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9570
     |top sub|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9571
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9572
     top := self key:'HKEY_LOCAL_MACHINE'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9573
     top subKeysDo:[:subEntry |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9574
	Transcript showCR:subEntry path
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9575
     ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9576
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9577
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9578
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9579
valueNamesAndValuesDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9580
    "evaluate aBlock for all value names"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9581
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9582
    self valueNamesDo:[:nm |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9583
	aBlock value:nm value:(self valueNamed:nm)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9584
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9585
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9586
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9587
     |key|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9588
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9589
     key := self key:'HKEY_LOCAL_MACHINE\SOFTWARE\eXept\Smalltalk/X'.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9590
     key valueNamesAndValuesDo:[:nm :val |
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9591
	Transcript showCR:(nm , ' -> ' , val storeString).
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9592
     ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9593
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9594
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9595
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9596
valueNamesDo:aBlock
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9597
    "evaluate aBlock for all value names"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9598
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9599
    |idx valueName|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9600
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9601
    idx := 0.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9602
    [true] whileTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9603
	valueName := self valueNameAtIndex:idx.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9604
	valueName isNil ifTrue:[
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9605
	    ^self
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9606
	].
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9607
	aBlock value:valueName.
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9608
	idx := idx + 1.
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9609
    ]
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9610
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9611
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9612
!Win32OperatingSystem::RegistryEntry methodsFor:'instance release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9613
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9614
close
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9615
    "close mySelf"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9616
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9617
    self closeKey.
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9618
    self unregisterForFinalization.
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9619
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9620
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9621
closeKey
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9622
    "close mySelf"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9623
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9624
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9625
    HKEY myKey;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9626
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9627
    if (__isExternalAddressLike(__INST(handle))) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9628
	myKey = (HKEY)(__externalAddressVal(__INST(handle)));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9629
	__INST(handle) = nil;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9630
	RegCloseKey(myKey);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9631
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9632
%}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9633
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9634
9186
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9635
finalizationLobby
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9636
    ^ Lobby
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9637
!
662a7b37a7c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9181
diff changeset
  9638
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9639
finalize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9640
    "some entry has been collected - close it"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9641
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9642
    handle notNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9643
	self closeKey.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9644
    ]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9645
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9646
    "Created: / 19.5.1999 / 22:39:52 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9647
    "Modified: / 19.5.1999 / 22:44:50 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9648
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9649
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9650
!Win32OperatingSystem::RegistryEntry methodsFor:'private'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9651
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9652
setHandle:aHandle path:aPathString
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9653
    handle := aHandle.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9654
    path := aPathString.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9655
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9656
    "Created: / 19.5.1999 / 22:27:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9657
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9658
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9659
setupForHandleValue:integerHandleValue
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9660
    "not normally used - given an integer address,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9661
     return a registry entry. This is provided to
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9662
     allow for future root keys to be added at the smalltalk level"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9663
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9664
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9665
    HKEY key;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9666
    OBJ t;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9667
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9668
    key = __longIntVal(integerHandleValue);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9669
    if (! key) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9670
	RETURN (nil);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9671
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9672
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9673
    t = __MKEXTERNALADDRESS(key); __INST(handle) = t; __STORE(self, t);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9674
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9675
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9676
    "Created: / 19.5.1999 / 21:45:05 / cg"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9677
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9678
9174
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9679
!Win32OperatingSystem::Win32Handle class methodsFor:'documentation'!
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9680
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9681
documentation
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9682
"
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9683
    I represent a non-I/O HANDLE.
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9684
"
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9685
! !
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9686
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9687
!Win32OperatingSystem::Win32Handle methodsFor:'release'!
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9688
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9689
close
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9690
    "close the handle"
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9691
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9692
    self closeHandle
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9693
!
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9694
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9695
closeHandle
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9696
    "close the handle"
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9697
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9698
%{
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9699
    HANDLE h = _HANDLEVal(self);
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9700
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9701
    if (h) {
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9702
	__externalAddressVal(self) = (HANDLE)0;
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9703
	CloseHandle(h);
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9704
    }
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9705
%}.
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9706
!
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9707
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9708
finalize
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9709
    "a filedescriptor was garbage collected - close the underlying handle"
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9710
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9711
    self closeHandle
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9712
! !
05b30808441c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9170
diff changeset
  9713
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9714
!Win32OperatingSystem::Win32IOHandle class methodsFor:'documentation'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9715
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9716
documentation
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9717
"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9718
    I represent a handle on which I/O is possible.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9719
    Typical instances are File-Handles, Socket-Handles etc.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9720
"
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9721
! !
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
  9722
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9723
!Win32OperatingSystem::Win32IOHandle methodsFor:'finalization'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9724
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9725
finalize
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9726
    "a handle was garbage collected - close the underlying file"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9727
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9728
    self closeFile
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9729
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9730
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9731
!Win32OperatingSystem::Win32IOHandle methodsFor:'io'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9732
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9733
readBytes:count into:aByteBuffer startingAt:firstIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9734
    "read count bytes into a byte-buffer;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9735
     Return the number of bytes read (negative on error)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9736
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9737
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9738
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9739
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9740
    unsigned char *extPtr;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9741
    int bufferIsExternalBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9742
    int mustFreeBuffer = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9743
    int nRead = -1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9744
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9745
    DWORD cntWanted, offs, cntRead;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9746
    int bufferSize;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9747
    char miniBuffer[32];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9748
    BOOL ok;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9749
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9750
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9751
	errSym = @symbol(errorNotOpen);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9752
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9753
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9754
    if (! __bothSmallInteger(count, firstIndex)) {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9755
	errSym = @symbol(badArgument);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9756
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9757
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9758
    cntWanted = __smallIntegerVal(count);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9759
    if (cntWanted <= 0) {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9760
	errSym = @symbol(badCount);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9761
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9762
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9763
    offs = __smallIntegerVal(firstIndex) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9764
    if (offs < 0) {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9765
	errSym = @symbol(badOffset);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9766
	goto bad;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9767
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9768
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9769
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9770
    if (! bufferIsExternalBytes) {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9771
	if (__isByteArray(aByteBuffer)) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9772
	    bufferSize = __byteArraySize(aByteBuffer);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9773
	} else if (__isString(aByteBuffer)) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9774
	    bufferSize = __stringSize(aByteBuffer);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9775
	} else {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9776
	    errSym = @symbol(badBuffer);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9777
	    goto bad;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9778
	}
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9779
	if (bufferSize < (cntWanted + offs)) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9780
	    errSym = @symbol(badBufferSize);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9781
	    goto bad;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9782
	}
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9783
	if (cntWanted <= sizeof(miniBuffer)) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9784
	    extPtr = miniBuffer;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9785
	} else {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9786
	    extPtr = malloc(cntWanted);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9787
	    mustFreeBuffer = 1;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9788
	}
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9789
    } else {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9790
	OBJ sz;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9791
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9792
	extPtr = (char *)(__externalBytesAddress(aByteBuffer));
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9793
	sz = __externalBytesSize(aByteBuffer);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9794
	if (! __isSmallInteger(sz)) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9795
	    errSym = @symbol(badBufferSize);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9796
	    goto bad;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9797
	}
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9798
	bufferSize = __smallIntegerVal(sz);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9799
	if (bufferSize < (cntWanted + offs)) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9800
	    errSym = @symbol(badBufferSize);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9801
	    goto bad;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9802
	}
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9803
	extPtr = extPtr + offs;
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9804
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9805
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9806
    do {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9807
	__threadErrno = 0;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9808
	ok = STX_API_CALL5( "ReadFile", ReadFile, hFile, extPtr, cntWanted, &cntRead, 0 /* lpOverlapped */);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9809
    } while(__threadErrno == EINTR);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9810
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9811
    if (ok == TRUE) {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9812
	if (! bufferIsExternalBytes) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9813
	    /* copy over */
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9814
	    memcpy(__byteArrayVal(aByteBuffer)+offs, extPtr, cntRead);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9815
	    if (mustFreeBuffer) {
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9816
		free(extPtr);
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9817
	    }
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9818
	}
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9819
	RETURN (__mkSmallInteger(cntRead));
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9820
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9821
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9822
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9823
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9824
    if (mustFreeBuffer) {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9825
	free(extPtr);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9826
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9827
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9828
9154
d7f8a015da92 more com experiments
Claus Gittinger <cg@exept.de>
parents: 9153
diff changeset
  9829
    errorNumber isNil ifTrue:[
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9830
	self error:'invalid argument(s): ', errSym.
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
  9831
    ] ifFalse:[
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
  9832
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
9155
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
  9833
    ].
8b2ca287c1bb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9154
diff changeset
  9834
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9835
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9836
     |h buff n|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9837
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9838
     h := self basicNew.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9839
     buff := ByteArray new:10.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9840
     n := h readBytes:10 into:buff startingAt:1.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9841
     Transcript show:n; show:' '; showCR:buff.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9842
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9843
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9844
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9845
readWaitWithTimeoutMs:millis
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9846
    "return true if a timeout occurred"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9847
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9848
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9849
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9850
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9851
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9852
    DWORD res;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9853
    INT t;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9854
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9855
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9856
	errSym = @symbol(errorNotOpen);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9857
	goto bad;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9858
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9859
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9860
#if 0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9861
    if (ioctlsocket((SOCKET)hFile, FIONREAD, &res)==0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9862
	/* its a socket */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9863
	if (res > 0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9864
	    RETURN ( false );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9865
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9866
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9867
    if (PeekNamedPipe(hFile, 0, 0, 0, &res, 0)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9868
	/* its a namedPipe */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9869
	if (res > 0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9870
	    RETURN ( false );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9871
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9872
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9873
#endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9874
    if (__isSmallInteger(millis)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9875
	t = __intVal(millis);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9876
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9877
	t = INFINITE;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9878
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9879
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9880
    do {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9881
	__threadErrno = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9882
	res = WaitForSingleObject(hFile, t);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9883
    } while (__threadErrno == EINTR);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9884
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9885
    switch (res) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9886
	case WAIT_OBJECT_0:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9887
	    /* signalled */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9888
	    RETURN ( false );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9889
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9890
	case WAIT_TIMEOUT:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9891
	    /* signalled */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9892
	    RETURN ( true );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9893
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9894
	default:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9895
	case WAIT_ABANDONED:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9896
	    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9897
	    goto bad;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9898
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9899
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9900
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9901
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9902
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9903
     timeout argument not integer,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9904
     or any fd-array nonNil and not an array
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9905
     or not supported by OS
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9906
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9907
    ^ self primitiveFailed
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9908
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9909
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9910
seekTo:newPosition from:whence
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9911
    "whence is one of:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9912
	#begin
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9913
	#current
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9914
	#end
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9915
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9916
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9917
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9918
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9919
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9920
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9921
    DWORD moveHow;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9922
    LONG posLo, posHi = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9923
    __uint64__ pos64, newPos64;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9924
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9925
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9926
	errSym = @symbol(errorNotOpen);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9927
	goto bad;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9928
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9929
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9930
    if (whence == @symbol(begin)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9931
	moveHow = FILE_BEGIN;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9932
    } else if (whence == @symbol(current)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9933
	moveHow = FILE_CURRENT;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9934
    } else if (whence == @symbol(end)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9935
	moveHow = FILE_END;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9936
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9937
	errSym = @symbol(badArgument2);
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9938
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9939
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9940
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9941
    if (__signedLong64IntVal(newPosition, &pos64) == 0) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9942
	errSym = @symbol(badArgument);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9943
	goto bad;
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9944
    }
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9945
    posLo = pos64.lo;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9946
    posHi = pos64.hi;
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9947
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9948
    posLo = SetFilePointer(hFile, posLo, &posHi, moveHow);
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9949
    if (posLo == 0xFFFFFFFF) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9950
	int lastError;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9951
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9952
	/* 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
  9953
	lastError = GetLastError();
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9954
	if (lastError != NO_ERROR) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9955
	    errorNumber = __mkSmallInteger( __WIN32_ERR(lastError) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9956
	    goto bad;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9957
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9958
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9959
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9960
    if (posHi == 0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9961
	RETURN (__MKUINT( posLo ));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9962
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9963
    newPos64.lo = posLo;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9964
    newPos64.hi = posHi;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9965
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9966
    RETURN ( __MKUINT64(&newPos64) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9967
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9968
bad: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9969
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9970
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9971
    errorNumber isNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9972
	self error:'invalid argument(s): ', errSym.
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9973
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9974
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6336
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9975
    ].
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9976
!
7accea3927f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
  9977
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9978
writeBytes:count from:aByteBuffer startingAt:firstIndex
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9979
    "write count bytes from a byte-buffer;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9980
     Return the number of bytes written (negative on error)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9981
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9982
    |errSym errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9983
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9984
    unsigned char *extPtr;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9985
    int bufferIsExternalBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9986
    int mustFreeBuffer = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9987
    int nWritten = -1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9988
    HANDLE hFile = (HANDLE)(__externalAddressVal(self));
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9989
    DWORD cntWanted, offs, cntWritten;
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9990
    int bufferSize;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9991
    char miniBuffer[32];
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
  9992
    BOOL ok;
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9993
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
  9994
    if ((hFile == 0) || (hFile == INVALID_HANDLE_VALUE)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9995
	errSym = @symbol(errorNotOpen);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
  9996
	goto bad;
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
  9997
    }
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9998
    if (! __bothSmallInteger(count, firstIndex)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
  9999
	errSym = @symbol(badArgument);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10000
	goto bad;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10001
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10002
    cntWanted = __smallIntegerVal(count);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10003
    if (cntWanted <= 0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10004
	errSym = @symbol(badCount);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10005
	goto bad;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10006
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10007
    offs = __smallIntegerVal(firstIndex) - 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10008
    if (offs < 0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10009
	errSym = @symbol(badOffset);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10010
	goto bad;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10011
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10012
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10013
    bufferIsExternalBytes = __isExternalBytesLike(aByteBuffer);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10014
    if (! bufferIsExternalBytes) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10015
	if (__isByteArray(aByteBuffer)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10016
	    bufferSize = __byteArraySize(aByteBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10017
	} else if (__isString(aByteBuffer)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10018
	    bufferSize = __stringSize(aByteBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10019
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10020
	    errSym = @symbol(badBuffer);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10021
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10022
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10023
	if (bufferSize < (cntWanted + offs)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10024
	    errSym = @symbol(badBufferSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10025
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10026
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10027
	if (cntWanted <= sizeof(miniBuffer)) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10028
	    extPtr = miniBuffer;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10029
	} else {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10030
	    extPtr = malloc(cntWanted);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10031
	    mustFreeBuffer = 1;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10032
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10033
	memcpy(extPtr, __byteArrayVal(aByteBuffer)+offs, cntWanted);
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10034
    } else {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10035
	extPtr = (char *)(__externalBytesAddress(aByteBuffer));
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10036
	bufferSize = __externalBytesSize(aByteBuffer);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10037
	if (! __isSmallInteger(bufferSize)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10038
	    errSym = @symbol(badBufferSize);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10039
	    goto bad;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10040
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10041
	bufferSize = __smallIntegerVal(bufferSize);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10042
	if (bufferSize < (cntWanted + offs)) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10043
	    errSym = @symbol(badBufferSize);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10044
	    goto bad;
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10045
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10046
	extPtr = extPtr + offs;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10047
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10048
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10049
    do {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10050
	__threadErrno = 0;
7852
5e0c389a8164 *** empty log message ***
ca
parents: 7850
diff changeset
 10051
	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
 10052
    } while(__threadErrno == EINTR);
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10053
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10054
    if (ok == TRUE) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10055
	if (mustFreeBuffer) {
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10056
	    free(extPtr);
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10057
	}
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10058
	RETURN (__mkSmallInteger(cntWritten));
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10059
    }
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10060
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10061
8265
34418449c41c Rename AbsoluteTime to Timestamp
Stefan Vogel <sv@exept.de>
parents: 8174
diff changeset
 10062
bad: ;
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10063
    if (mustFreeBuffer) {
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10064
	free(extPtr);
6338
7a927c5cc9f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6337
diff changeset
 10065
    }
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10066
%}.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 10067
    errorNumber isNil ifTrue:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10068
	self error:'invalid argument(s): ', errSym.
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 10069
    ] ifFalse:[
7199
922f78e7eb72 also handle subclasses of externalBytes
Claus Gittinger <cg@exept.de>
parents: 7158
diff changeset
 10070
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6304
c51a3d81ba5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6297
diff changeset
 10071
    ].
6293
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10072
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10073
    "
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10074
     |h buff n|
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10075
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10076
     h := self basicNew.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10077
     h setFileDescriptor:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10078
     buff := '12345678901234567890'.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10079
     n := h writeBytes:10 from:buff startingAt:1.
e73c204b9f1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6288
diff changeset
 10080
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10081
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10082
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10083
!Win32OperatingSystem::Win32IOHandle methodsFor:'release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10084
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10085
close
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10086
    "close the file"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10087
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10088
    self closeFile.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10089
    self unregisterForFinalization.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10090
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10091
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10092
closeFile
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10093
    "close the handle"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10094
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10095
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10096
    HANDLE h = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10097
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10098
    if (h) {
9170
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
 10099
	__externalAddressVal(self) = (HANDLE)0;
10277c16d1fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9169
diff changeset
 10100
	CloseHandle(h);
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10101
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10102
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10103
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10104
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10105
!Win32OperatingSystem::Win32ProcessHandle methodsFor:'accessing'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10106
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10107
pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10108
    ^ pid
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10109
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10110
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10111
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'opening'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10112
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10113
open:portName baudRate:baudRate stopBitsType:stopBitsType
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10114
		    parityType:parityType dataBits:dataBits
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10115
		    inFlowCtrl:inFlowCtrlType outFlowCtrl:outFlowCtrlType
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10116
		    xOnChar:xOnChar xOffChar:xOffChar
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10117
    "portName: COM%d
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10118
     baudRate: Integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10119
     stopBitsType: #stop1, #stop2 or #stop1_5
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10120
     parityType: #odd, #even or #none
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10121
     dataBits: #integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10122
     inFlowCtrlType: #xOnOff #hardware
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10123
     outFlowCtrlType: #xOnOff #hardware
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10124
     xOnChar: Character or Integer
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10125
     xOffChar: Character or Integer"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10126
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10127
    |errorNumber|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10128
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10129
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10130
    HANDLE port;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10131
    COMMTIMEOUTS timeouts;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10132
    DCB dcb;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10133
    char *__portName;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10134
    int __setBaudRate = 1,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10135
	__setDataBits = 1,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10136
	__setXOnChar = 1,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10137
	__setXOffChar = 1,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10138
	__setInFlowCtrl = 1,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10139
	__setOutFlowCtrl = 1,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10140
	__setStopBits = 1,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10141
	__setParityType = 1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10142
    int __baudRate, __dataBits;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10143
    int __xOnChar, __xOffChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10144
    int __inFlowCtrl, __outFlowCtrl;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10145
    int __stopBits, __parityType;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10146
#   define XONOFF       1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10147
#   define HARDWARE     2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10148
#   define STOP1     1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10149
#   define STOP2     2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10150
#   define STOP1_5   3
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10151
#   define ODD       1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10152
#   define EVEN      2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10153
#   define NONE      3
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10154
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10155
    if (__isString(portName)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10156
	__portName = __stringVal(portName);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10157
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10158
	goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10159
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10160
    if (__isSmallInteger(baudRate)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10161
	__baudRate = __intVal(baudRate);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10162
    } else if (baudRate == nil) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10163
	__setBaudRate = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10164
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10165
	goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10166
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10167
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10168
    if (__isSmallInteger(dataBits)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10169
	__dataBits = __intVal(dataBits);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10170
    } else if (dataBits == nil) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10171
	__setDataBits = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10172
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10173
	goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10174
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10175
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10176
    if (__isSmallInteger(xOnChar)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10177
	__xOnChar = __intVal(xOnChar);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10178
    } else if (__isCharacter(xOnChar)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10179
	__xOnChar = __intVal(_characterVal(xOnChar));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10180
    } else if (xOnChar == nil) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10181
	__setXOnChar = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10182
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10183
	goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10184
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10185
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10186
    if (__isSmallInteger(xOffChar)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10187
	__xOffChar = __intVal(xOffChar);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10188
    } else if (__isCharacter(xOffChar)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10189
	__xOffChar = __intVal(_characterVal(xOffChar));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10190
    } else if (xOffChar == nil) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10191
	__setXOffChar = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10192
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10193
	goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10194
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10195
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10196
    if (inFlowCtrlType == @symbol(xOnOff)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10197
	__inFlowCtrl = XONOFF;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10198
    } else if (inFlowCtrlType == @symbol(hardware)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10199
	__inFlowCtrl = HARDWARE;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10200
    } else if (inFlowCtrlType == nil) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10201
	__setInFlowCtrl = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10202
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10203
	goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10204
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10205
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10206
    if (outFlowCtrlType == @symbol(xOnOff)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10207
	__outFlowCtrl = XONOFF;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10208
    } else if (outFlowCtrlType == @symbol(hardware)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10209
	__outFlowCtrl = HARDWARE;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10210
    } else if (outFlowCtrlType == nil) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10211
	__setOutFlowCtrl = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10212
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10213
	goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10214
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10215
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10216
    if (stopBitsType == @symbol(stop1)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10217
	__stopBits = STOP1;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10218
    } else if (stopBitsType == @symbol(stop2)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10219
	__stopBits = STOP2;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10220
    } else if (stopBitsType == @symbol(stop1_5)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10221
	__stopBits = STOP1_5;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10222
    } else if (stopBitsType == nil) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10223
	__setStopBits = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10224
    } else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10225
	goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10226
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10227
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10228
    port = CreateFile(__portName,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10229
	      GENERIC_READ | GENERIC_WRITE,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10230
	      0,             /* comm devices must be opened with exclusive access */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10231
	      NULL,          /* no security attrs */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10232
	      OPEN_EXISTING, /* comm devices must use OPEN_EXISTING */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10233
	      0,             /* no overlapped I/O */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10234
	      NULL           /* hTemplate must be NULL for comm devices */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10235
	   );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10236
    if (port == INVALID_HANDLE_VALUE) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10237
	fprintf(stderr, "Win32OS [info]: serial port open failed\n");
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10238
	errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10239
	goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10240
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10241
    /* Flush the driver */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10242
    PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10243
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10244
    /* Set driver buffer sizes */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10245
    SetupComm( port, 4096 /*SERIAL_IN_QUEUE_SIZE*/, 4096 /*SERIAL_OUT_QUEUE_SIZE*/);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10246
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10247
    /* Reset timeout constants */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10248
    timeouts.ReadIntervalTimeout= 0xFFFFFFFF;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10249
    timeouts.ReadTotalTimeoutMultiplier = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10250
    timeouts.ReadTotalTimeoutConstant = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10251
    timeouts.WriteTotalTimeoutMultiplier = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10252
    timeouts.WriteTotalTimeoutConstant = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10253
    SetCommTimeouts( port, &timeouts );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10254
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10255
    /* Set communication parameters */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10256
    ZeroMemory(&dcb, sizeof(dcb));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10257
    dcb.DCBlength = sizeof(dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10258
    GetCommState(port, &dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10259
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10260
    if (__setBaudRate) dcb.BaudRate = __baudRate;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10261
    if (__setDataBits) dcb.ByteSize = __dataBits;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10262
    if (__setXOnChar)  dcb.XonChar = __xOnChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10263
    if (__setXOffChar) dcb.XoffChar = __xOffChar;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10264
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10265
    if (__setStopBits) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10266
	/* set stop bits */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10267
	switch(__stopBits) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10268
	    case STOP1_5: dcb.StopBits = 1; break; /* 1.5 stop bits */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10269
	    case STOP1: dcb.StopBits = 0; break; /* 1 stop bit */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10270
	    case STOP2: dcb.StopBits = 2; break; /* 2 stop bits */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10271
	    default: goto errExit;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10272
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10273
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10274
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10275
    if (__setParityType) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10276
	/* set parity */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10277
	switch(__parityType) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10278
	    case NONE: dcb.Parity = NOPARITY; break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10279
	    case ODD: dcb.Parity = ODDPARITY; break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10280
	    case EVEN: dcb.Parity = EVENPARITY; break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10281
	    default: goto errExit;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10282
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10283
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10284
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10285
    if (__setInFlowCtrl) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10286
	/* set control flow */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10287
	dcb.fInX = FALSE;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10288
	dcb.fDtrControl = FALSE;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10289
	if (__inFlowCtrl == XONOFF) dcb.fInX = TRUE;  /* XOn/XOff handshaking */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10290
	if (__inFlowCtrl == HARDWARE) dcb.fDtrControl = TRUE;  /* hardware handshaking */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10291
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10292
    if (__setOutFlowCtrl) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10293
	dcb.fOutX = FALSE;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10294
	dcb.fOutxCtsFlow = FALSE;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10295
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10296
	if (__outFlowCtrl == XONOFF) dcb.fOutX = TRUE;  /* XOn/XOff handshaking */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10297
	if (__outFlowCtrl == HARDWARE) dcb.fOutxCtsFlow = TRUE;  /* hardware handshaking */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10298
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10299
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10300
    if (SetCommState(port, &dcb)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10301
	RETURN( true );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10302
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10303
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10304
    fprintf(stderr, "Win32OS [info]: serial port comm-setup failed\n");
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10305
    errorNumber = __mkSmallInteger( __WIN32_ERR(GetLastError()) );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10306
    /* fall into */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10307
errExit: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10308
    CloseHandle(port);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10309
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10310
failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10311
#   undef XONOFF
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10312
#   undef HARDWARE
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10313
#   undef STOP1
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10314
#   undef STOP2
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10315
#   undef STOP1_5
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10316
#   undef ODD
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10317
#   undef EVEN
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10318
#   undef NONE
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10319
%}.
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10320
    errorNumber isNil ifTrue:[
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10321
	self error:'invalid argument(s)'.
9088
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10322
    ] ifFalse:[
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10323
	(OperatingSystem errorHolderForNumber:errorNumber) reportError
6ae1b16f69a7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9083
diff changeset
 10324
    ].
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10325
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10326
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10327
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'release'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10328
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10329
closeFile
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10330
    "close the handle"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10331
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10332
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10333
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10334
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10335
    if (port) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10336
	__externalAddressVal(self) = (HANDLE)0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10337
	PurgeComm( port, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10338
	CloseHandle(port);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10339
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10340
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10341
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10342
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10343
!Win32OperatingSystem::Win32SerialPortHandle methodsFor:'setup'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10344
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10345
baudRate:newRate
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10346
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10347
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10348
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10349
    if (port
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10350
     && __isSmallInteger(newRate)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10351
	DCB dcb;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10352
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10353
	ZeroMemory(&dcb, sizeof(dcb));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10354
	dcb.DCBlength = sizeof(dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10355
	GetCommState(port, &dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10356
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10357
	dcb.BaudRate = __intVal(newRate);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10358
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10359
	if (! SetCommState(port, &dcb)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10360
	    RETURN(false);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10361
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10362
	RETURN(true);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10363
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10364
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10365
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10366
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10367
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10368
dataBits:newNumberOfBits
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10369
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10370
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10371
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10372
    if (port
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10373
     && __isSmallInteger(newNumberOfBits)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10374
	DCB dcb;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10375
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10376
	ZeroMemory(&dcb, sizeof(dcb));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10377
	dcb.DCBlength = sizeof(dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10378
	GetCommState(port, &dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10379
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10380
	dcb.ByteSize = __intVal(newNumberOfBits);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10381
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10382
	if (! SetCommState(port, &dcb)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10383
	    RETURN(false);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10384
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10385
	RETURN(true);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10386
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10387
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10388
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10389
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10390
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10391
parityType:newParityTypeSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10392
    "newParityTypeSymbol must be one of #odd, #even or #none (or nil)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10393
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10394
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10395
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10396
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10397
    if (port) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10398
	DCB dcb;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10399
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10400
	ZeroMemory(&dcb, sizeof(dcb));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10401
	dcb.DCBlength = sizeof(dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10402
	GetCommState(port, &dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10403
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10404
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10405
	if ((newParityTypeSymbol == nil) || (newParityTypeSymbol == @symbol(none))) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10406
	    dcb.Parity = NOPARITY;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10407
	} else if (newParityTypeSymbol == @symbol(odd)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10408
	    dcb.Parity = ODDPARITY;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10409
	} else if (newParityTypeSymbol == @symbol(even)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10410
	    dcb.Parity = EVENPARITY;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10411
	} else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10412
	    goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10413
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10414
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10415
	if (! SetCommState(port, &dcb)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10416
	    RETURN(false);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10417
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10418
	RETURN(true);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10419
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10420
  failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10421
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10422
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10423
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10424
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10425
stopBitsType:newStopBitsSymbol
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10426
    "newParityTypeSymbol must be one of #stop1, #stop2 or #stop1_5"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10427
%{
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10428
    HANDLE port = (HANDLE)(__externalAddressVal(self));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10429
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10430
    if (port) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10431
	DCB dcb;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10432
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10433
	ZeroMemory(&dcb, sizeof(dcb));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10434
	dcb.DCBlength = sizeof(dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10435
	GetCommState(port, &dcb);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10436
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10437
	if (newStopBitsSymbol == @symbol(stop1)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10438
	    dcb.Parity = 0 /* STOP1 */;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10439
	} else if (newStopBitsSymbol == @symbol(stop2)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10440
	    dcb.Parity = 2 /* STOP2 */;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10441
	} else if (newStopBitsSymbol == @symbol(stop1_5)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10442
	    dcb.Parity = 1 /* STOP1_5 */;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10443
	} else {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10444
	    goto failure;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10445
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10446
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10447
	if (! SetCommState(port, &dcb)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10448
	    RETURN(false);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10449
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10450
	RETURN(true);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10451
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10452
  failure: ;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10453
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10454
    self primitiveFailed.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10455
! !
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10456
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10457
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'constants'!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10458
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10459
protocolCodeOf:aNameOrNumber
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10460
    "q&d hack for unix-compatibility"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10461
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10462
    aNameOrNumber isNumber ifTrue:[^ aNameOrNumber].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10463
    aNameOrNumber isNil ifTrue:[^ aNameOrNumber].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10464
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10465
    aNameOrNumber = 'tcp' ifTrue:[^ 6].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10466
    aNameOrNumber = 'udp' ifTrue:[^ 17].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10467
    aNameOrNumber = 'raw' ifTrue:[^ 255].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10468
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10469
    self error:'unsupported protocol' mayProceed:true.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10470
    ^ nil.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10471
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10472
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10473
     self protocolCodeOf:#tcp
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10474
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10475
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10476
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10477
protocolSymbolOf:anInteger
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10478
    "q&d hack for unix-compatibility"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10479
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10480
    anInteger isNil ifTrue:[^ nil].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10481
    anInteger isSymbol ifTrue:[^ anInteger].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10482
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10483
    anInteger ==   6 ifTrue:[ ^ #tcp ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10484
    anInteger ==  17 ifTrue:[ ^ #udp ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10485
    anInteger == 255 ifTrue:[ ^ #raw ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10486
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10487
    self error:'unsupported protocol' mayProceed:true.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10488
    ^ nil.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10489
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10490
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10491
     self protocolSymbolOf:6
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10492
    "
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10493
! !
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10494
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10495
!Win32OperatingSystem::Win32SocketHandle class methodsFor:'queries'!
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10496
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10497
getAddressInfo:hostName serviceName:serviceName domain:domainArg type:typeArg protocol:protoArg flags:flags
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10498
    "answer an Array of socket addresses for serviceName on hostName
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10499
     Domain, type, protocol may be nil or specify a hint for the socket
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10500
     addresses to be returned."
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10501
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10502
    |error errorString result domain type proto|
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10503
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10504
    domain := OperatingSystem domainCodeOf:domainArg.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10505
    type := OperatingSystem socketTypeCodeOf:typeArg.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10506
    proto := self protocolCodeOf:protoArg.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10507
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10508
%{ /* STACK:32000 */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10509
#if !defined(NO_SOCKET)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10510
    char *__hostName, *__serviceName;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10511
    int ret, cnt = 0;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10512
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10513
    if (hostName == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10514
	__hostName = 0;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10515
    } else if (__isString(hostName) || __isSymbol(hostName)) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10516
	__hostName = __stringVal(hostName);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10517
    } else {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10518
	error = @symbol(badArgument1);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10519
	goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10520
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10521
    if (serviceName == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10522
	__serviceName = 0;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10523
    } else if (__isString(serviceName) || __isSymbol(serviceName)) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10524
	__serviceName = __stringVal(serviceName);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10525
    } else {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10526
	error = @symbol(badArgument2);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10527
	goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10528
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10529
    if (__hostName == 0 && __serviceName == 0) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10530
	error = @symbol(badArgument);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10531
	goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10532
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10533
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10534
{
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10535
# if defined(AI_NUMERICHOST)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10536
    /*
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10537
     * Use getaddrinfo()
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10538
     */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10539
    struct addrinfo hints;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10540
    struct addrinfo *info = NULL, *infop;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10541
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10542
    memset(&hints, 0, sizeof(hints));
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10543
    if (__isSmallInteger(domain))
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10544
	hints.ai_family = __intVal(domain);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10545
    if (__isSmallInteger(type))
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10546
	hints.ai_socktype = __intVal(type);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10547
    if (__isSmallInteger(proto))
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10548
	hints.ai_protocol = __intVal(proto);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10549
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10550
    do {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10551
	/* must refetch in loop */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10552
	if (hostName == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10553
	    __hostName = 0;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10554
	} else if (__isString(hostName) || __isSymbol(hostName)) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10555
	    __hostName = __stringVal(hostName);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10556
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10557
	if (serviceName == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10558
	    __serviceName = 0;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10559
	} else if (__isString(serviceName) || __isSymbol(serviceName)) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10560
	    __serviceName = __stringVal(serviceName);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10561
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10562
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10563
# ifdef DO_WRAP_CALLS
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10564
	do {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10565
	    __threadErrno = 0;
8783
41f53c93fb79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8780
diff changeset
 10566
	    res = STX_WSA_CALL4( "getaddrinfo", getaddrinfo, __hostName, __serviceName, &hints, &info);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10567
	} while ((res < 0) && (__threadErrno == EINTR));
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10568
# else
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10569
	__BEGIN_INTERRUPTABLE__
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10570
	ret = getaddrinfo(__hostName, __serviceName, &hints, &info);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10571
	__END_INTERRUPTABLE__
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10572
# endif
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10573
    } while (ret == EAI_SYSTEM && errno == EINTR);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10574
    if (ret != 0) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10575
	switch (ret) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10576
	case EAI_FAMILY:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10577
	    error = @symbol(badProtocol);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10578
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10579
	case EAI_SOCKTYPE:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10580
	    error = @symbol(badSocketType);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10581
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10582
	case EAI_BADFLAGS:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10583
	    error = @symbol(badFlags);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10584
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10585
	case EAI_NONAME:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10586
	    error = @symbol(unknownHost);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10587
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10588
	case EAI_SERVICE:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10589
	    error = @symbol(unknownService);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10590
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10591
	case EAI_ADDRFAMILY :
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10592
	    error = @symbol(unknownHostForProtocol);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10593
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10594
	case EAI_NODATA:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10595
	    error = @symbol(noAddress);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10596
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10597
	case EAI_MEMORY:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10598
	    error = @symbol(allocationFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10599
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10600
	case EAI_FAIL:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10601
	    error = @symbol(permanentFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10602
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10603
	case EAI_AGAIN:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10604
	    error = @symbol(tryAgain);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10605
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10606
	case EAI_SYSTEM:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10607
	    error = @symbol(systemError);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10608
	    break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10609
	default:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10610
	    error = @symbol(unknownError);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10611
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10612
	errorString = __MKSTRING(gai_strerror(ret));
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10613
	goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10614
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10615
    for (cnt=0, infop=info; infop; infop=infop->ai_next)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10616
	cnt++;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10617
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10618
    result = __ARRAY_NEW_INT(cnt);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10619
    if (result == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10620
	error = @symbol(allocationFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10621
	goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10622
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10623
    for (infop=info, cnt=0; infop; infop=infop->ai_next, cnt++) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10624
	OBJ o, resp;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10625
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10626
	resp = __ARRAY_NEW_INT(6);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10627
	if (resp == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10628
	    error = @symbol(allocationFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10629
	    goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10630
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10631
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10632
	__ArrayInstPtr(result)->a_element[cnt] = resp; __STORE(result, resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10633
8912
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
 10634
	__ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(infop->ai_flags);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
 10635
	__ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(infop->ai_family);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
 10636
	__ArrayInstPtr(resp)->a_element[2] = __mkSmallInteger(infop->ai_socktype);
3d1947a79cf3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
 10637
	__ArrayInstPtr(resp)->a_element[3] = __mkSmallInteger(infop->ai_protocol);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10638
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10639
	__PROTECT__(resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10640
	o = __BYTEARRAY_NEW_INT(infop->ai_addrlen);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10641
	__UNPROTECT__(resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10642
	if (o == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10643
	    error = @symbol(allocationFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10644
	    goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10645
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10646
	memcpy(__byteArrayVal(o), infop->ai_addr, infop->ai_addrlen);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10647
       __ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10648
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10649
	if (infop->ai_canonname) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10650
	    __PROTECT__(resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10651
	    o = __MKSTRING(infop->ai_canonname);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10652
	    __UNPROTECT__(resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10653
	    if (o == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10654
		error = @symbol(allocationFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10655
		goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10656
	    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10657
	    __ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10658
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10659
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10660
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10661
err:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10662
    if (info) freeaddrinfo(info);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10663
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10664
# else /* ! AI_NUMERICHOST =============================================================*/
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10665
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10666
    /*
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10667
     * Use getservbyname() / gethostByName()
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10668
     */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10669
    struct hostent *hp;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10670
    char **addrpp;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10671
    int port = 0;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10672
    int i;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10673
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10674
    if (__serviceName) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10675
	struct servent *sp;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10676
	char *__proto = 0;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10677
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10678
	if (__isString(protoArg) || __isSymbol(protoArg))
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10679
	    __proto = __stringVal(protoArg);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10680
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10681
	sp = getservbyname(__serviceName, __proto);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10682
	if (sp == NULL) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10683
	    errorString = @symbol(unknownService);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10684
	    error = __mkSmallInteger(-3);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10685
	    goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10686
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10687
	port = sp->s_port;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10688
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10689
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10690
    if (__hostName) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10691
#  ifdef USE_H_ERRNO
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10692
	do {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10693
	    /* must refetch in loop */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10694
	    if (hostName == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10695
		__hostName = 0;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10696
	    } else if (__isString(hostName) || __isSymbol(hostName)) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10697
		__hostName = __stringVal(hostName);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10698
	    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10699
# ifdef DO_WRAP_CALLS
8783
41f53c93fb79 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8780
diff changeset
 10700
	    hp = STX_WSA_CALL1("gethostbyname", gethostbyname, __hostName);
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10701
	    if ((INT)hp < 0) hp = NULL;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10702
# else
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10703
	    /* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10704
	     * uses a static data area
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10705
	     */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10706
	    __BEGIN_INTERRUPTABLE__
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10707
	    hp = gethostbyname(__hostName);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10708
	    __END_INTERRUPTABLE__
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10709
#endif
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10710
	} while ((hp == NULL)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10711
		  && (
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10712
			(h_errno == TRY_AGAIN)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10713
		      || errno == EINTR
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10714
#   ifdef IRIX5_3
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10715
		      || (errno == ECONNREFUSED)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10716
#   endif
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10717
		     )
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10718
	);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10719
	if (hp == 0) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10720
	    switch (h_errno) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10721
	    case HOST_NOT_FOUND:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10722
		errorString = @symbol(unknownHost);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10723
		break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10724
	    case NO_ADDRESS:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10725
		errorString = @symbol(noAddress);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10726
		break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10727
	    case NO_RECOVERY:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10728
		errorString = @symbol(permanentFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10729
		break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10730
	    case TRY_AGAIN:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10731
		errorString = @symbol(tryAgain);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10732
		break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10733
	    default:
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10734
		errorString = @symbol(unknownError);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10735
		break;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10736
	    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10737
	    error = __mkSmallInteger(h_errno);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10738
	    goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10739
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10740
#  else /* !USE_H_ERRNO */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10741
	hp = gethostbyname(__hostName);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10742
	if (hp == 0) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10743
	    errorString = @symbol(unknownHost);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10744
	    error = __mkSmallInteger(-1);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10745
	    goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10746
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10747
#  endif /* !USE_H_ERRNO*/
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10748
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10749
	if (__isSmallInteger(domain) && hp->h_addrtype != __smallIntegerVal(domain)) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10750
	    errorString = @symbol(unknownHost);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10751
	    error = __mkSmallInteger(-2);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10752
	    goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10753
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10754
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10755
	for (cnt = 0, addrpp = hp->h_addr_list; *addrpp; addrpp++)
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10756
	    cnt++;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10757
	addrpp = hp->h_addr_list;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10758
    } else {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10759
	cnt = 1;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10760
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10761
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10762
    result = __ARRAY_NEW_INT(cnt);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10763
    if (result == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10764
	error = @symbol(allocationFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10765
	goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10766
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10767
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10768
    for (i = 0; i < cnt; i++) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10769
	OBJ o, resp;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10770
	struct sockaddr_in *sa;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10771
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10772
	resp = __ARRAY_NEW_INT(6);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10773
	if (resp == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10774
	    error = @symbol(allocationFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10775
	    goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10776
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10777
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10778
	__ArrayInstPtr(result)->a_element[i] = resp; __STORE(result, resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10779
	__ArrayInstPtr(resp)->a_element[0] = __mkSmallInteger(0);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10780
	__ArrayInstPtr(resp)->a_element[2] = type; __STORE(result, type);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10781
	__ArrayInstPtr(resp)->a_element[3] = proto; __STORE(result, proto);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10782
	__PROTECT__(resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10783
	o = __BYTEARRAY_NEW_INT(sizeof(*sa));
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10784
	__UNPROTECT__(resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10785
	if (o == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10786
	    error = @symbol(allocationFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10787
	    goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10788
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10789
	__ArrayInstPtr(resp)->a_element[4] = o; __STORE(resp, o);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10790
	sa = (struct sockaddr_in *)__byteArrayVal(o);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10791
	sa->sin_port = port;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10792
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10793
	if (__hostName) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10794
	    sa->sin_family = hp->h_addrtype;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10795
	    memcpy(&sa->sin_addr, *addrpp, hp->h_length);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10796
	    __ArrayInstPtr(resp)->a_element[1] = __mkSmallInteger(hp->h_addrtype);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10797
	    if (hp->h_name) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10798
		__PROTECT__(resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10799
		o = __MKSTRING(hp->h_name);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10800
		__UNPROTECT__(resp);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10801
		if (o == nil) {
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10802
		    error = @symbol(allocationFailure);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10803
		    goto err;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10804
		}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10805
		__ArrayInstPtr(resp)->a_element[5] = o; __STORE(resp, o);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10806
	    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10807
	    addrpp++;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10808
	} else{
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10809
	    __ArrayInstPtr(resp)->a_element[1] = domain; __STORE(resp, domain);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10810
	}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10811
    }
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10812
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10813
err:;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10814
# endif /* ! AI_NUMERICHOST */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10815
}
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10816
#else /* ! HAS_SOCKET */
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10817
    error = @symbol(notImplemented);
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10818
#endif
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10819
%}.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10820
    error notNil ifTrue:[
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10821
	|request|
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10822
	request := SocketAddressInfo new
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10823
	    domain:domainArg;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10824
	    type:typeArg;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10825
	    protocol:protoArg;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10826
	    canonicalName:hostName;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10827
	    serviceName:serviceName.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10828
	^ (HostNameLookupError new
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10829
		parameter:error;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10830
		messageText:' - ', errorString;
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10831
		request:request) raiseRequest.
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10832
    ].
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10833
    1 to:result size do:[:i |
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10834
	|entry dom info|
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10835
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10836
	info := SocketAddressInfo new.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10837
	entry := result at:i.
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10838
	info flags:(entry at:1).
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10839
	info domain:(dom := OperatingSystem domainSymbolOf:(entry at:2)).
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10840
	info type:(OperatingSystem socketTypeSymbolOf:(entry at:3)).
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10841
	info protocol:(self protocolSymbolOf:(entry at:4)).
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10842
	info socketAddress:((SocketAddress newDomain:dom) fromBytes:(entry at:5)).
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10843
	info canonicalName:(entry at:6).
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10844
	result at:i put:info
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 10845
    ].
8763
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10846
    ^ result
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10847
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10848
    "
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10849
     self getAddressInfo:'localhost' serviceName:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10850
	    domain:nil type:nil protocol:nil flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10851
     self getAddressInfo:'localhost' serviceName:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10852
	    domain:#inet type:#stream protocol:nil flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10853
     self getAddressInfo:'localhost' serviceName:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10854
	    domain:#inet type:#stream protocol:#tcp flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10855
     self getAddressInfo:'blurb.exept.de' serviceName:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10856
	    domain:#inet type:nil protocol:nil flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10857
     self getAddressInfo:'1.2.3.4' serviceName:'bla'
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10858
	    domain:#inet type:nil protocol:nil flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10859
     self getAddressInfo:'localhost' serviceName:'echo'
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10860
	    domain:#inet type:nil protocol:nil flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10861
     self getAddressInfo:nil serviceName:'echo'
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10862
	    domain:#inet type:nil protocol:nil flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10863
     self getAddressInfo:nil serviceName:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10864
	    domain:#inet type:nil protocol:nil flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10865
     self getAddressInfo:'www.google.de' serviceName:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10866
	    domain:nil type:nil protocol:nil flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10867
     self getAddressInfo:'smc1' serviceName:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10868
	    domain:nil type:nil protocol:nil flags:nil
c3940f80de38 gethostname & friends
Claus Gittinger <cg@exept.de>
parents: 8755
diff changeset
 10869
    "
9156
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10870
!
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10871
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10872
getNameInfo:socketAddress wantHostName:wantHostName wantServiceName:wantServiceName datagram:useDatagram flags:flags
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10873
    "answer an Array containing the hostName and serviceName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10874
     in socketAddress.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10875
     This is the generic version of getHostByAddr, however, if supported by the OS,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10876
     this returns multiple hostnames (if appropriate)"
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10877
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10878
    |error errorString hostName serviceName|
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10879
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10880
%{  /* STACK:32000 */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10881
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10882
#if !defined(NO_SOCKET)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10883
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10884
# ifndef NI_MAXHOST
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10885
#  define NI_MAXHOST 256
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10886
#  define NI_MAXSERV 64
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10887
# endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10888
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10889
    char host[NI_MAXHOST];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10890
    char service[NI_MAXSERV];
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10891
    char *hp = 0, *sp = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10892
    int hsz = 0, ssz = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10893
    int ret, __flags;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10894
    char *bp;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10895
    int nInstBytes, sockAddrSize;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10896
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10897
    if (wantHostName == true) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10898
	hp = host;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10899
	hsz = sizeof(host);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10900
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10901
    if (wantServiceName == true) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10902
	sp = service;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10903
	ssz = sizeof(service);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10904
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10905
    if (hp == 0 && sp == 0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10906
	error = @symbol(badArgument);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10907
	goto err;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10908
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10909
    if (!__isBytes(socketAddress)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10910
	error = @symbol(badArgument1);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10911
	goto err;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10912
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10913
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10914
    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(socketAddress))->c_ninstvars));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10915
    sockAddrSize = __byteArraySize(socketAddress);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10916
    sockAddrSize -= nInstBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10917
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10918
    if (!__isSmallInteger(flags)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10919
	error = @symbol(badArgument5);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10920
	goto err;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10921
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10922
    __flags = __intVal(flags);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10923
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10924
#if defined(NI_NUMERICHOST)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10925
    if (useDatagram == true) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10926
	__flags |= NI_DGRAM;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10927
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10928
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10929
    {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10930
	bp = (char *)(__byteArrayVal(socketAddress));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10931
	bp += nInstBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10932
	__BEGIN_INTERRUPTABLE__
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10933
	ret = getnameinfo((struct sockaddr *)bp, sockAddrSize,
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10934
			  hp, hsz, sp, ssz, __flags);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10935
	__END_INTERRUPTABLE__
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10936
    } while (ret == EAI_SYSTEM && errno == EINTR);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10937
    if (ret != 0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10938
	switch (ret) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10939
	case EAI_FAMILY:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10940
	    error = @symbol(badProtocol);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10941
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10942
	case EAI_SOCKTYPE:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10943
	    error = @symbol(badSocketType);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10944
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10945
	case EAI_BADFLAGS:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10946
	    error = @symbol(badFlags);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10947
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10948
	case EAI_NONAME:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10949
	    error = @symbol(unknownHost);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10950
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10951
	case EAI_SERVICE:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10952
	    error = @symbol(unknownService);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10953
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10954
	case EAI_ADDRFAMILY :
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10955
	    error = @symbol(unknownHostForProtocol);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10956
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10957
	case EAI_NODATA:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10958
	    error = @symbol(noAddress);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10959
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10960
	case EAI_MEMORY:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10961
	    error = @symbol(allocationFailure);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10962
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10963
	case EAI_FAIL:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10964
	    error = @symbol(permanentFailure);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10965
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10966
	case EAI_AGAIN:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10967
	    error = @symbol(tryAgain);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10968
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10969
	case EAI_SYSTEM:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10970
	    error = @symbol(systemError);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10971
	    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10972
	default:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10973
	    error = @symbol(unknownError);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10974
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10975
	errorString = __MKSTRING(gai_strerror(ret));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10976
	goto err;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10977
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10978
# else /* ! NI_NUMERICHOST */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10979
    {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10980
	/*
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10981
	 * Do it using gethostbyaddr()
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10982
	 */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10983
	struct sockaddr_in *sa;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10984
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10985
	if (sockAddrSize < sizeof(*sa)) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10986
	    error = @symbol(badArgument1);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10987
	    goto err;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10988
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10989
	bp = (char *)(__byteArrayVal(socketAddress));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10990
	bp += nInstBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10991
	sa = (struct sockaddr_in *)bp;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10992
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10993
	if (sp) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10994
	    struct servent *servp;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10995
	    char *__proto = 0;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10996
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10997
	    __proto = (useDatagram == true ? "udp" : "tcp");
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10998
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 10999
	    servp = getservbyport(sa->sin_port, __proto);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11000
	    if (servp) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11001
		sp = servp->s_name;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11002
	    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11003
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11004
	if (hp) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11005
	    struct hostent *hostp;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11006
#  ifdef USE_H_ERRNO
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11007
	    do {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11008
		/* must refetch in loop */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11009
		bp = (char *)(__byteArrayVal(socketAddress));
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11010
		bp += nInstBytes;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11011
		sa = (struct sockaddr_in *)bp;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11012
		/* __BEGIN_INTERRUPTABLE__ is dangerous, because gethostbyname uses a static data area
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11013
		 */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11014
		hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11015
		/* __END_INTERRUPTABLE__ */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11016
	    } while ((hostp == NULL)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11017
		      && ((h_errno == TRY_AGAIN)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11018
			  || errno == EINTR
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11019
#   ifdef IRIX5_3
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11020
			  || (errno == ECONNREFUSED)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11021
#   endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11022
			 )
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11023
	    );
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11024
	    if (hostp == 0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11025
		switch (h_errno) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11026
		case HOST_NOT_FOUND:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11027
		    errorString = @symbol(unknownHost);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11028
		    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11029
		case NO_ADDRESS:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11030
		    errorString = @symbol(noAddress);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11031
		    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11032
		case NO_RECOVERY:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11033
		    errorString = @symbol(permanentFailure);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11034
		    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11035
		case TRY_AGAIN:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11036
		    errorString = @symbol(tryAgain);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11037
		    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11038
		default:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11039
		    errorString = @symbol(unknownError);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11040
		    break;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11041
		}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11042
		error = __mkSmallInteger(h_errno);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11043
		goto err;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11044
	    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11045
#  else /* !USE_H_ERRNO */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11046
	    hostp = gethostbyaddr((char *)&sa->sin_addr, sockAddrSize, sa->sin_family);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11047
	    if (hostp == 0) {
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11048
		errorString = @symbol(unknownHost);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11049
		error = __mkSmallInteger(-1);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11050
		goto err;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11051
	    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11052
#  endif /* !USE_H_ERRNO*/
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11053
	    hp = hostp->h_name;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11054
	}
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11055
    }
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11056
# endif /* ! NI_NUMERICHOST */
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11057
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11058
    if (hp)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11059
	hostName = __MKSTRING(hp);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11060
    if (sp)
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11061
	serviceName = __MKSTRING(sp);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11062
err:;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11063
#else
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11064
    error = @symbol(notImplemented);
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11065
#endif
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11066
%}.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11067
    error notNil ifTrue:[
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11068
	^ (HostAddressLookupError new
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11069
		parameter:error;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11070
		messageText:' - ', errorString;
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11071
		request:thisContext message) raiseRequest.
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11072
    ].
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11073
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11074
    ^ Array with:hostName with:serviceName
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11075
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11076
    "
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11077
     self getNameInfo:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11078
	(self getAddressInfo:'localhost' serviceName:'echo'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11079
		domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11080
	 wantHostName:true wantServiceName:true datagram:false flags:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11081
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11082
     self getNameInfo:
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11083
	(self getAddressInfo:'exept.exept.de' serviceName:'echo'
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11084
		domain:#inet type:#stream protocol:nil flags:nil) first socketAddress
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11085
	 wantHostName:true wantServiceName:true datagram:false flags:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11086
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11087
     self getNameInfo:#[1 2 3 4]
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11088
	 wantHostName:true wantServiceName:true datagram:false flags:0
55a3b0a4f2b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9155
diff changeset
 11089
    "
8740
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 11090
! !
bb4a76c88cca temporary kludge: added dummy SocketHandle for Unix compat.
Claus Gittinger <cg@exept.de>
parents: 8667
diff changeset
 11091
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11092
!Win32OperatingSystem class methodsFor:'documentation'!
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11093
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11094
version
9188
e1d727ed4ec3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9186
diff changeset
 11095
    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.220 2006-02-22 14:04:59 cg Exp $'
5133
89dcec4f269f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5123
diff changeset
 11096
! !
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 11097
5135
cbd3b4c19d84 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5133
diff changeset
 11098
Win32OperatingSystem initialize!
6791
ecc0ee933ef8 statusChangeTime is really creationTime
Claus Gittinger <cg@exept.de>
parents: 6740
diff changeset
 11099
Win32OperatingSystem::RegistryEntry initialize!