AbstractOperatingSystem.st
author Claus Gittinger <cg@exept.de>
Thu, 27 Aug 1998 16:46:26 +0200
changeset 3797 ecbff4d56de7
parent 3758 1cc926a7b2a6
child 3806 37595c95381f
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3576
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
Object subclass:#AbstractOperatingSystem
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
	instanceVariableNames:''
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	classVariableNames:'ConcreteClass LastErrorNumber LocaleInfo OSSignals PipeFailed
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
		ErrorSignal AccessDeniedErrorSignal FileNotFoundErrorSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
		InvalidArgumentsSignal UnsupportedOperationSignal'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	poolDictionaries:''
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	category:'System-Support'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!AbstractOperatingSystem primitiveDefinitions!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
%{
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
#define UNIX_LIKE       /* assumption: a real operatingSystem */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
#if defined(MSWINDOWS) || defined(OS2) || defined(MSDOS) || defined(WIN32)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
# ifndef MSDOS_LIKE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
#  define MSDOS_LIKE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
# endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
# undef UNIX_LIKE       /* oops - we were too optimistic - no OS */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
# ifdef i386
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
#  ifndef _X86_
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
#   define _X86_
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
#  endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
# endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
#endif /* any MS-non-OS */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
#if defined(transputer)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
# undef MSDOS_LIKE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
# undef UNIX_LIKE       /* oops - we were too optimistic - no OS */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
#endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
!AbstractOperatingSystem class methodsFor:'documentation'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
copyright
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
 COPYRIGHT (c) 1988 by Claus Gittinger
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
	      All Rights Reserved
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
 This software is furnished under a license and may be used
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
 only in accordance with the terms of that license and with the
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
 inclusion of the above copyright notice.   This software may not
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
 be provided or otherwise made available to, or used by, any
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
 other person.  No title to or ownership of the software is
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
 hereby transferred.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
documentation
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    this class realizes access to most (all ?) required operating system services;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    some of it is very specific for unix, so do not depend on
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    things available here in your applications 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    - some may not be found in other OS's or be slightly different ...
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    (On the other hand: I do not want to hide all features
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
     from you - in some situations it MAY be interesting to be
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
     able to get down to a select or fork system call easily (at least on Unix systems).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
     You decide - portability vs. functionality)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    [Class variables:]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
	HostName        <String>        remembered hostname
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
	DomainName      <String>        remembered domainname
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
	LastErrorNumber <Integer>       the last value of errno
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
	OSSignals       <Array>         Array of signals to be raised for corresponding
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
					OperatingSystem signals.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
       PipeFailed      <Boolean>       set if a fork (or popen) has failed;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
                                        ST/X will avoid doing more forks/popens
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
                                        if this flag is set, for a slightly
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
                                        smoother operation.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
	SlowFork        <Boolean>       if set, fork and popen are avoided;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
					(more or less obsolete now)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
	ErrorSignal     <Signal>        Parentsignal of all OS error signals.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
					not directly raised.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
	AccessDeniedErrorSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
	FileNotFoundErrorSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
	UnsupportedOperationSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
	LocaleInfo      <Dictionary>    if non nil, that is taken instead of the operating
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
					systems locale definitions (allows for overwriting
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
					these, or provide a compatible info on systems which do
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
					not support locales)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
	CurrentDirectory <String>       remembered currentDirectories path
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    [author:]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
	Claus Gittinger
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    [see also:]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
	OSProcessStatus
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
	Filename Date Time
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
	ExternalStream FileStream PipeStream Socket
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
examples
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
  various queries
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
								[exBegin]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    Transcript 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
	showCR:'hello ' , (OperatingSystem getLoginName)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
								[exEnd]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
								[exBegin]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
    OperatingSystem isUNIXlike ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
	Transcript showCR:'this is some UNIX-like OS'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    ] ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
	Transcript showCR:'this OS is not UNIX-like'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    ]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
								[exEnd]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
								[exBegin]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    Transcript 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
	showCR:'this machine is called ' , OperatingSystem getHostName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
								[exEnd]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
								[exBegin]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    Transcript 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
	showCR:('this machine is in the '
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
	       , OperatingSystem getDomainName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
	       , ' domain')
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
								[exEnd]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
								[exBegin]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    Transcript 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
	showCR:('this machine''s CPU is a '
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
	       , OperatingSystem getCPUType
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
	       )
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
								[exEnd]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
								[exBegin]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    Transcript showCR:'executing ls command ...'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    OperatingSystem executeCommand:'ls'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
    Transcript showCR:'... done.'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
								[exEnd]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
  locking a file 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
  (should be executed on two running smalltalks - not in two threads):
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
								[exBegin]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    |f|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    f := 'testFile' asFilename readWriteStream.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    10 timesRepeat:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
	'about to lock ...' printCR.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
	[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
	  OperatingSystem 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
	    lockFD:(f fileDescriptor)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
	    shared:false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
	    blocking:false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
	] whileFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
	    'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
	    Delay waitForSeconds:1
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
	].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
	'LOCKED ...' printCR.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
	Delay waitForSeconds:10.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
	'unlock ...' printCR.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
	(OperatingSystem 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
	    unlockFD:(f fileDescriptor)) printCR.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
	Delay waitForSeconds:3.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    ]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
								[exBegin]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
!AbstractOperatingSystem class methodsFor:'initialization'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
initialize
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    "initialize the class"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
    self initializeConcreteClass.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
    ErrorSignal isNil ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
        ErrorSignal := Object errorSignal newSignalMayProceed:true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
        ErrorSignal nameClass:self message:#errorSignal.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
        ErrorSignal notifierString:'OS error encountered'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
        AccessDeniedErrorSignal := ErrorSignal newSignalMayProceed:true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
        AccessDeniedErrorSignal nameClass:self message:#accessDeniedError.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
        AccessDeniedErrorSignal notifierString:'OS access denied'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
        FileNotFoundErrorSignal := ErrorSignal newSignalMayProceed:true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
        FileNotFoundErrorSignal nameClass:self message:#fileNotFoundErrorSignal.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
        FileNotFoundErrorSignal notifierString:'OS file not found'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
        InvalidArgumentsSignal := ErrorSignal newSignalMayProceed:true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
        InvalidArgumentsSignal nameClass:self message:#invalidArgumentsSignal.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
        InvalidArgumentsSignal notifierString:'bad arg to OS call'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
        UnsupportedOperationSignal := ErrorSignal newSignalMayProceed:true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
        UnsupportedOperationSignal nameClass:self message:#unsupportedOperationSignal.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
        UnsupportedOperationSignal notifierString:'operation not supported by OS'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    ]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
initializeConcreteClass
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    |osType cls|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
    osType := self getSystemType.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    osType = 'win32' ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
	cls := Win32OperatingSystem
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    ] ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
        osType = 'os2' ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
	    cls := OS2OperatingSystem
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
	] ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
            osType = 'macos' ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
		cls := MacOperatingSystem
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
	    ] ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
                ((osType = 'VMS') or:[osType = 'openVMS']) ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
		    cls := OpenVMSOperatingSystem
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
		] ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
		    cls := UnixOperatingSystem
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
	        ]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
	    ]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
	]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    OperatingSystem := ConcreteClass := cls.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
!AbstractOperatingSystem class methodsFor:'OS signal constants'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
sigABRT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
    "return the signal number for SIGABRT - 0 if not supported by OS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
sigALRM
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
    "return the signal number for SIGALRM - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
sigBREAK
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    "return the signal number for SIGBREAK - 0 if not supported.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
     This is an MSDOS specific signal"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
sigBUS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
    "return the signal number for SIGBUS - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
sigCHLD
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
    "return the signal number for SIGCHLD - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
sigCONT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
    "return the signal number for SIGCONT - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
sigDANGER
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
    "return the signal number for SIGDANGER - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
     (seems to be an AIX special)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
sigEMT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
    "return the signal number for SIGEMT - 0 if not supported by OS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
sigFP
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
    "return the signal number for SIGFP - 0 if not supported by OS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
sigGRANT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
    "return the signal number for SIGGRANT - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
     (seems to be an AIX special)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
sigHUP
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
    "return the signal number for SIGHUP
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
sigILL
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
    "return the signal number for SIGILL - 0 if not supported by OS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
sigINT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    "return the signal number for SIGINT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
sigIO
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
    "return the signal number for SIGIO - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
sigIOT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
    "return the signal number for SIGIOT - 0 if not supported by OS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
sigKILL
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
    "return the signal number for SIGKILL
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
sigLOST
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
    "return the signal number for SIGLOST - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
sigMIGRATE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
    "return the signal number for SIGMIGRATE - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
     (seems to be an AIX special)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
sigMSG
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
    "return the signal number for SIGMSG - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
     (seems to be an AIX special)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
sigPIPE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
    "return the signal number for SIGPIPE - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
sigPOLL
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
    "return the signal number for SIGPOLL - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
sigPRE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
    "return the signal number for SIGPRE - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
     (seems to be an AIX special)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
sigPROF
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
    "return the signal number for SIGPROF - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
sigPWR
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
    "return the signal number for SIGPWR - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
     (not available on all systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
sigQUIT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
    "return the signal number for SIGQUIT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
sigRETRACT
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
    "return the signal number for SIGRETRACT - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
     (seems to be an AIX special)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
sigSAK
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
    "return the signal number for SIGSAK - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
     (seems to be an AIX special)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
sigSEGV
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
    "return the signal number for SIGSEGV - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
sigSOUND
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
    "return the signal number for SIGSOUND - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
     (seems to be an AIX special)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
sigSTOP
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
    "return the signal number for SIGSTOP - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
sigSYS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
    "return the signal number for SIGSYS - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
sigTERM
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
    "return the signal number for SIGTERM - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
sigTRAP
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
    "return the signal number for SIGTRAP - 0 if not supported by OS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
sigTSTP
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
    "return the signal number for SIGTSTP - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
sigTTIN
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
    "return the signal number for SIGTTIN - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
sigTTOU
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
    "return the signal number for SIGTTOU - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
sigURG
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
    "return the signal number for SIGURG - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
sigUSR1
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
    "return the signal number for SIGUSR1 - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
sigUSR2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
    "return the signal number for SIGUSR2 - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
sigVTALRM
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
    "return the signal number for SIGVTALRM - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
sigWINCH
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
    "return the signal number for SIGWINCH - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
sigXCPU
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
    "return the signal number for SIGXCPU - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
sigXFSZ
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
    "return the signal number for SIGXFSZ - 0 if not supported
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
     (the numeric value is not the same across unix-systems)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
    ^ 0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
!AbstractOperatingSystem class methodsFor:'Signal constants'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
accessDeniedErrorSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   550
    "return the signal raised when a (file-) access is denied."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   551
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
    ^ AccessDeniedErrorSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
errorSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
    "return the parent signal of all OS signals."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
    ^ ErrorSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
    "Modified: 22.4.1996 / 13:11:31 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
fileNotFoundErrorSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
    "return the signal raised when a file was not found."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
    ^ FileNotFoundErrorSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
invalidArgumentsSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
    "return the signal which is raised for invalid arguments.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
     Currently, this is never raised."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
    ^ InvalidArgumentsSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
    "Created: 13.9.1997 / 10:46:47 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
    "Modified: 13.9.1997 / 10:47:03 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   578
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
unsupportedOperationSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
    "return the signal which is raised when an operation
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
     is attempted, which is not supported by the OS.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
     (For example, creating a link on VMS or MSDOS)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
    ^ UnsupportedOperationSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   586
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
!AbstractOperatingSystem class methodsFor:'error messages'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
clearLastErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
    "return the last errors number.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
     See also: #lastErrorSymbol and #lastErrorString.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
     Notice: having a single error number is a bad idea in a multithreaded
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
	     environment - this interface will change."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   594
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
    LastErrorNumber := nil.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   597
     "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
      AbstractOperatingSystem clearLastErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   599
     "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   600
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
    "Created: 12.4.1996 / 09:28:58 / stefan"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   602
    "Modified: 12.4.1996 / 09:38:51 / stefan"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   605
currentErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
    "returns the OS's last error nr (i.e. the value of errno).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
     Notice, that the value of this flag is only valid immediately
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   608
     after the error occurred - it gets updated with every other
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
     request to the OS.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
     Use lastErrorNumber - currentErrorNumber is invalidated by
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
     many, many internal calls."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
    ^ self lastErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
     "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
      OperatingSystem currentErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
     "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
errorNumberFor:aSymbol
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
    "given a symbolic error, return the numeric;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
     (i.e. errorNumberFor:#EBADF returns EBADF's value).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
     Use this, since error numbers are really not standard across unix systems."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
    ^ -1
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
errorSymbolAndTextForNumber:errNr
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
    "return an array consisting of symbol &  message string from a unix errorNumber 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
     (as returned by a system call). 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
     The returned message is in english (as found in /usr/include/errno.h)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
     and should be replaced by a resource lookup before being presented to the user."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
    ^ Array 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
	with:#'ERROR_OTHER' 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
	with:('ErrorNr: ' , errNr printString)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
     OperatingSystem errorSymbolAndTextForNumber:4
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
errorSymbolForNumber:errNr
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
    "return a symbol for a unix errorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
     (as returned by a system call)."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
    ^ (self errorSymbolAndTextForNumber:errNr) at:1
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
     OperatingSystem errorSymbolForNumber:4
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
     OperatingSystem errorSymbolForNumber:2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
    "Modified: 12.4.1996 / 09:16:29 / stefan"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
    "Modified: 13.9.1996 / 16:23:35 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
errorTextForNumber:errNr
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
    "return a message string from a unix errorNumber 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
     (as returned by a system call). 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
     The returned message is in english (as found in /usr/include/errno.h)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
     and should be replaced by a resource lookup before being presented to the user."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
    ^ (self errorSymbolAndTextForNumber:errNr) at:2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
     OperatingSystem errorTextForNumber:4
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
lastErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
    "return the last errors number.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
     See also: #lastErrorSymbol and #lastErrorString.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
     Notice: having a single error number is a bad idea in a multithreaded
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
	     environment - this interface will change."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
    ^ LastErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
     "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
      OperatingSystem lastErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
     "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
lastErrorString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
    "return a message string describing the last error.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
     See also: #lastErrorNumber and #lastErrorSymbol.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
     Notice: having a single error number is a bad idea in a multithreaded
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
	     environment - this interface will change."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
    LastErrorNumber isNil ifTrue:[^ nil].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
    ^ self errorTextForNumber:LastErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   692
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   693
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   694
     OperatingSystem lastErrorString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   695
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   696
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   698
lastErrorSymbol
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
    "return a symbol (such as #EBADF or #EACCESS) describing the last error.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
     See also: #lastErrorNumber and #lastErrorString.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
     Notice: having a single error number is a bad idea in a multithreaded
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
	     environment - this interface will change."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
    LastErrorNumber isNil ifTrue:[^ nil].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
    ^ self errorSymbolForNumber:LastErrorNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   708
     OperatingSystem lastErrorSymbol
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   709
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   712
!AbstractOperatingSystem class methodsFor:'executing OS commands'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   713
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   714
canExecuteCommand:aCommandString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
    "return true, if the OS can execute aCommand.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
     For now, this only works with UNIX."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   717
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
    |cmd|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
    cmd := aCommandString asCollectionOfWords first.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
    ^ (self pathOfCommand:cmd) notNil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   722
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   723
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   724
     OperatingSystem canExecuteCommand:'fooBar'  
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   725
     OperatingSystem canExecuteCommand:'ls'  
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   726
     OperatingSystem canExecuteCommand:'cvs'  
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   727
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   728
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
    "Created: 4.11.1995 / 19:13:54 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
commandAndArgsForOSCommand:aCommandString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
    "get a shell and shell arguments for command execution"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   734
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   737
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   738
exec:aCommandPath withArguments:argArray
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   739
    "execute the unix command specified by the argument, aCommandPath, with
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   740
     arguments in argArray (no arguments, if nil).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   741
     If successful, this method does NOT return and smalltalk is gone.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   742
     If not successful, it does return. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   743
     Can be used on UNIX with fork or on other systems to chain to another program."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   744
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   745
    self exec:aCommandPath withArguments:argArray fork:false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   746
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   748
exec:aCommandPath withArguments:argArray fork:doFork
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
    "execute an OS command without I/O redirection.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   750
     The command reads its input and writes its output
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
     from/to whatever terminal device ST/X was started
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   752
     (typically, the xterm window)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   753
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   754
    ^ self exec:aCommandPath 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   755
	   withArguments:argArray 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
	   fileDescriptors:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   757
	   closeDescriptors:nil 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
	   fork:doFork 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
	   newPgrp:false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
     |id|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
     id := OperatingSystem fork.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
     id == 0 ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
	'I am the child'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   767
	OperatingSystem 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
	    exec:'/bin/ls' 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
	    withArguments:#('ls' '/tmp')
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
	    fork:false.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
	'not reached'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
     ]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
     |id|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
     id := OperatingSystem fork.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   779
     id == 0 ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   780
	'I am the child'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
	OperatingSystem 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
	    exec:'/bin/sh' 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
	    withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2')
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
	    fork:false.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
	'not reached'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
     ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
     id printNL.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
     (Delay forSeconds:3.5) wait.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
     'killing ...' printNL.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
     OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
     OperatingSystem sendSignal:(OperatingSystem sigKILL) to:id
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
    "Modified: 15.7.1997 / 15:54:32 / stefan"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   797
exec:aCommandPath withArguments:argArray fork:doFork inDirectory:aDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
    "execute an OS command without I/O redirection.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
     The command reads its input and writes its output
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
     from/to whatever terminal device ST/X was started
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
     (typically, the xterm window)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
    ^ self exec:aCommandPath
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
	   withArguments:argArray
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
	   fileDescriptors:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
	   closeDescriptors:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
	   fork:doFork 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
	   newPgrp:false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
	   inDirectory:aDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
     |id|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
     id := OperatingSystem fork.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
     id == 0 ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
	'I am the child'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
	OperatingSystem 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
	    exec:'/bin/ls' 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
	    withArguments:#('ls' '/tmp')
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
	    fork:false.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
	'not reached'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
     ]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
     |id|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
     id := OperatingSystem fork.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
     id == 0 ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
	'I am the child'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
	OperatingSystem 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
	    exec:'/bin/sh' 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
	    withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2')
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
	    fork:false.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
	'not reached'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
     ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
     id printNL.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
     (Delay forSeconds:3.5) wait.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
     'killing ...' printNL.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   839
     OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   840
     OperatingSystem sendSignal:(OperatingSystem sigKILL) to:id
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   843
    "Created: 28.1.1998 / 14:14:03 / md"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   844
    "Modified: 28.1.1998 / 14:14:45 / md"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   845
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   846
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   847
executableFileExtensions
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   848
    "return a collection of extensions for executable program files.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
     Only req'd for msdos & vms like systems ..."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
    ^ #('')
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
    "Created: 2.5.1997 / 11:42:29 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
executeCommand:aCommandString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
    "execute the unix command specified by the argument, aCommandString.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
     The commandString is passed to a shell for execution - see the description of
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
     'sh -c' in your UNIX manual.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
     Return true if successful, false otherwise."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
     ^ self
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
	executeCommand:aCommandString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
	onError:[:status| false]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
    "unix:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
     OperatingSystem executeCommand:'sleep 30'. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
     OperatingSystem executeCommand:'pwd'. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
     OperatingSystem executeCommand:'ls -l'. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
     OperatingSystem executeCommand:'invalidCommand'. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
     OperatingSystem executeCommand:'rm /tmp/foofoofoofoo'. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
    "msdos:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   876
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   877
     OperatingSystem executeCommand:'dir' 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   878
     OperatingSystem executeCommand:'dir /w'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   879
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   880
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   881
    "vms:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   882
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
     OperatingSystem executeCommand:'dir'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   884
     OperatingSystem executeCommand:'purge'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
     OperatingSystem executeCommand:'cc foo.c'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   886
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   887
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
    "Modified: 7.1.1997 / 19:29:55 / stefan"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   889
    "Modified: 2.5.1997 / 12:27:39 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   890
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   891
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   892
executeCommand:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream onError:aBlock
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
    "execute the unix command specified by the argument, aCommandString.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
     The commandString is passed to a shell for execution - see the description of
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
     'sh -c' in your UNIX manual.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   896
     Return true if successful.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
     If not successfull, aBlock is called with an OsProcessStatus
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
     (containing the exit status) as argument."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
    |pid exitStatus sema|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
    sema := Semaphore new name:'OS command wait'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
    pid := Processor 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
                monitor:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
                    self 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
                        startProcess:aCommandString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
                        inputFrom:anExternalInStream 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   909
                        outputTo:anExternalOutStream 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
                        errorTo:anExternalErrStream.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
                ] 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
                action:[:status |
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
                    status stillAlive ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   914
                        exitStatus := status.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
                        self closePid:pid.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   916
                        sema signal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
                    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   918
                ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   919
    pid notNil ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   920
        sema wait.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   921
    ] ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   922
        exitStatus := self osProcessStatusClass processCreationFailure.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   923
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   924
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   925
    exitStatus success ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   926
        ^ aBlock value:exitStatus
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   927
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   928
    ^ true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   929
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   930
    "Modified: / 25.3.1997 / 11:02:02 / stefan"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   931
    "Modified: / 28.1.1998 / 14:46:36 / md"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   932
    "Created: / 5.6.1998 / 19:01:57 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   933
    "Modified: / 12.6.1998 / 16:30:08 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   934
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   935
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   936
executeCommand:aCommandString onError:aBlock
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   937
    "execute the unix command specified by the argument, aCommandString.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   938
     The commandString is passed to a shell for execution - see the description of
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   939
     'sh -c' in your UNIX manual.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   940
     Return true if successful.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   941
     If not successfull, aBlock is called with an OsProcessStatus
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   942
     (containing the exit status) as argument."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   943
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   944
    |pid exitStatus sema|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   945
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
    sema := Semaphore new name:'OS command wait'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
    pid := Processor 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
                monitor:[self startProcess:aCommandString] 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
                action:[:status |
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   951
                        status stillAlive ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
                            exitStatus := status.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
                            self closePid:pid.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
                            sema signal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
                        ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
                ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   957
    pid notNil ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
        sema wait.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
    ] ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   960
        exitStatus := self osProcessStatusClass processCreationFailure.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   963
    exitStatus success ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   964
        ^ aBlock value:exitStatus
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   965
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   966
    ^ true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   967
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   968
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   969
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   970
     UnixOperatingSystem executeCommand:'sleep 30' onError:[]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   971
     UnixOperatingSystem executeCommand:'pwd' onError:[:status|status inspect]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   972
     UnixOperatingSystem executeCommand:'ls -l' onError:[]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   973
     UnixOperatingSystem executeCommand:'invalidCommand' onError:[:status| status inspect]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   974
     UnixOperatingSystem executeCommand:'rm /tmp/foofoofoofoo'onError:[:status | status inspect]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   975
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   976
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   977
    "Modified: / 25.3.1997 / 11:06:43 / stefan"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   978
    "Modified: / 28.1.1998 / 14:46:56 / md"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   979
    "Created: / 5.6.1998 / 19:02:09 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   980
    "Modified: / 12.6.1998 / 16:30:12 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   981
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   983
executeCommand:aCommandString onError:aBlock inDirectory:aDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   984
    "execute the unix command specified by the argument, aCommandString.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   985
     The commandString is passed to a shell for execution - see the description of
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   986
     'sh -c' in your UNIX manual.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   987
     Return true if successful.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   988
     If not successfull, aBlock is called with an OsProcessStatus
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   989
     (containing the exit status) as argument."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   990
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   991
    |pid exitStatus sema|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   992
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   993
    sema := Semaphore new name:'OS command wait'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   994
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   995
    pid := Processor
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   996
                monitor:[self startProcess:aCommandString inDirectory:aDirectory]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   997
                action:[:status |
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   998
                        status stillAlive ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   999
                            exitStatus := status.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1000
                            self closePid:pid.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1001
                            sema signal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
                        ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1003
                ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1004
    pid notNil ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1005
        sema wait.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1006
    ] ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1007
        exitStatus := self osProcessStatusClass processCreationFailure.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1008
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1009
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1010
    exitStatus success ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1011
        ^ aBlock value:exitStatus
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1012
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1013
    ^ true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1014
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1015
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1016
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1017
     UnixOperatingSystem executeCommand:'sleep 30' onError:[]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1018
     UnixOperatingSystem executeCommand:'pwd' onError:[:status|status inspect]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1019
     UnixOperatingSystem executeCommand:'ls -l' onError:[]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1020
     UnixOperatingSystem executeCommand:'invalidCommand' onError:[:status| status inspect]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1021
     UnixOperatingSystem executeCommand:'rm /tmp/foofoofoofoo'onError:[:status | status inspect]. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1022
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1023
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1024
    "Created: / 5.6.1998 / 19:02:22 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1025
    "Modified: / 12.6.1998 / 16:30:14 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1027
3797
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1028
fork
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1029
    "fork a new (HEAVY-weight) unix process.
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1030
     Not supported with MSDOS & VMS systems.
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1031
     Dont confuse this with Block>>fork, which creates
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1032
     lightweight smalltalk processes. This method will return
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1033
     0 to the child process, and a non-zero number (which is the childs
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1034
     unix-process-id) to the parent (original) process.
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1035
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1036
     In normal situations, you dont need to use this low level entry; see
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1037
     #startProcess: and #executCommand: for higher level interfaces."
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1038
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1039
    "/
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1040
    "/ not supported by OS
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1041
    "/
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1042
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1043
    ^ UnsupportedOperationSignal raise
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1044
!
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  1045
3576
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1046
getCommandOutputFrom:aCommand
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1047
    "execute a simple command (such as hostname) and
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1048
     return the commands output as a string"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1049
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1050
    |result|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1051
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1052
    PipeFailed ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1053
        PipeStream openErrorSignal handle:[:ex |
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1054
	    PipeFailed := true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1055
	    'OperatingSystem [warning]: cannot fork/popen' errorPrintCR.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1056
	    ex return.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1057
        ] do:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1058
	    |p|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1059
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1060
	    p := PipeStream readingFrom:aCommand.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1061
	    p notNil ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1062
	        result := p nextLine.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1063
	        p close
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1064
	    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1065
        ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1066
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1067
    ^ result
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1068
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1069
    "Modified: 10.1.1997 / 18:00:07 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1071
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1072
getVMSSymbol:aSymbolString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1073
    "get a symbols value, or nil if there is none"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1074
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1075
    ^ nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1076
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1077
    "Created: / 5.6.1998 / 19:02:50 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1078
    "Modified: / 5.6.1998 / 19:03:15 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1079
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1080
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1081
nameOfSTXExecutable
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1082
    "return the name of the running ST/X executable program.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1083
     Usually, 'stx' is returned - but may be different for
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1084
     standAlone apps."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1085
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1086
%{
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1087
    extern char *__stxExecutableName__();
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1088
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1089
    RETURN (__MKSTRING(__stxExecutableName__()));
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1090
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1091
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1092
     OperatingSystem nameOfSTXExecutable
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1093
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1094
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1095
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1096
pathOfCommand:aCommand
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1097
    "find where aCommand's executable file is;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1098
     return its full pathName if there is such a command, otherwise
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1099
     return nil."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1100
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1101
    ^ self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1102
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1103
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1104
pathOfSTXExecutable
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1105
    "return the full path of the running ST/X executable program.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1106
     Usually, '/../../stx' is returned - but may be different for
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1107
     standAlone apps."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1108
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1109
    ^ self pathOfCommand:(self nameOfSTXExecutable)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1110
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1111
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1112
     OperatingSystem pathOfSTXExecutable
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1113
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1114
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1115
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1116
primExec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp inPath:dirName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1117
    "Internal lowLevel entry for combined fork & exec"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1118
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1119
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1120
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1121
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1122
startProcess:aCommandString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1123
    "start executing the OS command as specified by the argument, aCommandString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1124
     as a separate process; do not wait for the command to finish.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1125
     The commandString is passed to a shell for execution - see the description of
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1126
     'sh -c' in your UNIX manual.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1127
     Return the processId if successful, nil otherwise.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1128
     Use #waitForProcess: for synchronization and exec status return,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1129
     or #killProcess: to stop it."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1130
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1131
    |shellAndArgs|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1132
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1133
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1134
    ^ self
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1135
	exec:(shellAndArgs at:1)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1136
	withArguments:(shellAndArgs at:2)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
	fork:true.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1138
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1139
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1140
     |pid|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1141
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1142
     pid := OperatingSystem startProcess:'sleep 2; echo 1; sleep 2; echo 2'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1143
     (Delay forSeconds:3) wait.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1144
     OperatingSystem killProcess:pid.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1145
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1146
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1147
    "Modified: 21.3.1997 / 10:04:35 / dq"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1148
    "Modified: 2.5.1997 / 11:55:44 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1149
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1150
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1151
startProcess:aCommandString inDirectory:aDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1152
    "start executing the OS command as specified by the argument, aCommandString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1153
     as a separate process; do not wait for the command to finish.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1154
     The commandString is passed to a shell for execution - see the description of
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1155
     'sh -c' in your UNIX manual.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1156
     Return the processId if successful, nil otherwise.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1157
     Use #waitForProcess: for synchronization and exec status return,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1158
     or #killProcess: to stop it."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1159
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1160
    |shellAndArgs|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1161
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1162
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1163
    ^ self
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1164
	exec:(shellAndArgs at:1)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1165
	withArguments:(shellAndArgs at:2)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1166
	fork:true
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1167
	inDirectory:aDirectory.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1168
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1169
     |pid|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1170
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1171
     pid := OperatingSystem startProcess:'sleep 2; echo 1; sleep 2; echo 2'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1172
     (Delay forSeconds:3) wait.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1173
     OperatingSystem killProcess:pid.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1174
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1175
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1176
    "Modified: 21.3.1997 / 10:04:35 / dq"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1177
    "Modified: 2.5.1997 / 11:55:44 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1178
    "Modified: 28.1.1998 / 14:13:33 / md"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1179
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1180
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1181
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1182
    "start executing the OS command as specified by the argument, aCommandString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1183
     as a separate process; do not wait for the command to finish.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1184
     The commandString is passed to a shell for execution - see the description of
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1185
     'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1186
     The command gets stdIn, stdOut and stdErr assigned from the arguments;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1187
     each may be nil.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1188
     Return the processId if successful, nil otherwise.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1189
     Use #monitorPid:action: for synchronization and exec status return,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1190
     or #killProcess: to stop it."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1191
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1192
     self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1193
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1194
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1195
!AbstractOperatingSystem class methodsFor:'file access'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1196
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1197
closeFd:anInteger
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1198
    "low level close of a filedescriptor"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1199
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1200
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1201
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1202
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1203
createDirectory:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1204
    "create a new directory with name 'aPathName', which may be an absolute
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1205
     path, or relative to the current directory.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1206
     Return true if successful (or the directory existed already), false if failed.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1207
     This is a low-level entry - use Filename protocol for compatibility."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1208
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1209
    "/ if it already exists this is ok
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1210
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1211
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1212
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1213
3758
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1214
createHardLinkFrom:oldPath to:newPath
3576
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1215
    "link the file 'oldPath' to 'newPath'. The link will be a hard link.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
     Return true if successful, false if not."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217
3758
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1218
    "/
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1219
    "/ assume that this OperatingSystem does not support links
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1220
    "/
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1221
    ^ UnsupportedOperationSignal raise
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1222
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1223
    "Created: / 13.8.1998 / 21:37:12 / cg"
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1224
    "Modified: / 13.8.1998 / 21:38:39 / cg"
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1225
!
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1226
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1227
createSymbolicLinkFrom:oldPath to:newPath
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1228
    "make a link from the file 'oldPath' to the file 'newPath'.
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1229
     The link will be a soft (symbolic) link.
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1230
     Return true if successful, false if not."
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1231
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1232
    "/
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1233
    "/ assume that this OperatingSystem does not support symbolic links
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1234
    "/
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1235
    ^ UnsupportedOperationSignal raise
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1236
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1237
    "Created: / 13.8.1998 / 21:38:24 / cg"
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1238
    "Modified: / 13.8.1998 / 21:38:43 / cg"
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1239
!
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1240
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1241
linkFile:oldPath to:newPath
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1242
    "link the file 'oldPath' to 'newPath'. The link will be a hard link.
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1243
     Return true if successful, false if not.
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1244
     This method has been renamed - it remains in existance for
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1245
     backward compatibility."
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1246
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1247
    ^ self createHardLinkFrom:oldPath to:newPath
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1248
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1249
    "
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1250
     OperatingSystem linkFile:'foo' to:'bar'
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1251
    "
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1252
1cc926a7b2a6 added #createSymbolicLinkFrom:to:
Claus Gittinger <cg@exept.de>
parents: 3736
diff changeset
  1253
    "Modified: / 13.8.1998 / 21:37:24 / cg"
3576
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1254
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1255
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1256
recursiveCopyDirectory:sourcePathName to:destination
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1257
    "copy the directory named 'sourcePathName' and all contained files/directories to 'destination'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1258
     Return true if successful."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1259
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1260
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1262
    "Modified: 7.3.1996 / 15:26:30 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1263
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1264
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1265
recursiveCreateDirectory:dirName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1266
    "create a directory - with all parent dirs if needed.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1267
     Return true if successful, false otherwise. If false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
     is returned, a partial created tree may be left,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1269
     which is not cleaned-up here."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1271
    self createDirectory:dirName.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1272
    (self isDirectory:dirName) ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1273
	(self recursiveCreateDirectory:(dirName asFilename directoryName)) ifFalse:[^ false].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1274
	^ self createDirectory:dirName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1275
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1276
    ^ true
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1277
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1278
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1279
     OperatingSystem recursiveCreateDirectory:'foo/bar/baz'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1280
     OperatingSystem recursiveRemoveDirectory:'foo'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1281
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1282
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1283
    "Modified: 7.3.1996 / 15:26:22 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1284
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1285
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1286
recursiveRemoveDirectory:fullPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1287
    "remove the directory named 'fullPathName' and all contained files/directories.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1288
     Return true if successful."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1289
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1290
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1291
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1292
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1293
     OperatingSystem recursiveCreateDirectory:'foo/bar/baz'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1294
     OperatingSystem recursiveRemoveDirectory:'foo'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1295
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1296
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
    "Modified: 7.3.1996 / 15:26:30 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1298
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1299
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1300
removeDirectory:fullPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1301
    "remove the directory named 'fullPathName'. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1302
     The directory must be empty and you must have appropriate access rights.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1303
     Return true if successful, false if directory is not empty or no permission.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1304
     This is a lowLevel entry - use Filename protocol for compatibility."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1305
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1306
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1307
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1308
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1309
removeFile:fullPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1310
    "remove the file named 'fullPathName'; return true if successful.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1311
     This is a lowLevel entry - use Filename protocol for compatibility."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1312
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1313
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1314
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1315
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1316
renameFile:oldPath to:newPath
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1317
    "rename the file 'oldPath' to 'newPath'. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1318
     Someone else has to care for the names to be correct and 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1319
     correct for the OS used - therefore, this should not be called
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1320
     directlt. Instead, use Filename protocol to rename; this cares for
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1321
     any invalid names.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1322
     Returns true if successful, false if not"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1323
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1324
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1325
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1326
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1327
truncateFile:aPathName to:newSize
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1328
    "change a files size return true on success, false on failure.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1329
     This may not be supported on all architectures.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1330
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1331
     This is a low-level entry - use Filename protocol."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1332
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1333
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1334
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1335
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1336
!AbstractOperatingSystem class methodsFor:'file access rights'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1337
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1338
accessMaskFor:aSymbol
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1339
    "return the access bits mask for numbers as returned by 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1340
     OperatingSystem>>accessModeOf:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1341
     and expected by OperatingSystem>>changeAccessModeOf:to:.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1342
     Since these numbers are OS dependent, always use the mask
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1343
     (never hardcode 8rxxx into your code)."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1344
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1345
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1346
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1347
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1348
accessModeOf:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1349
    "return a number representing access rights rwxrwxrwx for owner,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1350
     group and others. Return nil if such a file does not exist.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1351
     Notice that the returned number is OS dependent - use the 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1352
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1353
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1354
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1355
     this could have been implemented as:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1356
	(self infoOf:aPathName) at:#mode
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1357
     but for huge directory searches the code below is faster
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1358
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1359
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1360
    ^ (self infoOf:aPathName) at:#mode
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1361
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1362
   "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1363
    (OperatingSystem accessModeOf:'/') printStringRadix:8
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1364
   "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1365
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1366
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1367
changeAccessModeOf:aPathName to:modeBits
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1368
    "change the access rights of aPathName to the OS dependent modeBits.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1369
     You should construct this mask using accessMaskFor, to be OS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1370
     independent. Return true if changed, 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1371
     false if such a file does not exist or change was not allowd."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1372
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1373
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1374
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1375
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1376
!AbstractOperatingSystem class methodsFor:'file locking'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1377
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1378
lockFD:aFileDescriptor shared:isSharedReadLock blocking:blockIfLocked
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1379
   "set a lock on the file represented by aFileDescriptor.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1380
    (such as returned by ExternalStream>>fileDescriptor).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1381
    On some systems, only advisory locks are available -
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1382
    these depends on other accessors to also perform the locking operation.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1383
    If they do not, they may still access the file 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1384
    (on some systems, locks are mandatory, on others, they are advisory). 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1385
    The isSharedReadLock argument (if true) specifies if multiple readers
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1386
    are to be allowed - if false, they are not.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1387
    On some systems, all locks are non-exclusive locks.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1388
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1389
    Returns true, if the lock was aquired, false otherwise.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1390
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1391
    Notice, that not all OS's support these locks; 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1392
    on some, this may simply be a no-op.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1393
    Also notice, that some systems block the process, to wait for the lock.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1394
    This can (again: on some systems) be avoided by passing a false blockIfLocked
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1395
    argument."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1396
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1397
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1398
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1399
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1400
supportsFileLinks
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1401
    "return true, if the OS supports file links (hard links).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1402
     Typically, only unix returns true here."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1403
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1404
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1405
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1406
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1407
supportsFileLocks
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1408
    "return true, if the OS supports file locking"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1409
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1410
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1411
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1412
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1413
     OperatingSystem supportsFileLocks
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1414
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1415
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1416
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
supportsNonBlockingFileLocks
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1418
    "return true, if the OS supports nonBlocking file locking
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1419
     (i.e. with immediate return instead of waiting for the lock)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1420
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1421
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1422
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1423
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1424
     OperatingSystem supportsNonBlockingFileLocks
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1425
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1426
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1427
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1428
supportsSharedLocks
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1429
    "return true, if the OS supports shared (i.e. multiple reader)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1430
     file locking."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1431
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1432
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1433
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1434
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1435
     OperatingSystem supportsNonBlockingFileLocks
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1436
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1437
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1438
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1439
supportsSymbolicLinks
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1440
    "return true, if the OS supports symbolic links on files/directories.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1441
     Typically, only Unix returns true here"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1442
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1443
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1444
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1445
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1446
unlockFD:aFileDescriptor
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1447
    "clear a file lock on the file represented by aFileDescriptor,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1448
     which was previously aquired by #lockFD:.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1449
     Return false, if the unlock failed 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1450
     (which may happens when a wrong fd is passed, 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1451
      no lock was set previously, or the systsem does not support locks).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1452
     Notice, that not all OS's support file locks; 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1453
     on some, this may simply be a no-op."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1454
     
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1455
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1456
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1457
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1458
!AbstractOperatingSystem class methodsFor:'file queries'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1459
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1460
baseNameOf:aPath
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1461
    self obsoleteMethodWarning:'use asFilename baseName'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1462
    ^ aPath asFilename baseName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1463
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1464
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1465
caseSensitiveFilenames
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1466
    "return true, if the OS has caseSensitive file naming.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1467
     On MSDOS, this will return false; 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1468
     on a real OS, we return true."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1469
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1470
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1471
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1472
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1473
compressPath:pathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1474
    "return the pathName compressed - that is, remove all ..-entries
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1475
     and . entries. This does not always (in case of symbolic links)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1476
     return the true pathName and is therefore used as a fallback
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1477
     if realPath and popen failed."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1478
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1479
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1480
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1481
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1482
directoryNameOf:aPath
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1483
    self obsoleteMethodWarning:'use asFilename directoryName'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1484
    ^ aPath asFilename directoryName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1485
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1486
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1487
fileSeparator
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1488
    "return the character used to separate names in a path.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1489
     This character differs for MSDOS and other systems,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1490
     (but those are currently not supported - so this is some
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1491
      preparation for the future)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1492
3736
718513f3284e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3689
diff changeset
  1493
    ^ $/   "/ must be redefined for systems, where this is not true (i.e. MSDOS)
3576
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1494
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1495
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1496
getDriveList
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1497
    "return a list of volumes in the system. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1498
     On unix, no such thing like a volume exists 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1499
     - there, a syntetic list with root, home & current is returned. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1500
     On MSDOS, a list of drive letters is (eventually) returned.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1501
     On VMS, a list of volumes is (eventually) returned."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1502
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1503
    "/
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1504
    "/ default: retrurn array filled with
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1505
    "/ root, home and current directories.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1506
    "/
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1507
    ^ Array 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1508
	with:'/'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1509
	with:(self getHomeDirectory)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1510
	with:(Filename currentDirectory pathName)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1511
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1512
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1513
idOf:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1514
    "return the fileNumber (i.e. inode number) of a file.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1515
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1516
     Not all operatingSystems may provide this - on those that do not,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1517
     some dummy id will be returned.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1518
     On unix, this information can be used to check for two files being 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1519
     physically identical, even if found in different directories 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1520
     (i.e. if they are hardLinked)."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1521
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1522
    |i id|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1523
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1524
    id := self primIdOf:aPathName.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1525
    id notNil ifTrue:[^ id].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1526
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1527
    i := self infoOf:aPathName.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1528
    i notNil ifTrue:[^ i id].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1529
    ^ nil.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1530
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1531
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1532
     OperatingSystem idOf:'/'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1533
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1534
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1535
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1536
infoOf:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1537
    "return some object filled with info for the file 'aPathName';
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1538
     the info (for which corresponding access methods are understood by
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1539
     the returned object) is:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1540
	 type            - a symbol giving the files type
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1541
	 mode            - numeric access mode 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1542
	 uid             - owners user id
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1543
	 gid             - owners group id
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1544
	 size            - files size
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1545
	 id              - files number (i.e. inode number)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1546
	 accessed        - last access time (as Timestamp)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1547
	 modified        - last modification time (as Timestamp)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1548
	 statusChanged   - last status change time (as Timestamp)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1549
	 alternativeName - (windows only: the MSDOS name of the file)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1550
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1551
     Some of the fields may be returned as nil on systems which do not provide
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1552
     all of the information.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1553
     Return nil if such a file does not exist. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1554
     For symbolic links (if supported by the OS), 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1555
     the info of the pointed-to-file (i.e. the target) is returned;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1556
     use #linkInfoOf: to get info about the link itself.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1557
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1558
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1559
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1560
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1561
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1562
isDirectory:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1563
    "return true, if 'aPathName' is a valid directory path name.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1564
     (i.e. exists and is a directory).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1565
     This also returns true for symbolic links pointing to a directory;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1566
     if you need to check for this, use #linkInfo:."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1567
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1568
    ^ (self infoOf:aPathName) type == #directory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1569
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1570
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1571
isExecutable:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1572
    "return true, if the given file is executable.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1573
     For symbolic links, the pointed-to-file is checked."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1574
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1575
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1576
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1577
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1578
isReadable:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1579
    "return true, if the file/dir 'aPathName' is readable.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1580
     For symbolic links, the pointed-to-file is checked."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1581
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1582
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1583
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1584
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1585
isSymbolicLink:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1586
    "return true, if the given file is a symbolic link"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1587
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1588
    ^ (self linkInfoOf:aPathName) notNil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1589
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1590
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1591
     OperatingSystem isSymbolicLink:'Make.proto'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1592
     OperatingSystem isSymbolicLink:'Makefile' 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1593
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1594
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1595
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1596
isValidPath:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1597
    "return true, if 'aPathName' is a valid path name
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1598
     (i.e. the file or directory exists)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1599
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1600
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1601
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1602
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1603
isWritable:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1604
    "return true, if the given file is writable.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1605
     For symbolic links, the pointed-to-file is checked."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1606
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1607
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1608
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1609
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1610
linkInfoOf:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1611
    "return a dictionary filled with info for the file 'aPathName',
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1612
     IFF aPathName is a symbolic link. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1613
     If aPathName is invalid, or its NOT a symbolic link, nil is returned.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1614
     (which means, that systems like VMS or MSDOS always return nil here.)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1615
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1616
     The contents of the dictionary gives info about the link itself,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1617
     on contrast to #infoOf:, which returns the info of the pointed to file
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1618
     in case of a symbolic link."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1619
     
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1620
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1621
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1622
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1623
parentDirectoryName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1624
    "return the name used to refer to parent directories.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1625
     In MSDOS, Unix and other systems this is '..', but maybe different
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1626
     for other systems.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1627
     (but those are currently not supported - so this is some
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1628
      preparation for the future)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1629
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1630
    ^ '..'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1631
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1632
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1633
pathNameOf:pathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1634
    "return the pathName of the argument, aPathString,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1635
     - thats the full pathname of the directory, starting at '/'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1636
     This method needs the path to be valid
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1637
     (i.e. all directories must exist, be readable and executable).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1638
     Notice: if symbolic links are involved, the result may look different
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1639
     from what you expect."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1640
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1641
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1642
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1643
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1644
primIdOf:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1645
    "the actual code to return the fileNumber (i.e. inode number) of a file."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1646
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1647
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1648
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1649
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1650
primPathNameOf:pathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1651
    "return the pathName of the argument, aPathString,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1652
     - thats the full pathname of the directory, starting at '/'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1653
     This method here returns nil, if the OS does not provide a
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1654
     realPath library function.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1655
     Notice: if symbolic links are involved, the result may look different
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1656
     from what you expect."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1657
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1658
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1659
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1660
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1661
timeOfLastAccess:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1662
    "return the time, when the file was last accessed.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1663
     For nonexistent files, nil is returned."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1664
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1665
    ^ (self infoOf:aPathName) accessed 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1666
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1667
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1668
timeOfLastChange:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1669
    "return the time, when the file was last changed. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1670
     For nonexistent files, nil is returned."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1671
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1672
    ^ (self infoOf:aPathName) modified
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1673
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1674
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1675
typeOf:aPathName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1676
    "return the type of a file as a symbol; for nonexistent files,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1677
     nil is returned.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1678
     Notice: for symbolic links, the type of the pointed-to file is returned."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1679
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1680
    ^ (self infoOf:aPathName) type 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1681
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1682
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1683
volumeNameOf:aPathString
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1684
    "return the volumeName of the argument, aPath
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1685
     - thats the name of the volume where aPath is.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1686
     Not all OperatingSystems support/use volumes; on unix,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1687
     this always returns an empty string."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1688
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1689
    ^ ''
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1690
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1691
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1692
!AbstractOperatingSystem class methodsFor:'interrupts & signals'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1693
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1694
blockInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1695
    "disable interrupt processing - if disabled, incoming
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1696
     interrupts will be registered and handled as soon as
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1697
     interrupts are reenabled by OperatingSystemclass>>unblockInterrupts.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1698
     Returns the previous blocking status i.e. true if interrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1699
     where already blocked. You need this information for proper
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1700
     unblocking, in case of nested block/unblock calls."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1701
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1702
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1703
    RETURN ( __BLOCKINTERRUPTS() );
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1704
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1705
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1706
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1707
defaultSignal:signalNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1708
    "revert to the default action on arrival of a (Unix-)signal.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1709
     Dont confuse Unix signals with smalltalk signals.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1710
     WARNING: for some signals, it is no good idea to revert to default;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1711
     for example, the default for SIGINT (i.e. ^C) is to exit; while the
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1712
     default for SIGQUIT (^ \) is to dump core.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1713
     Also, NOTICE that signal numbers are not portable between unix
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1714
     systems - use OperatingSystem sigXXX to get the numeric value for
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1715
     a signal."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1716
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1717
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1718
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1719
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1720
disableChildSignalInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1721
    "disable childSignal interrupts 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1722
     (SIGCHLD, if the architecture supports it).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1723
     We have to set the signal back to default, because ignoring 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1724
     SIGCHLD breaks wait & co"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1725
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1726
    ^ self defaultSignal:(self sigCHLD)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1727
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1728
    "Created: 5.1.1996 / 15:45:28 / stefan"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1729
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1730
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1731
disableIOInterruptsOn:fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1732
    "turn off IO interrupts for a filedescriptor"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1733
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1734
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1735
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1736
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1737
disableSignal:signalNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1738
    "disable (Unix-) signal processing for signalNumber.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1739
     Dont confuse Unix signals with smalltalk signals.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1740
     WARNING: for some signals, it is no good idea to disable
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1741
     them; for example, disabling the SIGINT signal turns off ^C
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1742
     handling.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1743
     Also, NOTICE that signal numbers are not portable between unix
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1744
     systems - use OperatingSystem sigXXX to get the numeric value for
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1745
     a signal.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1746
     Use only for fully debugged stand alone applications."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1747
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1748
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1749
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1750
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1751
disableTimer
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1752
    "disable timer interrupts.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1753
     WARNING: 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1754
	the system will not operate correctly with timer interrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1755
	disabled, because no scheduling or timeouts are possible."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1756
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1757
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1758
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1759
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1760
disableUserInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1761
    "disable userInterrupt processing;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1762
     when disabled, no ^C processing takes place.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1763
     WARNING:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1764
	 If at all, use this only for debugged stand-alone applications, since
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1765
	 no exit to the debugger is possible with user interrupts disabled.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1766
	 We recommend setting up a handler for the signal instead of disabling it."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1767
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1768
    self disableSignal:(self sigBREAK).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1769
    self disableSignal:(self sigINT).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1770
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1771
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1772
enableAbortInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1773
    "enable abort signalhandling, and make it a regular signalInterrupt.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1774
     (the default will dump core and exit - which is not a good idea for
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1775
      end-user applications ...).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1776
     This is especially useful, if linked-in C-libraries call abort() ..."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1777
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1778
    self enableSignal:(self sigABRT)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1779
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1780
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1781
enableChildSignalInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1782
    "enable childSignal interrupts 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1783
     (SIGCHLD, if the architecture supports it).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1784
     After enabling, these signals will send the message 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1785
     'childSignalInterrupt' to the ChildSignalInterruptHandler object."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1786
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1787
    self enableSignal:(self sigCHLD)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1788
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1789
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1790
enableFpExceptionInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1791
    "enable floating point exception interrupts (if the
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1792
     architecture supports it).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1793
     After enabling, fpu-exceptions will send the message 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1794
     'fpuExceptionInterrupt' to the FPUExceptionInterruptHandler object."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1795
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1796
    self enableSignal:(self sigFP)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1797
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1798
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1799
enableHardSignalInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1800
    "enable hard signal exception interrupts (trap, buserror & segm. violation).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1801
     After enabling, these exceptions will send the message 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1802
     'signalInterrupt' to the SignalInterruptHandler object."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1803
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1804
    "/ leads to trouble ...
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1805
"/    self enableSignal:(self sigPIPE).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1806
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1807
    "/ ... better to ignore them, and let it be handled as a writeErrorSignal.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1808
    self disableSignal:(self sigPIPE).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1809
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1810
    self enableSignal:(self sigILL).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1811
    self enableSignal:(self sigBUS).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1812
    self enableSignal:(self sigSEGV).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1813
    self enableSignal:(self sigFP).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1814
    self enableSignal:(self sigEMT).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1815
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1816
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1817
enableIOInterruptsOn:fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1818
    "turn on IO interrupts for a filedescriptor"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1819
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1820
    self subclassResonsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1821
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1822
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1823
enableQuitInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1824
    "enable quitInterrupt (usually ^\) handling, and make it a userInterrupt.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1825
     (the default will dump core and exit - which is not a good idea for
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1826
      end-user applications ...)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1827
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1828
    self enableSignal:(self sigQUIT)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1829
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1830
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1831
enableSignal:signalNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1832
    "enable (Unix-)signal processing for signalNumber.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1833
     Dont confuse Unix signals with smalltalk signals.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1834
     The signal will be delivered to one of the standard handlers
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1835
     (SIGINT, SIGQUIT, etc) or to a general handler, which
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1836
     sends #signalInterrupt:.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1837
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1838
     NOTICE that signal numbers are not portable between unix
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1839
     systems - use OperatingSystem sigXXX to get the numeric value for
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1840
     a signal."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1841
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1842
    self subclassResonsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1843
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1844
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1845
enableTimer:milliSeconds
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1846
    "setup for a timerInterrupt, to be signalled after some (real) time."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1847
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1848
    self subclassResonsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1849
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1850
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1851
enableUserInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1852
    "enable userInterrupt (^C) handling;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1853
     when enabled, ^C in the terminal window will send the message
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1854
     'userInterrupt' to the UserInterruptHandler object."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1855
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1856
    self enableSignal:(self sigINT).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1857
    self enableSignal:(self sigBREAK).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1858
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1859
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1860
interruptPending
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1861
    "return true, if an interrupt is pending. The returned value is
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1862
     invalid if interrupts are not currently blocked, since otherwise 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1863
     the interrupt is usually already handled before arriving here,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1864
     or may be served while returning from here."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1865
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1866
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1867
    extern OBJ __INTERRUPTPENDING();
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1868
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1869
    RETURN ( __INTERRUPTPENDING() );
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1870
%}        
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1871
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1872
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1873
interruptsBlocked
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1874
    "return true, if interrupt handling is currently disabled;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1875
     false otherwise."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1876
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1877
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1878
    extern OBJ __INTERRUPTS_BLOCKED();
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1879
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1880
    RETURN ( __INTERRUPTS_BLOCKED() );
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1881
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1882
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1883
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1884
killProcess:processId
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1885
    "kill an OS process.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1886
     The process has a no chance to do some cleanup.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1887
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1888
     WARNING: in order to avoid zombie processes (on unix),
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1889
              you may have to fetch the processes exitstatus with
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1890
              OperatingSystem>>getStatusOfProcess:aProcessId."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1891
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1892
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1893
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1894
    "Modified: / 10.6.1998 / 12:00:07 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1895
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1896
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1897
killProcessGroup:processGroupId
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1898
    "kill an OS process group.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1899
     The process has NO chance to do some cleanup.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1900
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1901
     WARNING: in order to avoid zombie processes (on unix),
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1902
              you may have to fetch the processes exitstatus with
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1903
              OperatingSystem>>getStatusOfProcess:aProcessId."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1904
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1905
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1906
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1907
    "Created: / 10.6.1998 / 12:00:26 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1908
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1909
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1910
nameForSignal:aSignalNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1911
    "for a given Unix signalnumber, return a descriptive string"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1912
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1913
    aSignalNumber == self sigHUP    ifTrue:[^ 'hangup'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1914
    aSignalNumber == self sigINT    ifTrue:[^ 'interrupt'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1915
    aSignalNumber == self sigKILL   ifTrue:[^ 'kill'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1916
    aSignalNumber == self sigQUIT   ifTrue:[^ 'quit'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1917
    aSignalNumber == self sigILL    ifTrue:[^ 'illegal instruction'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1918
    aSignalNumber == self sigTRAP   ifTrue:[^ 'trap'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1919
    aSignalNumber == self sigABRT   ifTrue:[^ 'abort'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1920
    aSignalNumber == self sigIOT    ifTrue:[^ 'iot trap'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1921
    aSignalNumber == self sigEMT    ifTrue:[^ 'emt trap'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1922
    aSignalNumber == self sigFP     ifTrue:[^ 'fp exception'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1923
    aSignalNumber == self sigBUS    ifTrue:[^ 'bus error'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1924
    aSignalNumber == self sigSEGV   ifTrue:[^ 'segmentation violation'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1925
    aSignalNumber == self sigSYS    ifTrue:[^ 'bad system call'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1926
    aSignalNumber == self sigPIPE   ifTrue:[^ 'broken pipe'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1927
    aSignalNumber == self sigALRM   ifTrue:[^ 'alarm timer'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1928
    aSignalNumber == self sigTERM   ifTrue:[^ 'termination'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1929
    aSignalNumber == self sigSTOP   ifTrue:[^ 'stop'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1930
    aSignalNumber == self sigTSTP   ifTrue:[^ 'tty stop'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1931
    aSignalNumber == self sigCONT   ifTrue:[^ 'continue'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1932
    aSignalNumber == self sigCHLD   ifTrue:[^ 'child death'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1933
    aSignalNumber == self sigTTIN   ifTrue:[^ 'background tty input'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1934
    aSignalNumber == self sigTTOU   ifTrue:[^ 'background tty output'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1935
    aSignalNumber == self sigIO     ifTrue:[^ 'io available'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1936
    aSignalNumber == self sigXCPU   ifTrue:[^ 'cpu time expired'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1937
    aSignalNumber == self sigXFSZ   ifTrue:[^ 'file size limit'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1938
    aSignalNumber == self sigVTALRM ifTrue:[^ 'virtual alarm timer'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1939
    aSignalNumber == self sigPROF   ifTrue:[^ 'profiling timer'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1940
    aSignalNumber == self sigWINCH  ifTrue:[^ 'winsize changed'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1941
    aSignalNumber == self sigLOST   ifTrue:[^ 'resource lost'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1942
    aSignalNumber == self sigUSR1   ifTrue:[^ 'user signal 1'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1943
    aSignalNumber == self sigUSR2   ifTrue:[^ 'user signal 2'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1944
    aSignalNumber == self sigMSG    ifTrue:[^ 'HFT message'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1945
    aSignalNumber == self sigPWR    ifTrue:[^ 'power-fail'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1946
    aSignalNumber == self sigPRE    ifTrue:[^ 'programming exception'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1947
    aSignalNumber == self sigGRANT  ifTrue:[^ 'HFT access wanted'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1948
    aSignalNumber == self sigRETRACT ifTrue:[^ 'HFT access relinquish'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1949
    aSignalNumber == self sigSOUND   ifTrue:[^ 'HFT sound complete'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1950
    aSignalNumber == self sigDANGER  ifTrue:[^ 'low on paging space'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1951
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1952
    "notice: many systems map SIGPOLL and/or SIGUSR onto SIGIO
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1953
	     therefore, keep SIGIO always above the two below" 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1954
    aSignalNumber == self sigPOLL   ifTrue:[^ 'io available'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1955
    aSignalNumber == self sigURG    ifTrue:[^ 'urgent'].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1956
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1957
    ^ 'unknown signal'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1958
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1959
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1960
     OperatingSystem nameForSignal:9
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1961
     OperatingSystem nameForSignal:(OperatingSystem sigPOLL) 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1962
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1963
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1964
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1965
operatingSystemSignal:signalNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1966
    "return the signal to be raised when an 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1967
     operatingSystem-signal occurs, or nil"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1968
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1969
    OSSignals notNil ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1970
	^ OSSignals at:signalNumber ifAbsent:[nil]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1971
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1972
    ^ nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1973
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1974
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1975
operatingSystemSignal:signalNumber install:aSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1976
    "install a signal to be raised when an operatingSystem-signal occurs"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1977
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1978
    OSSignals isNil ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1979
	OSSignals := Array new:32
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1980
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1981
    OSSignals at:signalNumber put:aSignal
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1982
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1983
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1984
sendSignal:signalNumber to:processId
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1985
    "send a unix signal to some process (maybe myself).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1986
     Returns false if any error occurred, true otherwise.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1987
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1988
     Do not confuse UNIX signals with Smalltalk-Signals.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1989
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1990
     WARNING: in order to avoid zombie processes (on unix),
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1991
	      you may have to fetch the processes exitstatus with
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1992
	      OperatingSystem>>getStatusOfProcess:aProcessId
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1993
	      if the signal terminates that process."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1994
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1995
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1996
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1997
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1998
startSpyTimer
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1999
    "trigger a spyInterrupt, to be signalled after some short (virtual) time.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2000
     This is used by the old MessageTally for profiling.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2001
     Should be changed to use real profiling timer if available.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2002
     On systems, where no virtual timer is available, use the real timer
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2003
     (which is of course less correct).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2004
     OBSOLETE: the new messageTally runs as a high prio process, not using 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2005
	       spy interrupts."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2006
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2007
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2008
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2009
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2010
stopSpyTimer
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2011
    "stop spy timing - disable spy timer.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2012
     OBSOLETE: the new messageTally runs as a high prio process, not using 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2013
	       spy interrupts."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2014
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2015
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2016
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2017
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2018
terminateProcess:processId
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2019
    "terminate a unix process.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2020
     The process has a chance to do some cleanup.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2021
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2022
     WARNING: in order to avoid zombie processes (on unix),
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2023
	      you may have to fetch the processes exitstatus with
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2024
	      OperatingSystem>>getStatusOfProcess:aProcessId."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2025
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2026
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2027
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2028
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2029
terminateProcessGroup:processGroupId
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2030
    "terminate a unix process group.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2031
     The process has a chance to do some cleanup.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2032
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2033
     WARNING: in order to avoid zombie processes (on unix),
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2034
	      you may have to fetch the processes exitstatus with
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2035
	      OperatingSystem>>getStatusOfProcess:aProcessId."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2036
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2037
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2038
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2039
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2040
unblockInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2041
    "enable interrupt processing - if any interrupts are pending,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2042
     these will be handled immediately.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2043
     When unblocking interrupts, take care of nested block/unblock
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2044
     calls - you must only unblock after a blockcall if they where
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2045
     really not blocked before. See OperatingSystemclass>>blockInterrupts."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2046
%{
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2047
    __UNBLOCKINTERRUPTS();
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2048
    RETURN (nil);
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2049
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2050
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2051
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2052
!AbstractOperatingSystem class methodsFor:'misc'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2053
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2054
closePid:pid
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2055
    "free pid resource"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2056
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2057
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2058
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2059
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2060
exit
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2061
    "shutdown smalltalk immediately - this method does not return.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2062
     Return 'good'-status (0) to the parent unix process."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2063
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2064
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2065
    __mainExit(0);
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2066
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2067
    "OperatingSystem exit - dont evaluate this"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2068
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2069
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2070
exit:exitCode
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2071
    "shutdown smalltalk immediately -
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2072
     returning an exit-code to the parent unix process."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2073
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2074
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2075
    int code = 1;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2076
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2077
    if (__isSmallInteger(exitCode)) {
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2078
	code = __intVal(exitCode);
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2079
    }
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2080
    __mainExit(code);
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2081
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2082
    "OperatingSystem exit:1 - dont evaluate this"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2083
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2084
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2085
exitWithCoreDump
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2086
    "shutdown smalltalk immediately - dumping core.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2087
     This always returns 'bad'-status to the parent unix process.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2088
     Notice, that no cleanup is performed at all - you may have to
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2089
     manually remove any tempfiles.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2090
     Use this only for debugging ST/X itself"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2091
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2092
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2093
    abort();
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2094
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2095
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2096
     OperatingSystem exitWithCoreDump - dont evaluate this
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2097
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2098
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2099
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2100
!AbstractOperatingSystem class methodsFor:'os queries'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2101
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2102
getCPUDefine
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2103
    "return a string which was used to identify this CPU type when STX was
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2104
     compiled, and which should be passed down when compiling methods.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2105
     For example, on linux, this may be '-Di386'; on a vax, this would be '-Dvax'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2106
     This is normally not of interest to 'normal' users; however, it is passed
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2107
     down to the c-compiler when methods are incrementally compiled to machine code."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2108
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2109
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2110
#   ifndef CPU_DEFINE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2111
#       define CPU_DEFINE "-DunknownCPU"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2112
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2113
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2114
    RETURN ( __MKSTRING(CPU_DEFINE));
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2115
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2116
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2117
     OperatingSystem getCPUDefine
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2118
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2119
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2120
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2121
getCPUType
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2122
    "return a string giving the type of machine we're running on.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2123
     Here, the machine for which ST/X was compiled is returned
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2124
     (i.e. for all x86's, the same i386 is returned).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2125
     This may normally not be of any interest to you ..."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2126
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2127
    |cpu|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2128
    
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2129
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2130
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2131
#   ifdef vax
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2132
#    define CPU_STRING "vax"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2133
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2134
#   ifdef mips
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2135
#    define CPU_STRING "mips"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2136
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2137
#   ifdef i386
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2138
#    define CPU_STRING "i386"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2139
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2140
#   ifdef i860
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2141
#    define CPU_STRING "i860"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2142
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2143
#   ifdef ns32k
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2144
#    define CPU_STRING "ns32k"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2145
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2146
#   ifdef mc68k
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2147
#    define CPU_STRING "mc68k"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2148
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2149
#   ifdef mc88k
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2150
#    define CPU_STRING "mc88k"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2151
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2152
#   ifdef sparc
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2153
#    define CPU_STRING "sparc"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2154
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2155
#   ifdef hppa
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2156
#    define CPU_STRING "hppa"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2157
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2158
#   ifdef rs6000
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2159
#    define CPU_STRING "rs6000"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2160
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2161
#   ifdef powerPC
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2162
#    define CPU_STRING "powerPC"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2163
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2164
#   ifdef alpha
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2165
#    define CPU_STRING "alpha"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2166
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2167
#   ifdef transputer
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2168
#    define CPU_STRING "transputer"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2169
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2170
#   ifdef ibm370
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2171
#    define CPU_STRING "ibm370"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2172
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2173
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2174
#   ifndef CPU_STRING
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2175
#    define CPU_STRING "unknown"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2176
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2177
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2178
    cpu = __MKSTRING(CPU_STRING);
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2179
#   undef CPU_STRING
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2180
%}.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2181
    ^ cpu
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2182
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2183
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2184
     OperatingSystem getCPUType
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2185
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2186
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2187
    "examples: are we running on a ss-10/solaris ?"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2188
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2189
     (OperatingSystem getCPUType = 'sparc') 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2190
     and:[OperatingSystem getOSType = 'solaris']
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2191
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2192
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2193
    "or on a pc/solaris ?"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2194
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2195
     (OperatingSystem getCPUType = 'i386')
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2196
     and:[OperatingSystem getOSType = 'solaris']
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2197
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2198
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2199
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2200
getDomainName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2201
    "return the domain this host is in.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2202
     Notice:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2203
	not all systems support this; on some, 'unknown' is returned."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2204
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2205
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2206
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2207
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2208
getEnvironment:aStringOrSymbol
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2209
    "get an environment string"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2210
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2211
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2212
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2213
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2214
getHostName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2215
    "return the hostname we are running on - if there is
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2216
     a HOST environment variable, we are much faster here ...
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2217
     Notice:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2218
	not all systems support this; on some, 'unknown' is returned."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2219
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2220
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2221
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2222
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2223
getLocaleInfo
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2224
    "return a dictionary filled with values from the locale information;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2225
     Not all fields may be present, depending on the OS's setup and capabilities.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2226
     Possible fields are:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2227
	decimalPoint                    <String>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2228
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2229
	thousandsSep                    <String>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2230
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2231
	internationalCurrencySymbol     <String>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2232
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2233
	currencySymbol                  <String>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2234
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2235
	monetaryDecimalPoint            <String>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2236
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2237
	monetaryThousandsSeparator      <String>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2238
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2239
	positiveSign                    <String>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2240
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2241
	negativeSign                    <String>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2242
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2243
	internationalFractionalDigits   <Integer>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2244
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2245
	fractionalDigits                <Integer>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2246
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2247
	positiveSignPrecedesCurrencySymbol      <Boolean>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2248
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2249
	negativeSignPrecedesCurrencySymbol      <Boolean>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2250
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2251
	positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2252
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2253
	negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2254
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2255
	positiveSignPosition                            <Symbol>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2256
							one of: #parenthesesAround, 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2257
								#signPrecedes, 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2258
								#signSuceeds, 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2259
								#signPrecedesCurrencySymbol,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2260
								#signSuceedsCurrencySymbol
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2261
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2262
	negativeSignPosition                            <like above>
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2263
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2264
     it is up to the application to deal with undefined values.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2265
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2266
     Notice, that (for now), the system does not use this information;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2267
     it should be used by applications as required.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2268
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2269
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2270
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2271
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2272
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2273
getOSDefine
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2274
    "return a string which was used to identify this machine when stx was
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2275
     compiled, and which should be passed down when compiling methods.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2276
     For example, on linux, this is '-DLINUX'."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2277
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2278
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2279
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2280
#ifndef OS_DEFINE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2281
# ifdef WIN32
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2282
#  define OS_DEFINE "-DWIN32"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2283
# endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2284
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2285
# ifndef OS_DEFINE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2286
#  define OS_DEFINE "-DunknownOS"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2287
# endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2288
#endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2289
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2290
    RETURN ( __MKSTRING(OS_DEFINE));
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2291
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2292
#undef OS_DEFINE
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2293
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2294
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2295
     OperatingSystem getOSDefine
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2296
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2297
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2298
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2299
getOSType
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2300
    "return a string giving the type of OS we're running on.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2301
     This can be used to adapt programs to certain environment
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2302
     differences (for example: mail-lock strategy ...)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2303
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2304
    |os|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2305
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2306
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2307
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2308
#   ifdef MSDOS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2309
#    define OS_STRING "msdos"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2310
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2311
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2312
#   ifdef WIN32
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2313
#    define OS_STRING "win32"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2314
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2315
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2316
#   ifdef MSWINDOWS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2317
#    define OS_STRING "mswindows"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2318
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2319
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2320
#   ifdef VMS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2321
#    ifdef __openVMS__
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2322
#     define OS_STRING "openVMS"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2323
#    else
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2324
#     define OS_STRING "VMS"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2325
#    endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2326
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2327
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2328
#   ifdef MVS /* ;-) */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2329
#    define OS_STRING "mvs"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2330
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2331
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2332
#   ifdef OS2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2333
#    define OS_STRING "os2"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2334
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2335
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2336
#   ifdef sinix
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2337
#    define OS_STRING "sinix"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2338
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2339
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2340
#   ifdef ultrix
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2341
#    define OS_STRING "ultrix"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2342
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2343
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2344
#   ifdef sco
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2345
#    define OS_STRING "sco"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2346
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2347
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2348
#   ifdef hpux
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2349
#    define OS_STRING "hpux"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2350
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2351
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2352
#   ifdef LINUX
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2353
#    define OS_STRING "linux"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2354
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2355
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2356
#   ifdef sunos
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2357
#    define OS_STRING "sunos"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2358
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2359
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2360
#   ifdef solaris
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2361
#    define OS_STRING "solaris"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2362
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2363
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2364
#   ifdef IRIS
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2365
#    define OS_STRING "irix"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2366
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2367
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2368
#   ifdef aix
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2369
#    define OS_STRING "aix"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2370
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2371
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2372
#   ifdef realIX
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2373
#    define OS_STRING "realIX"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2374
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2375
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2376
#   ifdef __osf__
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2377
#    define OS_STRING "osf"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2378
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2379
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2380
    /*
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2381
     * no concrete info; become somewhat vague ...
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2382
     */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2383
#   ifndef OS_STRING
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2384
#    ifdef MACH
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2385
#     define OS_STRING "mach"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2386
#    endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2387
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2388
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2389
#   ifndef OS_STRING
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2390
#    ifdef BSD
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2391
#     define OS_STRING "bsd"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2392
#    endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2393
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2394
#    ifdef SYSV
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2395
#     ifdef SYSV3
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2396
#      define OS_STRING "sys5_3"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2397
#     else
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2398
#      ifdef SYSV4
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2399
#       define OS_STRING "sys5_4"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2400
#      else
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2401
#       define OS_STRING "sys5"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2402
#      endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2403
#     endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2404
#    endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2405
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2406
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2407
    /*
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2408
     * become very vague ...
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2409
     */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2410
#   ifndef OS_STRING
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2411
#    ifdef POSIX
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2412
#     define OS_STRING "posix"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2413
#    endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2414
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2415
#   ifndef OS_STRING
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2416
#    ifdef UNIX
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2417
#     define OS_STRING "unix"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2418
#    endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2419
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2420
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2421
#   ifndef OS_STRING
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2422
#    define OS_STRING "unknown"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2423
#   endif
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2424
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2425
    os = __MKSTRING(OS_STRING);
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2426
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2427
#   undef OS_STRING
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2428
%}.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2429
    ^ os
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2430
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2431
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2432
     OperatingSystem getOSType
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2433
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2434
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2435
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2436
getProcessId
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2437
    "return the (unix-)processId"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2438
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2439
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2440
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2441
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2442
getSystemID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2443
    "if supported by the OS, return the systemID;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2444
     a unique per machine identification.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2445
     WARNING:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2446
	not all systems support this; on some, 'unknown' is returned."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2447
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2448
    ^ 'unknown'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2449
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2450
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2451
     OperatingSystem getSystemID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2452
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2453
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2454
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2455
getSystemInfo
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2456
    "return info on the system weare running on.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2457
     If the system supports the uname system call, that info is returned;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2458
     otherwise, some simulated info is returned.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2459
 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2460
     WARNING:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2461
       Do not depend on the amount and contents of the returned information, some
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2462
       systems may return more/less than others. Also, the contents depends on the
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2463
       OS, for example, linux returns 'ix86', while WIN32 returns 'x86'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2464
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2465
       This method is mainly provided to augment error reports with some system
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2466
       information. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2467
       (in case of system/version specific OS errors, conditional workarounds and patches
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2468
	may be based upon this info).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2469
       Your application should NOT depend upon this in any way.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2470
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2471
     The returned info may (or may not) contain:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2472
	#system -> some operating system identification (irix, Linux, nt, win32s ...) 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2473
	#version -> OS version (some os version identification)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2474
	#release -> OS release (3.5, 1.2.1 ...)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2475
	#node   -> some host identification (hostname)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2476
	#domain  -> domain name (hosts domain)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2477
	#machine -> type of machine (i586, mips ...)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2478
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2479
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2480
    |info|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2481
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2482
    info := IdentityDictionary new.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2483
    info at:#system put:(self getSystemType).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2484
    info at:#node put:(self getHostName).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2485
    info at:#machine put:(self getCPUType).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2486
    info at:#architecture put:'unknown'.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2487
    info at:#domain put:self getDomainName.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2488
    info at:#osType put:(self getOSType).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2489
    ^ info
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2490
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2491
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2492
     OperatingSystem getSystemInfo
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2493
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2494
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2495
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2496
getSystemType
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2497
    "return a string giving the type of system we're running on.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2498
     This is almost the same as getOSType, but the returned string
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2499
     is slightly different for some systems (i.e. iris vs. irix).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2500
     Dont depend on this - use getOSType. I dont really see a point
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2501
     here ... 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2502
     (except for slight differences between next/mach and other machs)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2503
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2504
    ^ self getOSType
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2505
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2506
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2507
     OperatingSystem getSystemType
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2508
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2509
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2510
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2511
getWindowsDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2512
    "internal interface - only for Windows based systems.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2513
     Return the windows directory 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2514
     (which - depending on the system - may be \WINNT, \WINDOWS or whatever)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2515
     On non-windows systems, nil is returned."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2516
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2517
    ^ nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2518
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2519
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2520
     OperatingSystem getWindowsDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2521
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2522
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2523
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2524
getWindowsSystemDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2525
    "internal interface - only for Windows based systems.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2526
     Return the windows system directory 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2527
     (which - depending on the system - may be \WINNT\SYSTEM32, 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2528
      \WINDOWS\SYSTEM or whatever)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2529
     On non-windows systems, nil is returned."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2530
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2531
    ^ nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2532
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2533
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2534
     OperatingSystem getWindowsSystemDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2535
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2536
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2537
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2538
isBSDlike
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2539
    "return true, if the OS we're running on is a 'real' unix."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2540
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2541
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2542
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2543
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2544
isMAClike
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2545
    "return true, if running on a macOS (but not on A/UX)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2546
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2547
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2548
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2549
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2550
isMSDOSlike
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2551
    "return true, if the OS we're running on is msdos like 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2552
     (in contrast to unix-like).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2553
     This returns true for any of msdos, win32s, win95,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2554
     winNT and os/2."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2555
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2556
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2557
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2558
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2559
isMSWINDOWSlike
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2560
    "return true, if running on a MS-Windows like system.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2561
     This returns true for any of win32s, win95 and winNT."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2562
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2563
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2564
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2565
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2566
isOS2like
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2567
    "return true, if the OS we're running on is OS2 like.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2568
     Only returns true for a plain OS/2 system."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2569
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2570
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2571
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2572
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2573
isUNIXlike
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2574
    "return true, if the OS we're running on is a unix like."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2575
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2576
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2577
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2578
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2579
isVMSlike
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2580
    "return true, if the OS we're running in is VMS (or openVMS)."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2581
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2582
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2583
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2584
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2585
maxFileNameLength
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2586
    "return the max number of characters in a filename.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2587
     CAVEAT:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2588
	 Actually, the following is somewhat wrong - some systems
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2589
	 support different sizes, depending on the volume.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2590
	 We return a somewhat conservative number here.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2591
	 Another entry, to query for volume specific max
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2592
	 will be added in the future."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2593
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2594
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2595
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2596
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2597
maxPathLength
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2598
    "return the max number of characters in a pathName."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2599
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2600
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2601
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2602
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2603
pathSeparator
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2604
    "return the character which separates items in the PATH variable"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2605
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2606
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2607
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2608
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2609
platformName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2610
    "return a string describing the OS platform very we're running on.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2611
     This returns #unix for all unix derivatives.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2612
     I.e. it is much less specific than getOSType or getSystemType."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2613
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2614
    |os|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2615
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2616
    os := self getSystemType.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2617
    os = 'win32' ifTrue:[ ^ #win32].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2618
    os = 'os2' ifTrue:[ ^ #os2].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2619
    os = 'macos' ifTrue:[ ^ #mac].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2620
    os = 'VMS' ifTrue:[ ^ #vms].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2621
    os = 'openVMS' ifTrue:[ ^ #vms].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2622
    ^ #unix
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2623
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2624
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2625
     OperatingSystem platformName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2626
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2627
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2628
    "Modified: 20.6.1997 / 17:37:26 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2629
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2630
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2631
setLocaleInfo:anInfoDictionary
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2632
    "set the locale information; if set, this oerrides the OS's settings.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2633
     (internal in ST/X only - the OS's settings remain unaffected)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2634
     See description of fields in #getLocaleInfo.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2635
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2636
     Notice, that (for now), the system does not use this information;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2637
     it should be used by applications as required."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2638
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2639
    LocaleInfo := anInfoDictionary
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2640
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2641
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2642
     |d|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2643
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2644
     d := IdentityDictionary new.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2645
     d at:#decimalPoint                 put:'.'         .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2646
     d at:#thousandsSeparator           put:','         .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2647
     d at:#currencySymbol               put:'USD'       .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2648
     d at:#monetaryDecimalPoint         put:'.'         .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2649
     d at:#monetaryThousandsSeparator   put:'.'         .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2650
     d at:#fractionalDigits             put:2           .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2651
     d at:#positiveSign                 put:'+'         .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2652
     d at:#negativeSign                 put:'-'         .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2653
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2654
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2655
     OperatingSystem setLocaleInfo:d
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2656
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2657
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2658
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2659
supportsChildInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2660
    "return true, if the OS supports childProcess termination signalling
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2661
     through interrupts (i.e. SIGCHILD)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2662
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2663
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2664
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2665
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2666
     OperatingSystem supportsChildInterrupts 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2667
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2668
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2669
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2670
supportsIOInterrupts
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2671
    "return true, if the OS supports IO availability interrupts 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2672
     (i.e. SIGPOLL/SIGIO)."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2673
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2674
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2675
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2676
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2677
     OperatingSystem supportsIOInterrupts 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2678
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2679
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2680
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2681
supportsNonBlockingIO
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2682
    "return true, if the OS supports nonblocking IO."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2683
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2684
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2685
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2686
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2687
     OperatingSystem supportsNonBlockingIO  
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2688
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2689
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2690
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2691
supportsSelect
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2692
    "return true, if the OS supports selecting on multiple
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2693
     filedescriptors via select.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2694
     If false is returned, ProcessorScheduler will poll in 50ms
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2695
     intervals for I/O becoming ready."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2696
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2697
    ^ true
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2698
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2699
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2700
     OperatingSystem supportsSelect 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2701
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2702
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2703
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2704
!AbstractOperatingSystem class methodsFor:'private'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2705
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2706
osProcessStatusClass
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2707
    ^ self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2708
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2709
    "Created: / 12.6.1998 / 16:30:29 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2710
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2711
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2712
!AbstractOperatingSystem class methodsFor:'shared memory access'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2713
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2714
shmAttach:id address:addr flags:flags
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2715
    "low level entry to shmat()-system call.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2716
     Not supported on all operatingSystems"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2717
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2718
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2719
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2720
    "Modified: 22.4.1996 / 13:15:12 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2721
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2722
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2723
shmDetach:addr
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2724
    "low level entry to shmdt()-system call.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2725
     Not supported on all operatingSystems"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2726
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2727
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2728
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2729
    "Modified: 22.4.1996 / 13:15:03 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2730
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2731
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2732
shmGet:key size:size flags:flags
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2733
    "low level entry to shmget()-system call.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2734
     This is not for public use and not supported with all operatingSystems.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2735
     - use the provided wrapper class SharedExternalBytes instead."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2736
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2737
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2738
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2739
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2740
!AbstractOperatingSystem class methodsFor:'time and date'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2741
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2742
computeDatePartsOf:osTime for:aBlock
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2743
    "compute year, month and day from the OS time, osTime
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2744
     and evaluate the argument, a 3-arg block with these.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2745
     Conversion is to localtime including any daylight saving adjustments."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2746
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2747
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2748
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2749
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2750
computeOSTimeFromYear:y month:m day:d hour:h minute:min seconds:s millis:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2751
    "return the OS-dependent time for the given time and day. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2752
     The arguments are assumed to be in localtime including
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2753
     any daylight saving adjustings."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2754
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2755
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2756
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2757
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2758
computeTimeAndDateFrom:osTime
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2759
    "given an OS-dependent time in osTime, return an Array
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2760
     containing (full-) year, month, day, hour, minute and seconds,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2761
     offset to UTC, daylight savings time flag, milliseconds,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2762
     dayInYear (1..) and dayInWeek (1..).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2763
     Conversion is to localtime including any daylight saving adjustments."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2764
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2765
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2766
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2767
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2768
computeTimePartsOf:osTime for:aBlock
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2769
    "compute hours, minutes, seconds and milliseconds from the osTime 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2770
     and evaluate the argument, a 4-arg block with these.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2771
     Conversion is to localtime including any daylight saving adjustments."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2772
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2773
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2774
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2775
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2776
computeUTCTimeAndDateFrom:osTime
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2777
    "given an OS-dependent time in osTime, return an Array
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2778
     containing year, month, day, hour, minute and seconds,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2779
     offset to UTC, daylight savings time flag, milliseconds,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2780
     dayInYear (1..) and dayInWeek (1..).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2781
     Conversion is to UTC."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2782
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2783
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2784
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2785
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2786
computeUTCTimePartsOf:osTime for:aBlock
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2787
    "compute hours, minutes, seconds and milliseconds from the osTime 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2788
     and evaluate the argument, a 4-arg block with these.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2789
     Conversion is to UTC."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2790
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2791
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2792
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2793
3689
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2794
getMicrosecondTime
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2795
    "This returns the microsecond timers value - if available. 
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2796
     On some machines, times with this precision may not be available,
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2797
     on those, the returned value may be rounded towards some internal
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2798
     clock resolution value."
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2799
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2800
    "/ fallBack - use getMillisecondTime, which must be implemented
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2801
    "/ for all OS's
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2802
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2803
    ^ self getMillisecondTime * 1000
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2804
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2805
    "Created: / 30.7.1998 / 16:38:26 / cg"
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2806
!
f3351f92641e added abstract for getMicrosecondTime
Claus Gittinger <cg@exept.de>
parents: 3576
diff changeset
  2807
3576
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2808
getMillisecondTime
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2809
    "This returns the millisecond timers value. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2810
     The range is limited to 0..1fffffff (i.e. the SmallInteger range) to avoid
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2811
     LargeInteger arithmetic when doing timeouts and delays.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2812
     Since this value is wrapping around in regular intervals, this can only be used for 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2813
     short relative time deltas.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2814
     Use the millisecondTimeXXX:-methods to compare and add time deltas - these know about the wrap.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2815
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2816
     BAD DESIGN:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2817
	This should be changed to return some instance of RelativeTime,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2818
	and these computations moved there.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2819
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2820
     Dont use this method in application code since it is an internal (private)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2821
     interface. For compatibility with ST-80, use Time millisecondClockValue.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2822
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2823
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2824
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2825
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2826
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2827
getOSTime
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2828
    "This returns the OS time.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2829
     The base of the returned value is not consistent across
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2830
     different OS's - some return the number of millis since jan, 1st 1970;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2831
     others since 1900. The Time classes are prepared for this, and 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2832
     converts as appropriate (by using my fromOSTime: conversion methods).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2833
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2834
     Dont use this method in application code since it is an internal (private)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2835
     interface. For compatibility with ST-80, use Time>>millisecondClockValue.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2836
     or use instances of Time, Date or AbsoluteTime to work with.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2837
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2838
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2839
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2840
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2841
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2842
maximumMillisecondTimeDelta
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2843
    "this returns the maximum delta supported by millisecondCounter
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2844
     based methods. The returned value is half the value at which the
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2845
     timer wraps."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2846
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2847
%{  /* NOCONTEXT */
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2848
    RETURN ( __MKSMALLINT(0x0FFFFFFF) );
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2849
%}
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2850
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2851
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2852
millisecondDelay:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2853
    "delay execution for millis milliseconds or until the next event
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2854
     arrives.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2855
     All lower priority threads will also sleep for the duration, 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2856
     interrupts (and therefore, higher prio processes) are
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2857
     still handled. 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2858
     Better use a Delay, to only delay the calling thread.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2859
     (however, a delay cannot be used in the event handler or scheduler)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2860
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2861
    |now then delta|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2862
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2863
    now := self getMillisecondTime.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2864
    then := self millisecondTimeAdd:now and:millis.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2865
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2866
    [self millisecondTime:then isAfter:now] whileTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2867
	delta := self millisecondTimeDeltaBetween:then and:now.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2868
	self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2869
	now := self getMillisecondTime.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2870
    ]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2871
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2872
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2873
     OperatingSystem millisecondDelay:2000
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2874
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2875
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2876
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2877
millisecondTime:msTime1 isAfter:msTime2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2878
    "return true if msTime1 is after msTime2, false if not.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2879
     The two arguments are supposed to be millisecond times 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2880
     (such as returned getMillisecondTime) which wrap at 16r1FFFFFFF.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2881
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2882
     This should really be moved to some RelativeTime class."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2883
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2884
    (msTime1 > msTime2) ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2885
	((msTime1 - msTime2) >= 16r10000000) ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2886
	    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2887
	].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2888
	^ true
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2889
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2890
    ((msTime2 - msTime1) > 16r10000000) ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2891
	^ true
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2892
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2893
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2894
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2895
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2896
millisecondTimeAdd:msTime1 and:msTime2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2897
    "Add two millisecond times (such as returned getMillisecondTime).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2898
     The returned value is msTime1 + msTime2 where a wrap occurs at:16r1FFFFFFF.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2899
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2900
     This should really be moved to some RelativeTime class."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2901
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2902
    |sum|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2903
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2904
    sum := msTime1 + msTime2.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2905
    (sum > 16r1FFFFFFF) ifTrue:[^ sum - 16r20000000].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2906
    (sum < 0) ifTrue:[^ sum + 16r20000000].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2907
    ^ sum
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2908
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2909
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2910
millisecondTimeDeltaBetween:msTime1 and:msTime2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2911
    "subtract two millisecond times (such as returned getMillisecondTime)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2912
     and return the difference. Since milli-times wrap (at 16r01FFFFFFF), 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2913
     some special handling is built-in here.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2914
     The returned value is msTime1 - msTime2. The returned value is invalid
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2915
     if the delta is >= 0x10000000.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2916
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2917
     This should really be moved to some RelativeTime class;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2918
     better yet: create a subclass of Integer named LimitedRangeInteger."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2919
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2920
    (msTime1 > msTime2) ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2921
	^ msTime1 - msTime2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2922
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2923
    ^ msTime1 + 16r10000000 - msTime2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2924
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2925
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2926
     OperatingSystem millisecondTimeAdd:16r0FFFFFFF and:1   
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2927
     OperatingSystem millisecondTimeAdd:16r0FFFFFFF and:(16 / 3)  
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2928
     OperatingSystem millisecondTimeAdd:16r0FFFFFFF and:1000   
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2929
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2930
     OperatingSystem millisecondTimeDeltaBetween:0 and:16r0FFFFFFF  
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2931
     OperatingSystem millisecondTimeDeltaBetween:(13/3) and:16r0FFFFFFF     
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2932
     OperatingSystem millisecondTimeDeltaBetween:999 and:16r0FFFFFFF       
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2933
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2934
     OperatingSystem millisecondTime:0 isAfter:16r0FFFFFFF    
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2935
     OperatingSystem millisecondTime:(13/3) isAfter:16r0FFFFFFF   
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2936
     OperatingSystem millisecondTime:999 isAfter:16r0FFFFFFF       
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2937
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2938
     OperatingSystem millisecondTime:0 isAfter:0          
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2939
     OperatingSystem millisecondTime:(13/3) isAfter:0  
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2940
     OperatingSystem millisecondTime:999 isAfter:0       
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2941
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2942
     OperatingSystem millisecondTime:1 isAfter:0        
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2943
     OperatingSystem millisecondTime:(13/3) isAfter:2
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2944
     OperatingSystem millisecondTime:999 isAfter:900       
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2945
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2946
     |t1 t2|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2947
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2948
     t1 := Time millisecondClockValue.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2949
     (Delay forMilliseconds:1) wait.   
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2950
     t2 := Time millisecondClockValue.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2951
     OperatingSystem millisecondTimeDeltaBetween:t2 and:t1 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2952
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2953
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2954
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2955
sleep:numberOfSeconds
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2956
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2957
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2958
    "cease ANY action for some time. This suspends the whole smalltalk
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2959
     (unix-) process for some time.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2960
     Not really useful since not even low-prio processes and interrupt
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2961
     handling will run during the sleep.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2962
     Use either OperatingSystem>>millisecondDelay: (which makes all
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2963
     threads sleep, but handles interrupts) or use a Delay (which makes
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2964
     only the calling thread sleep)."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2965
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2966
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2967
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2968
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2969
!AbstractOperatingSystem class methodsFor:'users & groups'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2970
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2971
getEffectiveGroupID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2972
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2973
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2974
    "return the current users (thats you) effective numeric group id.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2975
     This is only different from getGroupID, if you have ST/X running
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2976
     as a setuid program (of which you should think about twice)."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2977
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2978
    ^ self getGroupID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2979
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2980
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2981
     OperatingSystem getEffectiveGroupID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2982
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2983
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2984
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2985
getEffectiveUserID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2986
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2987
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2988
    "return the current users (thats you) effective numeric user id.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2989
     This is only different from getUserID, if you have ST/X running
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2990
     as a setuid program (of which you should think about twice)."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2991
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2992
    ^ self getUserID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2993
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2994
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2995
     OperatingSystem getEffectiveUserID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2996
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2997
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2998
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2999
getFullUserName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3000
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3001
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3002
    "return a string with the users full name (thats you) - if available.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3003
     If not, return the login name as a fallBack."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3004
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3005
    ^ self getFullUserNameFromID:(self getUserID)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3006
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3007
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3008
     OperatingSystem getFullUserName 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3009
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3010
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3011
    "Modified: 24.1.1997 / 11:31:55 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3012
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3013
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3014
getFullUserNameFromID:userID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3015
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3016
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3017
    "return a string with the users full name - if available.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3018
     If not, return the login name as a fallBack."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3019
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3020
    ^ self getUserNameFromID:userID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3021
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3022
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3023
     OperatingSystem getFullUserNameFromID:0 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3024
     OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID)  
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3025
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3026
     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)  
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3027
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3028
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3029
    "Modified: 15.7.1996 / 12:44:21 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3030
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3031
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3032
getGroupID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3033
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3034
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3035
    "return the current users (thats you) numeric group id"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3036
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3037
    ^ 1 "/ just a dummy for systems which do not have userIDs
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3038
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3039
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3040
     OperatingSystem getGroupID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3041
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3042
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3043
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3044
getGroupNameFromID:aNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3045
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3046
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3047
    "return the group-name-string for a given numeric group-id"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3048
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3049
    ^ '???' "/ just a dummy for systems which do not have groups
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3050
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3051
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3052
     OperatingSystem getGroupNameFromID:0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3053
     OperatingSystem getGroupNameFromID:10
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3054
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3055
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3056
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3057
getHomeDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3058
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3059
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3060
    "return the name of the users home directory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3061
     (i.e. yours)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3062
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3063
    ^ self getEnvironment:'HOME'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3064
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3065
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3066
     OperatingSystem getHomeDirectory
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3067
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3068
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3069
    "Modified: 24.1.1997 / 11:32:13 / cg"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3070
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3071
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3072
getLoginName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3073
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3074
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3075
    "return a string with the users login name (thats yours)"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3076
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3077
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3078
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3079
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3080
getUserID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3081
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3082
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3083
    "return the current users (thats you) numeric user id"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3084
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3085
    ^ 1 "just a dummy for systems which do not have userIDs"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3086
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3087
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3088
     OperatingSystem getUserID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3089
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3090
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3091
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3092
getUserNameFromID:aNumber
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3093
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3094
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3095
    "return the user-name-string for a given numeric user-id.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3096
     This is the login name, not the fullName."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3097
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3098
    "/ fallBack dummy
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3099
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3100
    aNumber == self getUserID ifTrue:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3101
	^ self getLoginName
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3102
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3103
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3104
    ^ '? (' , aNumber printString , ')'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3105
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3106
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3107
     OperatingSystem getUserNameFromID:0
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3108
     OperatingSystem getUserNameFromID:100
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3109
     OperatingSystem getUserNameFromID:9991 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3110
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3111
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3112
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3113
userInfoOf:aNameOrID
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3114
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3115
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3116
    "return a dictionary filled with userinfo. The argument can be either
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3117
     a string with the users name or its numeric id.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3118
     Notice, that not all systems provide (all of) this info;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3119
     DOS systems return nothing; 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3120
     non-SYSV4 systems have no age/comment.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3121
     Portable applications may want to check the systemType and NOT depend
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3122
     on all keys to be present in the returned dictionary.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3123
     Another notice: on some systems (SYSV4), the gecos field includes multiple
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3124
     entries (i.e. not just the name), separated by commas. You may want to
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3125
     extract any substring, up to the first comma to get the real life name."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3126
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3127
    |info|
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3128
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3129
    "/ fallBack dummy
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3130
    info := IdentityDictionary new.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3131
    info at:#name put:(self getLoginName).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3132
    info at:#dir put:(self getHomeDirectory).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3133
    ^ info
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3134
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3135
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3136
     OperatingSystem userInfoOf:'root'
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3137
     OperatingSystem userInfoOf:1
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3138
     OperatingSystem userInfoOf:'claus' 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3139
     OperatingSystem userInfoOf:'fooBar' 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3140
     OperatingSystem userInfoOf:(OperatingSystem getUserID)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3141
    "
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3142
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3143
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3144
!AbstractOperatingSystem class methodsFor:'waiting for events'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3145
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3146
blockingChildProcessWait
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3147
     "return true, if childProcessWait: blocks, if no children are ready.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3148
      On those systems, we must be somewhat careful when looking out for
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3149
      a subprocesses status (to avoid blocking)."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3150
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3151
    ^ true
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3152
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3153
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3154
childProcessWait:blocking pid:pidToWait
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3155
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3156
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3157
    "get status changes from child processes.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3158
     Return an OSProcessStatus or nil, if no process has terminated.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3159
     If blocking is true, we wait until a process changed state, 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3160
     otherwise we return immediately.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3161
     Note that win32 needs to know the HANDLE of the process on which 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3162
     it waits.  In case of an error, THIS ALWAYS WAITS and then times out."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3163
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3164
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3165
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3166
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3167
numAvailableForReadOn:fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3168
    "return the number of bytes available for reading, without blocking."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3169
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3170
    "/ fallBack for systems which do not provide this info
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3171
    ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0]
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3172
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3173
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3174
readCheck:fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3175
    "return true, if data is available on a filedescriptor 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3176
     (i.e. read is possible without blocking).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3177
     This depends on a working select or FIONREAD to be provided by the OS."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3178
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3179
    self supportsSelect ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3180
	"/ mhmh - what should we do then ?
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3181
	"/ For now, return true as if data was present,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3182
	"/ and let the thread fall into the read.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3183
	"/ It will then (hopefully) be desceduled there and
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3184
	"/ effectively polling for input.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3185
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3186
	^ true
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3187
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3188
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3189
    (self selectOnAnyReadable:(Array with:fd)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3190
		     writable:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3191
		    exception:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3192
		  withTimeOut:0) == fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3193
	ifTrue:[^ true].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3194
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3195
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3196
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3197
readWriteCheck:fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3198
    "return true, if filedescriptor can be read or written without blocking.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3199
     This is actually only used with sockets, to wait for a connect to
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3200
     be finished."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3201
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3202
    self supportsSelect ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3203
        "/ mhmh - what should we do then ?
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3204
        "/ For now, return true as if data was present,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3205
        "/ and let the thread fall into the write.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3206
        "/ It will then (hopefully) be desceduled there and
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3207
        "/ effectively polling for output.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3208
        ^ true
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3209
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3210
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3211
    (self selectOnAnyReadable:(Array with:fd)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3212
                     writable:(Array with:fd)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3213
                    exception:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3214
                  withTimeOut:0) == fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3215
        ifTrue:[^ true].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3216
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3217
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3218
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3219
selectOn:fd1 and:fd2 withTimeOut:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3220
    "wait for any fd to become ready; timeout after t milliseconds.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3221
     A zero timeout-time will immediately return (i.e. poll).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3222
     Return fd if i/o ok, nil if timed-out or interrupted.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3223
     Obsolete:
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3224
	This is a leftover method and will vanish."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3225
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3226
    ^ self selectOnAnyReadable:(Array with:fd1 with:fd2)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3227
		      writable:(Array with:fd1 with:fd2)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3228
		     exception:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3229
		   withTimeOut:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3230
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3231
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3232
selectOn:fd withTimeOut:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3233
    "wait for aFileDesriptor to become ready; timeout after t milliseconds.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3234
     Return true, if i/o ok, false if timed-out or interrupted.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3235
     With 0 as timeout argument, this can be used to check for availability
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3236
     of read-data.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3237
     Experimental."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3238
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3239
    ^ self selectOnAnyReadable:(Array with:fd)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3240
		      writable:(Array with:fd)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3241
		     exception:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3242
		   withTimeOut:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3243
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3244
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3245
selectOnAny:fdArray withTimeOut:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3246
    "wait for any fd in fdArray (an Array of integers) to become ready;
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3247
     timeout after t milliseconds. An empty set will always wait.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3248
     Return first ready fd if i/o ok, nil if timed-out or interrupted.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3249
     Experimental."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3250
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3251
    ^ self selectOnAnyReadable:fdArray
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3252
		      writable:fdArray
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3253
		     exception:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3254
		   withTimeOut:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3255
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3256
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3257
selectOnAnyReadable:fdArray withTimeOut:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3258
    "wait for any fd in fdArray (an Array of integers) to become ready for 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3259
     reading. Timeout after t milliseconds. An empty set will always wait.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3260
     A zero timeout-time will immediately return (i.e. poll).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3261
     Return first ready fd if i/o ok, nil if timed-out or interrupted.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3262
     Experimental."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3263
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3264
    ^ self selectOnAnyReadable:fdArray 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3265
		      writable:nil 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3266
		     exception:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3267
		   withTimeOut:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3268
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3269
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3270
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3271
    "wait for any fd in readFdArray (an Array of integers) to become ready for 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3272
     reading, writeFdArray to become ready for writing, or exceptFdArray to 
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3273
     arrive exceptional data (i.e. out-of-band data).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3274
     Timeout after t milliseconds or, if the timeout time is 0, immediately..
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3275
     Empty fd-sets will always wait. Zero time can be used to poll file-
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3276
     descriptors (i.e. to check if I/O possible without blocking).
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3277
     Return first ready fd if I/O ok, nil if timed-out or interrupted."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3278
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3279
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3280
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3281
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3282
setBlocking:aBoolean on:fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3283
    "{ Pragma: +optSpace }"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3284
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3285
    "set/clear the blocking attribute - if set (which is the default)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3286
     a read on the fileDescriptor will block until data is available.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3287
     If cleared, a read operation will immediately return with a value of
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3288
     nil."
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3289
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3290
    self subclassResponsibility
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3291
!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3292
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3293
writeCheck:fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3294
    "return true, if filedescriptor can be written without blocking"
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3295
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3296
    self supportsSelect ifFalse:[
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3297
	"/ mhmh - what should we do then ?
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3298
	"/ For now, return true as if data was present,
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3299
	"/ and let the thread fall into the write.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3300
	"/ It will then (hopefully) be desceduled there and
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3301
	"/ effectively polling for output.
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3302
	^ true
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3303
    ].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3304
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3305
    (self selectOnAnyReadable:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3306
		     writable:(Array with:fd)
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3307
		    exception:nil
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3308
		  withTimeOut:0) == fd
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3309
	ifTrue:[^ true].
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3310
    ^ false
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3311
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3312
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3313
!AbstractOperatingSystem class methodsFor:'documentation'!
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3314
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3315
version
3797
ecbff4d56de7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3758
diff changeset
  3316
    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.5 1998-08-27 14:46:26 cg Exp $'
3576
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3317
! !
9287c054ac83 started to remove abbreviations ...
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3318
AbstractOperatingSystem initialize!