branch | jv |
changeset 17910 | 8d796ca8bd1d |
parent 17909 | 0ab1deab8e9c |
child 17911 | a99f15c5efa5 |
17909:0ab1deab8e9c | 17910:8d796ca8bd1d |
---|---|
1 " |
1 " |
2 COPYRIGHT (c) 1988 by Claus Gittinger |
2 COPYRIGHT (c) 1988 by Claus Gittinger |
3 All Rights Reserved |
3 All Rights Reserved |
4 |
4 |
5 This software is furnished under a license and may be used |
5 This software is furnished under a license and may be used |
6 only in accordance with the terms of that license and with the |
6 only in accordance with the terms of that license and with the |
7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
56 !AbstractOperatingSystem class methodsFor:'documentation'! |
56 !AbstractOperatingSystem class methodsFor:'documentation'! |
57 |
57 |
58 copyright |
58 copyright |
59 " |
59 " |
60 COPYRIGHT (c) 1988 by Claus Gittinger |
60 COPYRIGHT (c) 1988 by Claus Gittinger |
61 All Rights Reserved |
61 All Rights Reserved |
62 |
62 |
63 This software is furnished under a license and may be used |
63 This software is furnished under a license and may be used |
64 only in accordance with the terms of that license and with the |
64 only in accordance with the terms of that license and with the |
65 inclusion of the above copyright notice. This software may not |
65 inclusion of the above copyright notice. This software may not |
66 be provided or otherwise made available to, or used by, any |
66 be provided or otherwise made available to, or used by, any |
75 typically, services which can be implemented based upon more primitive |
75 typically, services which can be implemented based upon more primitive |
76 functions, or which can be implemented in a portable way (but probably |
76 functions, or which can be implemented in a portable way (but probably |
77 less performant) are implemented here. |
77 less performant) are implemented here. |
78 |
78 |
79 [Class variables:] |
79 [Class variables:] |
80 ConcreteClass <Class> the real OS class |
80 ConcreteClass <Class> the real OS class |
81 |
81 |
82 LocaleInfo <Dictionary> if non nil, that is taken instead of the operating |
82 LocaleInfo <Dictionary> if non nil, that is taken instead of the operating |
83 systems locale definitions (allows for overwriting |
83 systems locale definitions (allows for overwriting |
84 these, or provide a compatible info on systems which do |
84 these, or provide a compatible info on systems which do |
85 not support locales) |
85 not support locales) |
86 |
86 |
87 LastErrorNumber <Integer> the last value of errno |
87 LastErrorNumber <Integer> the last value of errno |
88 |
88 |
89 OSSignals <Array> Array of signals to be raised for corresponding |
89 OSSignals <Array> Array of signals to be raised for corresponding |
90 OperatingSystem signals. |
90 OperatingSystem signals. |
91 |
91 |
92 PipeFailed <Boolean> set if a fork (or popen) has failed; |
92 PipeFailed <Boolean> set if a fork (or popen) has failed; |
93 ST/X will avoid doing more forks/popens |
93 ST/X will avoid doing more forks/popens |
94 if this flag is set, for a slightly |
94 if this flag is set, for a slightly |
95 smoother operation. |
95 smoother operation. |
96 |
96 |
97 ErrorSignal <Signal> Parentsignal of all OS error signals. |
97 ErrorSignal <Signal> Parentsignal of all OS error signals. |
98 not directly raised. |
98 not directly raised. |
99 |
99 |
100 AccessDeniedErrorSignal misc concrete error reporting signals |
100 AccessDeniedErrorSignal misc concrete error reporting signals |
101 FileNotFoundErrorSignal |
101 FileNotFoundErrorSignal |
102 UnsupportedOperationSignal |
102 UnsupportedOperationSignal |
103 InvalidArgumentsSignal |
103 InvalidArgumentsSignal |
104 |
104 |
105 [author:] |
105 [author:] |
106 Claus Gittinger |
106 Claus Gittinger |
107 |
107 |
108 [see also:] |
108 [see also:] |
109 OSProcessStatus |
109 OSProcessStatus |
110 Filename Date Time |
110 Filename Date Time |
111 ExternalStream FileStream PipeStream Socket |
111 ExternalStream FileStream PipeStream Socket |
112 " |
112 " |
113 ! |
113 ! |
114 |
114 |
115 examples |
115 examples |
116 " |
116 " |
117 various queries |
117 various queries |
118 [exBegin] |
118 [exBegin] |
119 Transcript |
119 Transcript |
120 showCR:'hello ' , (OperatingSystem getLoginName) |
120 showCR:'hello ' , (OperatingSystem getLoginName) |
121 [exEnd] |
121 [exEnd] |
122 |
122 |
123 [exBegin] |
123 [exBegin] |
124 OperatingSystem isUNIXlike ifTrue:[ |
124 OperatingSystem isUNIXlike ifTrue:[ |
125 Transcript showCR:'this is some UNIX-like OS' |
125 Transcript showCR:'this is some UNIX-like OS' |
126 ] ifFalse:[ |
126 ] ifFalse:[ |
127 Transcript showCR:'this OS is not UNIX-like' |
127 Transcript showCR:'this OS is not UNIX-like' |
128 ] |
128 ] |
129 [exEnd] |
129 [exEnd] |
130 |
130 |
131 [exBegin] |
131 [exBegin] |
132 Transcript |
132 Transcript |
133 showCR:'this machine is called ' , OperatingSystem getHostName |
133 showCR:'this machine is called ' , OperatingSystem getHostName |
134 [exEnd] |
134 [exEnd] |
135 |
135 |
136 [exBegin] |
136 [exBegin] |
137 Transcript |
137 Transcript |
138 showCR:('this machine is in the ' |
138 showCR:('this machine is in the ' |
139 , OperatingSystem getDomainName |
139 , OperatingSystem getDomainName |
140 , ' domain') |
140 , ' domain') |
141 [exEnd] |
141 [exEnd] |
142 |
142 |
143 [exBegin] |
143 [exBegin] |
144 Transcript |
144 Transcript |
145 showCR:('this machine''s CPU is a ' |
145 showCR:('this machine''s CPU is a ' |
146 , OperatingSystem getCPUType |
146 , OperatingSystem getCPUType |
147 ) |
147 ) |
148 [exEnd] |
148 [exEnd] |
149 |
149 |
150 [exBegin] |
150 [exBegin] |
151 Transcript showCR:'executing ls command ...'. |
151 Transcript showCR:'executing ls command ...'. |
152 OperatingSystem executeCommand:'ls'. |
152 OperatingSystem executeCommand:'ls'. |
153 Transcript showCR:'... done.'. |
153 Transcript showCR:'... done.'. |
154 [exEnd] |
154 [exEnd] |
155 |
155 |
156 locking a file |
156 locking a file |
157 (should be executed on two running smalltalks - not in two threads): |
157 (should be executed on two running smalltalks - not in two threads): |
158 [exBegin] |
158 [exBegin] |
159 |f| |
159 |f| |
160 |
160 |
161 f := 'testFile' asFilename readWriteStream. |
161 f := 'testFile' asFilename readWriteStream. |
162 |
162 |
163 10 timesRepeat:[ |
163 10 timesRepeat:[ |
164 'about to lock ...' printCR. |
164 'about to lock ...' printCR. |
165 [ |
165 [ |
166 OperatingSystem |
166 OperatingSystem |
167 lockFD:(f fileDescriptor) |
167 lockFD:(f fileDescriptor) |
168 shared:false |
168 shared:false |
169 blocking:false |
169 blocking:false |
170 ] whileFalse:[ |
170 ] whileFalse:[ |
171 'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR. |
171 'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR. |
172 Delay waitForSeconds:1 |
172 Delay waitForSeconds:1 |
173 ]. |
173 ]. |
174 'LOCKED ...' printCR. |
174 'LOCKED ...' printCR. |
175 Delay waitForSeconds:10. |
175 Delay waitForSeconds:10. |
176 'unlock ...' printCR. |
176 'unlock ...' printCR. |
177 (OperatingSystem |
177 (OperatingSystem |
178 unlockFD:(f fileDescriptor)) printCR. |
178 unlockFD:(f fileDescriptor)) printCR. |
179 Delay waitForSeconds:3. |
179 Delay waitForSeconds:3. |
180 ] |
180 ] |
181 [exBegin] |
181 [exBegin] |
182 " |
182 " |
183 ! ! |
183 ! ! |
184 |
184 |
185 !AbstractOperatingSystem class methodsFor:'initialization'! |
185 !AbstractOperatingSystem class methodsFor:'initialization'! |
186 |
186 |
187 initResources |
187 initResources |
188 "/ allow for ResourcePack class to be missing (non-GUI smalltalks) |
188 "/ allow for ResourcePack class to be missing (non-GUI smalltalks) |
189 |
189 |
190 ResourcePack notNil ifTrue:[ |
190 ResourcePack notNil ifTrue:[ |
191 Error handle:[:ex | |
191 Error handle:[:ex | |
192 'OS [warning]: error when reading resources for libbasic:' errorPrintCR. |
192 'OS [warning]: error when reading resources for libbasic:' errorPrintCR. |
193 'OS [info]: 'errorPrint. ex description errorPrintCR. |
193 'OS [info]: 'errorPrint. ex description errorPrintCR. |
194 'OS [info]: backtrace: ' errorPrintCR. |
194 'OS [info]: backtrace: ' errorPrintCR. |
195 self withErrorStreamDo:[:s | |
195 self withErrorStreamDo:[:s | |
196 ex suspendedContext fullPrintAllOn:s. |
196 ex suspendedContext fullPrintAllOn:s. |
197 ]. |
197 ]. |
198 ] do:[ |
198 ] do:[ |
199 Resources := ResourcePack forPackage:(self package). |
199 Resources := ResourcePack forPackage:(self package). |
200 ]. |
200 ]. |
201 ] |
201 ] |
202 |
202 |
203 "Modified: / 21-04-2011 / 12:48:02 / cg" |
203 "Modified: / 21-04-2011 / 12:48:02 / cg" |
204 ! |
204 ! |
205 |
205 |
207 "initialize the class" |
207 "initialize the class" |
208 |
208 |
209 self initializeConcreteClass. |
209 self initializeConcreteClass. |
210 |
210 |
211 ErrorSignal isNil ifTrue:[ |
211 ErrorSignal isNil ifTrue:[ |
212 OSErrorHolder initialize. |
212 OSErrorHolder initialize. |
213 ErrorSignal := OsError. |
213 ErrorSignal := OsError. |
214 InvalidArgumentsSignal := OsInvalidArgumentsError. |
214 InvalidArgumentsSignal := OsInvalidArgumentsError. |
215 AccessDeniedErrorSignal := OSErrorHolder noPermissionsSignal. |
215 AccessDeniedErrorSignal := OSErrorHolder noPermissionsSignal. |
216 FileNotFoundErrorSignal := OSErrorHolder nonexistentSignal. |
216 FileNotFoundErrorSignal := OSErrorHolder nonexistentSignal. |
217 UnsupportedOperationSignal := OSErrorHolder unsupportedOperationSignal. |
217 UnsupportedOperationSignal := OSErrorHolder unsupportedOperationSignal. |
218 ]. |
218 ]. |
219 Smalltalk addDependent:self. "/ to catch language changes |
219 Smalltalk addDependent:self. "/ to catch language changes |
220 ! |
220 ! |
221 |
221 |
222 initializeConcreteClass |
222 initializeConcreteClass |
223 |osType cls| |
223 |osType cls| |
224 |
224 |
225 osType := self getSystemType. |
225 osType := self getSystemType. |
226 osType = 'win32' ifTrue:[ |
226 osType = 'win32' ifTrue:[ |
227 cls := Win32OperatingSystem |
227 cls := Win32OperatingSystem |
228 ] ifFalse:[ |
228 ] ifFalse:[ |
229 osType = 'os2' ifTrue:[ |
229 osType = 'os2' ifTrue:[ |
230 cls := OS2OperatingSystem |
230 cls := OS2OperatingSystem |
231 ] ifFalse:[ |
231 ] ifFalse:[ |
232 osType = 'macos' ifTrue:[ |
232 osType = 'macos' ifTrue:[ |
233 cls := MacOperatingSystem |
233 cls := MacOperatingSystem |
234 ] ifFalse:[ |
234 ] ifFalse:[ |
235 ((osType = 'VMS') or:[osType = 'openVMS']) ifTrue:[ |
235 ((osType = 'VMS') or:[osType = 'openVMS']) ifTrue:[ |
236 cls := OpenVMSOperatingSystem |
236 cls := OpenVMSOperatingSystem |
237 ] ifFalse:[ |
237 ] ifFalse:[ |
238 cls := UnixOperatingSystem |
238 cls := UnixOperatingSystem |
239 ] |
239 ] |
240 ] |
240 ] |
241 ] |
241 ] |
242 ]. |
242 ]. |
243 OperatingSystem := ConcreteClass := cls. |
243 OperatingSystem := ConcreteClass := cls. |
244 ! ! |
244 ! ! |
245 |
245 |
246 !AbstractOperatingSystem class methodsFor:'OS signal constants'! |
246 !AbstractOperatingSystem class methodsFor:'OS signal constants'! |
590 |
590 |
591 update:something with:aParameter from:changedObject |
591 update:something with:aParameter from:changedObject |
592 "Smalltalk notifies us about changes" |
592 "Smalltalk notifies us about changes" |
593 |
593 |
594 ((something == #Language) or:[something == #LanguageTerritory]) ifTrue:[ |
594 ((something == #Language) or:[something == #LanguageTerritory]) ifTrue:[ |
595 self initResources |
595 self initResources |
596 ] |
596 ] |
597 ! ! |
597 ! ! |
598 |
598 |
599 !AbstractOperatingSystem class methodsFor:'dummy shell operations'! |
599 !AbstractOperatingSystem class methodsFor:'dummy shell operations'! |
600 |
600 |
601 openApplicationForDocument:aFilenameOrString operation:operationSymbol |
601 openApplicationForDocument:aFilenameOrString operation:operationSymbol |
602 "open a windows-shell application to present the document contained in aFilenameOrString. |
602 "open a windows-shell application to present the document contained in aFilenameOrString. |
603 This looks for the files extension, and is typically used to present help-files, |
603 This looks for the files extension, and is typically used to present help-files, |
604 html documents, pdf documents etc. |
604 html documents, pdf documents etc. |
605 operationSymbol is one of: |
605 operationSymbol is one of: |
606 open |
606 open |
607 edit |
607 edit |
608 explore |
608 explore |
609 " |
609 " |
610 |
610 |
611 "/ use a fileBrowser |
611 "/ use a fileBrowser |
612 UserPreferences current fileBrowserClass openOn:aFilenameOrString |
612 UserPreferences current fileBrowserClass openOn:aFilenameOrString |
613 |
613 |
626 |
626 |
627 clearLastErrorNumber |
627 clearLastErrorNumber |
628 "return the last errors number. |
628 "return the last errors number. |
629 See also: #lastErrorSymbol and #lastErrorString. |
629 See also: #lastErrorSymbol and #lastErrorString. |
630 Notice: having a single error number is a bad idea in a multithreaded |
630 Notice: having a single error number is a bad idea in a multithreaded |
631 environment - this interface will change." |
631 environment - this interface will change." |
632 |
632 |
633 LastErrorNumber := nil. |
633 LastErrorNumber := nil. |
634 |
634 |
635 " |
635 " |
636 AbstractOperatingSystem clearLastErrorNumber |
636 AbstractOperatingSystem clearLastErrorNumber |
671 errorStringForSymbol:errorSymbol |
671 errorStringForSymbol:errorSymbol |
672 "return an errorMessage for an errorSymbol |
672 "return an errorMessage for an errorSymbol |
673 (as kept in an osErrorHolder)." |
673 (as kept in an osErrorHolder)." |
674 |
674 |
675 Resources isNil ifTrue:[ |
675 Resources isNil ifTrue:[ |
676 "/ do not care to load resource strings, if the error happens durig early initialization |
676 "/ do not care to load resource strings, if the error happens durig early initialization |
677 Smalltalk isInitialized ifFalse:[ |
677 Smalltalk isInitialized ifFalse:[ |
678 ^ errorSymbol |
678 ^ errorSymbol |
679 ]. |
679 ]. |
680 self initResources. |
680 self initResources. |
681 Resources isNil ifTrue:[ |
681 Resources isNil ifTrue:[ |
682 ^ errorSymbol |
682 ^ errorSymbol |
683 ] |
683 ] |
684 ]. |
684 ]. |
685 ^ Resources at:errorSymbol ifAbsent:errorSymbol |
685 ^ Resources at:errorSymbol ifAbsent:errorSymbol |
686 |
686 |
687 " |
687 " |
688 OperatingSystem errorStringForSymbol:#EPERM |
688 OperatingSystem errorStringForSymbol:#EPERM |
700 |holder errSym| |
700 |holder errSym| |
701 |
701 |
702 holder := self errorHolderForNumber:errNr. |
702 holder := self errorHolderForNumber:errNr. |
703 errSym := holder errorSymbol. |
703 errSym := holder errorSymbol. |
704 ^ Array |
704 ^ Array |
705 with:errSym |
705 with:errSym |
706 with:(self errorStringForSymbol:errSym) |
706 with:(self errorStringForSymbol:errSym) |
707 |
707 |
708 " |
708 " |
709 OperatingSystem errorSymbolAndTextForNumber:(OperatingSystem errorNumberFor:#EPERM) |
709 OperatingSystem errorSymbolAndTextForNumber:(OperatingSystem errorNumberFor:#EPERM) |
710 OperatingSystem errorSymbolAndTextForNumber:(OperatingSystem errorNumberFor:#EIO) |
710 OperatingSystem errorSymbolAndTextForNumber:(OperatingSystem errorNumberFor:#EIO) |
711 OperatingSystem errorSymbolAndTextForNumber:(OperatingSystem errorNumberFor:#ENXIO) |
711 OperatingSystem errorSymbolAndTextForNumber:(OperatingSystem errorNumberFor:#ENXIO) |
740 |
740 |
741 lastErrorNumber |
741 lastErrorNumber |
742 "return the last errors number. |
742 "return the last errors number. |
743 See also: #lastErrorSymbol and #lastErrorString. |
743 See also: #lastErrorSymbol and #lastErrorString. |
744 Notice: having a single error number is a bad idea in a multithreaded |
744 Notice: having a single error number is a bad idea in a multithreaded |
745 environment - this interface will change." |
745 environment - this interface will change." |
746 |
746 |
747 ^ LastErrorNumber |
747 ^ LastErrorNumber |
748 |
748 |
749 " |
749 " |
750 OperatingSystem lastErrorNumber |
750 OperatingSystem lastErrorNumber |
753 |
753 |
754 lastErrorString |
754 lastErrorString |
755 "return a message string describing the last error. |
755 "return a message string describing the last error. |
756 See also: #lastErrorNumber and #lastErrorSymbol. |
756 See also: #lastErrorNumber and #lastErrorSymbol. |
757 Notice: having a single error number is a bad idea in a multithreaded |
757 Notice: having a single error number is a bad idea in a multithreaded |
758 environment - this interface will change." |
758 environment - this interface will change." |
759 |
759 |
760 LastErrorNumber isNil ifTrue:[^ nil]. |
760 LastErrorNumber isNil ifTrue:[^ nil]. |
761 ^ self errorTextForNumber:LastErrorNumber |
761 ^ self errorTextForNumber:LastErrorNumber |
762 |
762 |
763 " |
763 " |
767 |
767 |
768 lastErrorSymbol |
768 lastErrorSymbol |
769 "return a symbol (such as #EBADF or #EACCESS) describing the last error. |
769 "return a symbol (such as #EBADF or #EACCESS) describing the last error. |
770 See also: #lastErrorNumber and #lastErrorString. |
770 See also: #lastErrorNumber and #lastErrorString. |
771 Notice: having a single error number is a bad idea in a multithreaded |
771 Notice: having a single error number is a bad idea in a multithreaded |
772 environment - this interface will change." |
772 environment - this interface will change." |
773 |
773 |
774 LastErrorNumber isNil ifTrue:[^ nil]. |
774 LastErrorNumber isNil ifTrue:[^ nil]. |
775 ^ self errorSymbolForNumber:LastErrorNumber |
775 ^ self errorSymbolForNumber:LastErrorNumber |
776 |
776 |
777 " |
777 " |
827 !AbstractOperatingSystem class methodsFor:'executing OS commands-private'! |
827 !AbstractOperatingSystem class methodsFor:'executing OS commands-private'! |
828 |
828 |
829 shuffleAllFrom:anInStream to:anOutStream lineWise:lineWise lockWith:aLock |
829 shuffleAllFrom:anInStream to:anOutStream lineWise:lineWise lockWith:aLock |
830 |
830 |
831 lineWise ifFalse:[ |
831 lineWise ifFalse:[ |
832 ^ anInStream copyToEndInto:anOutStream. |
832 ^ anInStream copyToEndInto:anOutStream. |
833 ]. |
833 ]. |
834 [anInStream atEnd] whileFalse:[ |
834 [anInStream atEnd] whileFalse:[ |
835 aLock critical:[ |
835 aLock critical:[ |
836 self |
836 self |
837 shuffleFrom:anInStream |
837 shuffleFrom:anInStream |
838 to:anOutStream |
838 to:anOutStream |
839 lineWise:lineWise |
839 lineWise:lineWise |
840 ] |
840 ] |
841 ] |
841 ] |
842 ! |
842 ! |
843 |
843 |
844 shuffleFrom:anInStream to:anOutStream lineWise:lineWise |
844 shuffleFrom:anInStream to:anOutStream lineWise:lineWise |
845 "copy data from anInStream to anOutStream. |
845 "copy data from anInStream to anOutStream. |
846 Caller makes sure, than anInStream does not block. |
846 Caller makes sure, than anInStream does not block. |
847 anOutstream should have been set to non-blocking-mode" |
847 anOutstream should have been set to non-blocking-mode" |
848 |
848 |
849 lineWise ifTrue:[ |
849 lineWise ifTrue:[ |
850 |data| |
850 |data| |
851 |
851 |
852 data := anInStream nextLine. |
852 data := anInStream nextLine. |
853 data notNil ifTrue:[ |
853 data notNil ifTrue:[ |
854 anOutStream nextPutLine:data |
854 anOutStream nextPutLine:data |
855 ] . |
855 ] . |
856 ] ifFalse:[ |
856 ] ifFalse:[ |
857 anInStream copyToEndInto:anOutStream. |
857 anInStream copyToEndInto:anOutStream. |
858 ]. |
858 ]. |
859 ! |
859 ! |
860 |
860 |
861 shuffleRestFrom:anInStream to:anOutStream lineWise:lineWise |
861 shuffleRestFrom:anInStream to:anOutStream lineWise:lineWise |
862 [anInStream atEnd] whileFalse:[ |
862 [anInStream atEnd] whileFalse:[ |
863 self |
863 self |
864 shuffleFrom:anInStream |
864 shuffleFrom:anInStream |
865 to:anOutStream |
865 to:anOutStream |
866 lineWise:lineWise. |
866 lineWise:lineWise. |
867 ]. |
867 ]. |
868 ! |
868 ! |
869 |
869 |
870 startProcess:aCommandString |
870 startProcess:aCommandString |
871 "start executing the OS command as specified by the argument, aCommandString |
871 "start executing the OS command as specified by the argument, aCommandString |
875 Return the processId if successful, nil otherwise. |
875 Return the processId if successful, nil otherwise. |
876 Use #waitForProcess: for synchronization and exec status return, |
876 Use #waitForProcess: for synchronization and exec status return, |
877 or #killProcess: to stop it." |
877 or #killProcess: to stop it." |
878 |
878 |
879 ^ self |
879 ^ self |
880 startProcess:aCommandString |
880 startProcess:aCommandString |
881 inputFrom:nil |
881 inputFrom:nil |
882 outputTo:nil |
882 outputTo:nil |
883 errorTo:nil |
883 errorTo:nil |
884 auxFrom:nil |
884 auxFrom:nil |
885 inDirectory:nil |
885 inDirectory:nil |
886 |
886 |
887 " |
887 " |
888 |pid| |
888 |pid| |
889 |
889 |
890 pid := OperatingSystem startProcess:'sleep 2; echo 1; sleep 2; echo 2'. |
890 pid := OperatingSystem startProcess:'sleep 2; echo 1; sleep 2; echo 2'. |
900 " |
900 " |
901 " |
901 " |
902 |pid| |
902 |pid| |
903 |
903 |
904 pid := OperatingSystem |
904 pid := OperatingSystem |
905 startProcess:'dir/l' |
905 startProcess:'dir/l' |
906 inputFrom:nil |
906 inputFrom:nil |
907 outputTo:Stdout |
907 outputTo:Stdout |
908 errorTo:nil |
908 errorTo:nil |
909 inDirectory:nil. |
909 inDirectory:nil. |
910 (Delay forSeconds:2) wait. |
910 (Delay forSeconds:2) wait. |
911 OperatingSystem killProcess:pid. |
911 OperatingSystem killProcess:pid. |
912 " |
912 " |
913 |
913 |
914 "Modified: / 21.3.1997 / 10:04:35 / dq" |
914 "Modified: / 21.3.1997 / 10:04:35 / dq" |
923 Return the processId if successful, nil otherwise. |
923 Return the processId if successful, nil otherwise. |
924 Use #waitForProcess: for synchronization and exec status return, |
924 Use #waitForProcess: for synchronization and exec status return, |
925 or #killProcess: to stop it." |
925 or #killProcess: to stop it." |
926 |
926 |
927 ^ self |
927 ^ self |
928 startProcess:aCommandString |
928 startProcess:aCommandString |
929 inputFrom:nil |
929 inputFrom:nil |
930 outputTo:nil |
930 outputTo:nil |
931 errorTo:nil |
931 errorTo:nil |
932 auxFrom:nil |
932 auxFrom:nil |
933 inDirectory:aDirectory |
933 inDirectory:aDirectory |
934 " |
934 " |
935 |pid| |
935 |pid| |
936 |
936 |
937 pid := OperatingSystem startProcess:'sleep 2; echo 1; sleep 2; echo 2'. |
937 pid := OperatingSystem startProcess:'sleep 2; echo 1; sleep 2; echo 2'. |
938 (Delay forSeconds:3) wait. |
938 (Delay forSeconds:3) wait. |
954 Return the processId if successful, nil otherwise. |
954 Return the processId if successful, nil otherwise. |
955 Use #monitorPid:action: for synchronization and exec status return, |
955 Use #monitorPid:action: for synchronization and exec status return, |
956 or #killProcess: to stop it." |
956 or #killProcess: to stop it." |
957 |
957 |
958 ^ self |
958 ^ self |
959 startProcess:aCommandString |
959 startProcess:aCommandString |
960 inputFrom:anExternalInStream |
960 inputFrom:anExternalInStream |
961 outputTo:anExternalOutStream |
961 outputTo:anExternalOutStream |
962 errorTo:anExternalErrStream |
962 errorTo:anExternalErrStream |
963 auxFrom:nil |
963 auxFrom:nil |
964 inDirectory:nil |
964 inDirectory:nil |
965 |
965 |
966 "Modified: / 10.11.1998 / 20:59:05 / cg" |
966 "Modified: / 10.11.1998 / 20:59:05 / cg" |
967 ! |
967 ! |
968 |
968 |
969 startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream |
969 startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream |
970 errorTo:anExternalErrStream auxFrom:anAuxiliaryStream inDirectory:dir |
970 errorTo:anExternalErrStream auxFrom:anAuxiliaryStream inDirectory:dir |
971 |
971 |
972 ^ self |
972 ^ self |
973 startProcess:aCommandString |
973 startProcess:aCommandString |
974 inputFrom:anExternalInStream |
974 inputFrom:anExternalInStream |
975 outputTo:anExternalOutStream |
975 outputTo:anExternalOutStream |
976 errorTo:anExternalErrStream |
976 errorTo:anExternalErrStream |
977 auxFrom:anAuxiliaryStream |
977 auxFrom:anAuxiliaryStream |
978 environment:nil |
978 environment:nil |
979 inDirectory:dir |
979 inDirectory:dir |
980 ! |
980 ! |
981 |
981 |
982 startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream inDirectory:dir |
982 startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream inDirectory:dir |
983 "start executing the OS command as specified by the argument, aCommandString |
983 "start executing the OS command as specified by the argument, aCommandString |
984 as a separate process; do not wait for the command to finish. |
984 as a separate process; do not wait for the command to finish. |
989 Return the processId if successful, nil otherwise. |
989 Return the processId if successful, nil otherwise. |
990 Use #monitorPid:action: for synchronization and exec status return, |
990 Use #monitorPid:action: for synchronization and exec status return, |
991 or #killProcess: to stop it." |
991 or #killProcess: to stop it." |
992 |
992 |
993 ^ self |
993 ^ self |
994 startProcess:aCommandString |
994 startProcess:aCommandString |
995 inputFrom:anExternalInStream |
995 inputFrom:anExternalInStream |
996 outputTo:anExternalOutStream |
996 outputTo:anExternalOutStream |
997 errorTo:anExternalErrStream |
997 errorTo:anExternalErrStream |
998 auxFrom:nil |
998 auxFrom:nil |
999 inDirectory:dir |
999 inDirectory:dir |
1000 ! ! |
1000 ! ! |
1001 |
1001 |
1002 !AbstractOperatingSystem class methodsFor:'executing OS commands-public'! |
1002 !AbstractOperatingSystem class methodsFor:'executing OS commands-public'! |
1003 |
1003 |
1004 executeCommand:aCommandString |
1004 executeCommand:aCommandString |
1006 The commandString is passed to a shell for execution - see the description of |
1006 The commandString is passed to a shell for execution - see the description of |
1007 'sh -c' in your UNIX manual. |
1007 'sh -c' in your UNIX manual. |
1008 Return true if successful, false otherwise." |
1008 Return true if successful, false otherwise." |
1009 |
1009 |
1010 ^ self |
1010 ^ self |
1011 executeCommand:aCommandString |
1011 executeCommand:aCommandString |
1012 inputFrom:nil |
1012 inputFrom:nil |
1013 outputTo:nil |
1013 outputTo:nil |
1014 errorTo:nil |
1014 errorTo:nil |
1015 auxFrom:nil |
1015 auxFrom:nil |
1016 inDirectory:nil |
1016 inDirectory:nil |
1017 lineWise:false |
1017 lineWise:false |
1018 onError:[:status| false] |
1018 onError:[:status| false] |
1019 |
1019 |
1020 "unix: |
1020 "unix: |
1021 |
1021 |
1022 OperatingSystem executeCommand:'sleep 30'. |
1022 OperatingSystem executeCommand:'sleep 30'. |
1023 OperatingSystem executeCommand:'pwd'. |
1023 OperatingSystem executeCommand:'pwd'. |
1048 The commandString is passed to a shell for execution - see the description of |
1048 The commandString is passed to a shell for execution - see the description of |
1049 'sh -c' in your UNIX manual. |
1049 'sh -c' in your UNIX manual. |
1050 Return true if successful, false otherwise." |
1050 Return true if successful, false otherwise." |
1051 |
1051 |
1052 ^ self |
1052 ^ self |
1053 executeCommand:aCommandString |
1053 executeCommand:aCommandString |
1054 inputFrom:nil |
1054 inputFrom:nil |
1055 outputTo:nil |
1055 outputTo:nil |
1056 errorTo:errorStream |
1056 errorTo:errorStream |
1057 auxFrom:nil |
1057 auxFrom:nil |
1058 inDirectory:nil |
1058 inDirectory:nil |
1059 lineWise:false |
1059 lineWise:false |
1060 onError:[:status| false] |
1060 onError:[:status| false] |
1061 |
1061 |
1062 "unix: |
1062 "unix: |
1063 |
1063 |
1064 OperatingSystem executeCommand:'ls -l' errorTo:Transcript. |
1064 OperatingSystem executeCommand:'ls -l' errorTo:Transcript. |
1065 OperatingSystem executeCommand:'invalidCommand' errorTo:Transcript. |
1065 OperatingSystem executeCommand:'invalidCommand' errorTo:Transcript. |
1072 The commandString is passed to a shell for execution - see the description of |
1072 The commandString is passed to a shell for execution - see the description of |
1073 'sh -c' in your UNIX manual. |
1073 'sh -c' in your UNIX manual. |
1074 Return true if successful, false otherwise." |
1074 Return true if successful, false otherwise." |
1075 |
1075 |
1076 ^ self |
1076 ^ self |
1077 executeCommand:aCommandString |
1077 executeCommand:aCommandString |
1078 inputFrom:nil |
1078 inputFrom:nil |
1079 outputTo:nil |
1079 outputTo:nil |
1080 errorTo:errorStream |
1080 errorTo:errorStream |
1081 auxFrom:nil |
1081 auxFrom:nil |
1082 inDirectory:aDirectory |
1082 inDirectory:aDirectory |
1083 lineWise:false |
1083 lineWise:false |
1084 onError:[:status| false] |
1084 onError:[:status| false] |
1085 |
1085 |
1086 "unix: |
1086 "unix: |
1087 |
1087 |
1088 OperatingSystem executeCommand:'ls -l' errorTo:Transcript. |
1088 OperatingSystem executeCommand:'ls -l' errorTo:Transcript. |
1089 OperatingSystem executeCommand:'invalidCommand' errorTo:Transcript. |
1089 OperatingSystem executeCommand:'invalidCommand' errorTo:Transcript. |
1098 The commandString is passed to a shell for execution - see the description of |
1098 The commandString is passed to a shell for execution - see the description of |
1099 'sh -c' in your UNIX manual. |
1099 'sh -c' in your UNIX manual. |
1100 Return true if successful, false otherwise." |
1100 Return true if successful, false otherwise." |
1101 |
1101 |
1102 ^ self |
1102 ^ self |
1103 executeCommand:aCommandString |
1103 executeCommand:aCommandString |
1104 inputFrom:nil |
1104 inputFrom:nil |
1105 outputTo:nil |
1105 outputTo:nil |
1106 errorTo:nil |
1106 errorTo:nil |
1107 auxFrom:nil |
1107 auxFrom:nil |
1108 inDirectory:aDirectory |
1108 inDirectory:aDirectory |
1109 lineWise:false |
1109 lineWise:false |
1110 onError:[:exitStatus| false] |
1110 onError:[:exitStatus| false] |
1111 |
1111 |
1112 "Modified: / 10.11.1998 / 20:54:37 / cg" |
1112 "Modified: / 10.11.1998 / 20:54:37 / cg" |
1113 ! |
1113 ! |
1114 |
1114 |
1115 executeCommand:aCommandString inDirectory:aDirectory onError:aBlock |
1115 executeCommand:aCommandString inDirectory:aDirectory onError:aBlock |
1119 Return true if successful, the value from aBlock if not. |
1119 Return true if successful, the value from aBlock if not. |
1120 If not successfull, aBlock is called with an OsProcessStatus |
1120 If not successfull, aBlock is called with an OsProcessStatus |
1121 (containing the exit status) as argument." |
1121 (containing the exit status) as argument." |
1122 |
1122 |
1123 ^ self |
1123 ^ self |
1124 executeCommand:aCommandString |
1124 executeCommand:aCommandString |
1125 inputFrom:nil |
1125 inputFrom:nil |
1126 outputTo:nil |
1126 outputTo:nil |
1127 errorTo:nil |
1127 errorTo:nil |
1128 auxFrom:nil |
1128 auxFrom:nil |
1129 inDirectory:aDirectory |
1129 inDirectory:aDirectory |
1130 lineWise:false |
1130 lineWise:false |
1131 onError:aBlock |
1131 onError:aBlock |
1132 |
1132 |
1133 "Modified: / 10.11.1998 / 20:54:37 / cg" |
1133 "Modified: / 10.11.1998 / 20:54:37 / cg" |
1134 ! |
1134 ! |
1135 |
1135 |
1136 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream |
1136 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream |
1161 closeStreams| |
1161 closeStreams| |
1162 |
1162 |
1163 terminateLock := Semaphore forMutualExclusion. |
1163 terminateLock := Semaphore forMutualExclusion. |
1164 ((externalInStream := anInStream) notNil |
1164 ((externalInStream := anInStream) notNil |
1165 and:[externalInStream isExternalStream not]) ifTrue:[ |
1165 and:[externalInStream isExternalStream not]) ifTrue:[ |
1166 pIn := NonPositionableExternalStream makePipe. |
1166 pIn := NonPositionableExternalStream makePipe. |
1167 inStreamToClose := externalInStream := pIn at:1. |
1167 inStreamToClose := externalInStream := pIn at:1. |
1168 shuffledInStream := pIn at:2. |
1168 shuffledInStream := pIn at:2. |
1169 anInStream isBinary ifTrue:[ |
1169 anInStream isBinary ifTrue:[ |
1170 shuffledInStream binary |
1170 shuffledInStream binary |
1171 ]. |
1171 ]. |
1172 lineWise ifFalse:[ |
1172 lineWise ifFalse:[ |
1173 shuffledInStream blocking:false. |
1173 shuffledInStream blocking:false. |
1174 ]. |
1174 ]. |
1175 |
1175 |
1176 "/ start a reader process, shuffling data from the given |
1176 "/ start a reader process, shuffling data from the given |
1177 "/ inStream to the pipe (which is connected to the commands input) |
1177 "/ inStream to the pipe (which is connected to the commands input) |
1178 inputShufflerProcess := |
1178 inputShufflerProcess := |
1179 [ |
1179 [ |
1180 [ |
1180 [ |
1181 [anInStream atEnd] whileFalse:[ |
1181 [anInStream atEnd] whileFalse:[ |
1182 self shuffleFrom:anInStream to:shuffledInStream lineWise:lineWise. |
1182 self shuffleFrom:anInStream to:shuffledInStream lineWise:lineWise. |
1183 shuffledInStream flush |
1183 shuffledInStream flush |
1184 ] |
1184 ] |
1185 ] ensure:[ |
1185 ] ensure:[ |
1186 shuffledInStream close |
1186 shuffledInStream close |
1187 ] |
1187 ] |
1188 ] newProcess |
1188 ] newProcess |
1189 name:'cmd input shuffler'; |
1189 name:'cmd input shuffler'; |
1190 "/ beSystemProcess; |
1190 "/ beSystemProcess; |
1191 resume. |
1191 resume. |
1192 ]. |
1192 ]. |
1193 ((externalOutStream := anOutStream) notNil |
1193 ((externalOutStream := anOutStream) notNil |
1194 and:[externalOutStream isExternalStream not]) ifTrue:[ |
1194 and:[externalOutStream isExternalStream not]) ifTrue:[ |
1195 pOut := NonPositionableExternalStream makePipe. |
1195 pOut := NonPositionableExternalStream makePipe. |
1196 shuffledOutStream := (pOut at:1). |
1196 shuffledOutStream := (pOut at:1). |
1197 anOutStream isBinary ifTrue:[ |
1197 anOutStream isBinary ifTrue:[ |
1198 shuffledOutStream binary |
1198 shuffledOutStream binary |
1199 ]. |
1199 ]. |
1200 outStreamToClose := externalOutStream := pOut at:2. |
1200 outStreamToClose := externalOutStream := pOut at:2. |
1201 outputShufflerProcess := |
1201 outputShufflerProcess := |
1202 [ |
1202 [ |
1203 WriteError handle:[:ex | |
1203 WriteError handle:[:ex | |
1204 "/ ignored |
1204 "/ ignored |
1205 ] do:[ |
1205 ] do:[ |
1206 self shuffleAllFrom:shuffledOutStream to:anOutStream lineWise:lineWise lockWith:terminateLock. |
1206 self shuffleAllFrom:shuffledOutStream to:anOutStream lineWise:lineWise lockWith:terminateLock. |
1207 ]. |
1207 ]. |
1208 ] newProcess |
1208 ] newProcess |
1209 name:'cmd output shuffler'; |
1209 name:'cmd output shuffler'; |
1210 "/ beSystemProcess; |
1210 "/ beSystemProcess; |
1211 resume. |
1211 resume. |
1212 ]. |
1212 ]. |
1213 (externalErrStream := anErrStream) notNil ifTrue:[ |
1213 (externalErrStream := anErrStream) notNil ifTrue:[ |
1214 anErrStream == anOutStream ifTrue:[ |
1214 anErrStream == anOutStream ifTrue:[ |
1215 externalErrStream := externalOutStream |
1215 externalErrStream := externalOutStream |
1216 ] ifFalse:[ |
1216 ] ifFalse:[ |
1217 anErrStream isExternalStream ifFalse:[ |
1217 anErrStream isExternalStream ifFalse:[ |
1218 pErr := NonPositionableExternalStream makePipe. |
1218 pErr := NonPositionableExternalStream makePipe. |
1219 shuffledErrStream := (pErr at:1). |
1219 shuffledErrStream := (pErr at:1). |
1220 anErrStream isBinary ifTrue:[ |
1220 anErrStream isBinary ifTrue:[ |
1221 shuffledErrStream binary |
1221 shuffledErrStream binary |
1222 ]. |
1222 ]. |
1223 errStreamToClose := externalErrStream := pErr at:2. |
1223 errStreamToClose := externalErrStream := pErr at:2. |
1224 errorShufflerProcess := |
1224 errorShufflerProcess := |
1225 [ |
1225 [ |
1226 self shuffleAllFrom:shuffledErrStream to:anErrStream lineWise:lineWise lockWith:terminateLock. |
1226 self shuffleAllFrom:shuffledErrStream to:anErrStream lineWise:lineWise lockWith:terminateLock. |
1227 ] newProcess |
1227 ] newProcess |
1228 name:'cmd err-output shuffler'; |
1228 name:'cmd err-output shuffler'; |
1229 "/ beSystemProcess; |
1229 "/ beSystemProcess; |
1230 resume. |
1230 resume. |
1231 ] |
1231 ] |
1232 ] |
1232 ] |
1233 ]. |
1233 ]. |
1234 ((externalAuxStream := anAuxStream) notNil |
1234 ((externalAuxStream := anAuxStream) notNil |
1235 and:[externalAuxStream isExternalStream not]) ifTrue:[ |
1235 and:[externalAuxStream isExternalStream not]) ifTrue:[ |
1236 pAux := NonPositionableExternalStream makePipe. |
1236 pAux := NonPositionableExternalStream makePipe. |
1237 auxStreamToClose := externalAuxStream := pAux at:1. |
1237 auxStreamToClose := externalAuxStream := pAux at:1. |
1238 shuffledAuxStream := pAux at:2. |
1238 shuffledAuxStream := pAux at:2. |
1239 shuffledAuxStream blocking:false. |
1239 shuffledAuxStream blocking:false. |
1240 anAuxStream isBinary ifTrue:[ |
1240 anAuxStream isBinary ifTrue:[ |
1241 shuffledAuxStream binary |
1241 shuffledAuxStream binary |
1242 ]. |
1242 ]. |
1243 |
1243 |
1244 "/ start a reader process, shuffling data from the given |
1244 "/ start a reader process, shuffling data from the given |
1245 "/ auxStream to the pipe (which is connected to the commands aux) |
1245 "/ auxStream to the pipe (which is connected to the commands aux) |
1246 auxShufflerProcess := |
1246 auxShufflerProcess := |
1247 [ |
1247 [ |
1248 [ |
1248 [ |
1249 [anAuxStream atEnd] whileFalse:[ |
1249 [anAuxStream atEnd] whileFalse:[ |
1250 self shuffleFrom:anAuxStream to:shuffledAuxStream lineWise:false. |
1250 self shuffleFrom:anAuxStream to:shuffledAuxStream lineWise:false. |
1251 shuffledAuxStream flush |
1251 shuffledAuxStream flush |
1252 ] |
1252 ] |
1253 ] ensure:[ |
1253 ] ensure:[ |
1254 shuffledAuxStream close |
1254 shuffledAuxStream close |
1255 ] |
1255 ] |
1256 ] newProcess |
1256 ] newProcess |
1257 name:'cmd aux shuffler'; |
1257 name:'cmd aux shuffler'; |
1258 "/ beSystemProcess; |
1258 "/ beSystemProcess; |
1259 resume. |
1259 resume. |
1260 ]. |
1260 ]. |
1261 |
1261 |
1262 stopShufflers := [ |
1262 stopShufflers := [ |
1263 inputShufflerProcess notNil ifTrue:[ |
1263 inputShufflerProcess notNil ifTrue:[ |
1264 terminateLock critical:[inputShufflerProcess terminate]. |
1264 terminateLock critical:[inputShufflerProcess terminate]. |
1265 inputShufflerProcess waitUntilTerminated |
1265 inputShufflerProcess waitUntilTerminated |
1266 ]. |
1266 ]. |
1267 auxShufflerProcess notNil ifTrue:[ |
1267 auxShufflerProcess notNil ifTrue:[ |
1268 terminateLock critical:[auxShufflerProcess terminate]. |
1268 terminateLock critical:[auxShufflerProcess terminate]. |
1269 auxShufflerProcess waitUntilTerminated |
1269 auxShufflerProcess waitUntilTerminated |
1270 ]. |
1270 ]. |
1271 outputShufflerProcess notNil ifTrue:[ |
1271 outputShufflerProcess notNil ifTrue:[ |
1272 terminateLock critical:[outputShufflerProcess terminate]. |
1272 terminateLock critical:[outputShufflerProcess terminate]. |
1273 outputShufflerProcess waitUntilTerminated. |
1273 outputShufflerProcess waitUntilTerminated. |
1274 self shuffleRestFrom:shuffledOutStream to:anOutStream lineWise:lineWise. |
1274 self shuffleRestFrom:shuffledOutStream to:anOutStream lineWise:lineWise. |
1275 shuffledOutStream close. |
1275 shuffledOutStream close. |
1276 ]. |
1276 ]. |
1277 errorShufflerProcess notNil ifTrue:[ |
1277 errorShufflerProcess notNil ifTrue:[ |
1278 terminateLock critical:[errorShufflerProcess terminate]. |
1278 terminateLock critical:[errorShufflerProcess terminate]. |
1279 errorShufflerProcess waitUntilTerminated. |
1279 errorShufflerProcess waitUntilTerminated. |
1280 self shuffleRestFrom:shuffledErrStream to:anErrStream lineWise:lineWise. |
1280 self shuffleRestFrom:shuffledErrStream to:anErrStream lineWise:lineWise. |
1281 shuffledErrStream close. |
1281 shuffledErrStream close. |
1282 ]. |
1282 ]. |
1283 ]. |
1283 ]. |
1284 |
1284 |
1285 closeStreams := [ |
1285 closeStreams := [ |
1286 inStreamToClose notNil ifTrue:[ |
1286 inStreamToClose notNil ifTrue:[ |
1287 inStreamToClose close |
1287 inStreamToClose close |
1288 ]. |
1288 ]. |
1289 errStreamToClose notNil ifTrue:[ |
1289 errStreamToClose notNil ifTrue:[ |
1290 errStreamToClose close |
1290 errStreamToClose close |
1291 ]. |
1291 ]. |
1292 outStreamToClose notNil ifTrue:[ |
1292 outStreamToClose notNil ifTrue:[ |
1293 outStreamToClose close |
1293 outStreamToClose close |
1294 ]. |
1294 ]. |
1295 auxStreamToClose notNil ifTrue:[ |
1295 auxStreamToClose notNil ifTrue:[ |
1296 auxStreamToClose close |
1296 auxStreamToClose close |
1297 ]. |
1297 ]. |
1298 ]. |
1298 ]. |
1299 |
1299 |
1300 |
1300 |
1301 sema := Semaphore new name:'OS command wait'. |
1301 sema := Semaphore new name:'OS command wait'. |
1302 [ |
1302 [ |
1303 pid := Processor |
1303 pid := Processor |
1304 monitor:[ |
1304 monitor:[ |
1305 self |
1305 self |
1306 startProcess:aCommandString |
1306 startProcess:aCommandString |
1307 inputFrom:externalInStream |
1307 inputFrom:externalInStream |
1308 outputTo:externalOutStream |
1308 outputTo:externalOutStream |
1309 errorTo:externalErrStream |
1309 errorTo:externalErrStream |
1310 auxFrom:externalAuxStream |
1310 auxFrom:externalAuxStream |
1311 environment:environmentDictionary |
1311 environment:environmentDictionary |
1312 inDirectory:dirOrNil |
1312 inDirectory:dirOrNil |
1313 ] |
1313 ] |
1314 action:[:status | |
1314 action:[:status | |
1315 status stillAlive ifFalse:[ |
1315 status stillAlive ifFalse:[ |
1316 exitStatus := status. |
1316 exitStatus := status. |
1317 sema signal. |
1317 sema signal. |
1318 self closePid:pid |
1318 self closePid:pid |
1319 ] |
1319 ] |
1320 ]. |
1320 ]. |
1321 |
1321 |
1322 pid isNil ifTrue:[ |
1322 pid isNil ifTrue:[ |
1323 exitStatus := self osProcessStatusClass processCreationFailure |
1323 exitStatus := self osProcessStatusClass processCreationFailure |
1324 ] ifFalse:[ |
1324 ] ifFalse:[ |
1325 sema wait. |
1325 sema wait. |
1326 ]. |
1326 ]. |
1327 ] ifCurtailed:[ |
1327 ] ifCurtailed:[ |
1328 closeStreams value. |
1328 closeStreams value. |
1329 pid notNil ifTrue:[ |
1329 pid notNil ifTrue:[ |
1330 "/ terminate the os-command (and all of its forked commands) |
1330 "/ terminate the os-command (and all of its forked commands) |
1331 self terminateProcessGroup:pid. |
1331 self terminateProcessGroup:pid. |
1332 self terminateProcess:pid. |
1332 self terminateProcess:pid. |
1333 self closePid:pid. |
1333 self closePid:pid. |
1334 ]. |
1334 ]. |
1335 stopShufflers value. |
1335 stopShufflers value. |
1336 ]. |
1336 ]. |
1337 |
1337 |
1338 closeStreams value. |
1338 closeStreams value. |
1339 stopShufflers value. |
1339 stopShufflers value. |
1340 exitStatus success ifFalse:[ |
1340 exitStatus success ifFalse:[ |
1341 ^ aBlock value:exitStatus |
1341 ^ aBlock value:exitStatus |
1342 ]. |
1342 ]. |
1343 ^ true |
1343 ^ true |
1344 |
1344 |
1345 " |
1345 " |
1346 |outStream errStream| |
1346 |outStream errStream| |
1347 |
1347 |
1348 outStream := '' writeStream. |
1348 outStream := '' writeStream. |
1349 |
1349 |
1350 OperatingSystem executeCommand:'ls -l' |
1350 OperatingSystem executeCommand:'ls -l' |
1351 inputFrom:'abc' readStream |
1351 inputFrom:'abc' readStream |
1352 outputTo:outStream |
1352 outputTo:outStream |
1353 errorTo:nil |
1353 errorTo:nil |
1354 inDirectory:nil |
1354 inDirectory:nil |
1355 lineWise:true |
1355 lineWise:true |
1356 onError:[:exitStatus | ^ false]. |
1356 onError:[:exitStatus | ^ false]. |
1357 outStream contents |
1357 outStream contents |
1358 " |
1358 " |
1359 |
1359 |
1360 " |
1360 " |
1361 |outStream errStream| |
1361 |outStream errStream| |
1362 |
1362 |
1363 outStream := #[] writeStream. |
1363 outStream := #[] writeStream. |
1364 |
1364 |
1365 OperatingSystem executeCommand:'cat' |
1365 OperatingSystem executeCommand:'cat' |
1366 inputFrom:(ByteArray new:5000000) readStream |
1366 inputFrom:(ByteArray new:5000000) readStream |
1367 outputTo:outStream |
1367 outputTo:outStream |
1368 errorTo:nil |
1368 errorTo:nil |
1369 inDirectory:nil |
1369 inDirectory:nil |
1370 lineWise:false |
1370 lineWise:false |
1371 onError:[:exitStatus | ^ false]. |
1371 onError:[:exitStatus | ^ false]. |
1372 outStream size |
1372 outStream size |
1373 " |
1373 " |
1374 |
1374 |
1375 " |
1375 " |
1376 |outStream errStream| |
1376 |outStream errStream| |
1377 |
1377 |
1378 outStream := '' writeStream. |
1378 outStream := '' writeStream. |
1379 |
1379 |
1380 OperatingSystem executeCommand:'gpg -s --batch --no-tty --passphrase-fd 0 /tmp/passwd' |
1380 OperatingSystem executeCommand:'gpg -s --batch --no-tty --passphrase-fd 0 /tmp/passwd' |
1381 inputFrom:'bla' readStream |
1381 inputFrom:'bla' readStream |
1382 outputTo:outStream |
1382 outputTo:outStream |
1383 errorTo:nil |
1383 errorTo:nil |
1384 inDirectory:nil |
1384 inDirectory:nil |
1385 lineWise:true |
1385 lineWise:true |
1386 onError:[:exitStatus | false]. |
1386 onError:[:exitStatus | false]. |
1387 outStream contents |
1387 outStream contents |
1388 " |
1388 " |
1389 |
1389 |
1390 "Modified: / 11-02-2007 / 20:54:39 / cg" |
1390 "Modified: / 11-02-2007 / 20:54:39 / cg" |
1391 ! |
1391 ! |
1392 |
1392 |
1393 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream errorTo:anErrStream auxFrom:anAuxStream inDirectory:dirOrNil lineWise:lineWise onError:aBlock |
1393 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream errorTo:anErrStream auxFrom:anAuxStream inDirectory:dirOrNil lineWise:lineWise onError:aBlock |
1394 ^ self |
1394 ^ self |
1395 executeCommand:aCommandString |
1395 executeCommand:aCommandString |
1396 inputFrom:anInStream |
1396 inputFrom:anInStream |
1397 outputTo:anOutStream |
1397 outputTo:anOutStream |
1398 errorTo:anErrStream |
1398 errorTo:anErrStream |
1399 auxFrom:anAuxStream |
1399 auxFrom:anAuxStream |
1400 environment:nil |
1400 environment:nil |
1401 inDirectory:dirOrNil |
1401 inDirectory:dirOrNil |
1402 lineWise:lineWise |
1402 lineWise:lineWise |
1403 onError:aBlock |
1403 onError:aBlock |
1404 ! |
1404 ! |
1405 |
1405 |
1406 executeCommand:aCommandString inputFrom:inputStreamOrNil outputTo:outStreamOrNil errorTo:errStreamOrNil inDirectory:aDirectory |
1406 executeCommand:aCommandString inputFrom:inputStreamOrNil outputTo:outStreamOrNil errorTo:errStreamOrNil inDirectory:aDirectory |
1407 "much like #executeCommand:, but changes the current directory |
1407 "much like #executeCommand:, but changes the current directory |
1408 for the command. Since this is OS specific, use this instead of |
1408 for the command. Since this is OS specific, use this instead of |
1409 hardwiring any 'cd ..' command strings into your applictions." |
1409 hardwiring any 'cd ..' command strings into your applictions." |
1410 |
1410 |
1411 ^ self |
1411 ^ self |
1412 executeCommand:aCommandString |
1412 executeCommand:aCommandString |
1413 inputFrom:inputStreamOrNil |
1413 inputFrom:inputStreamOrNil |
1414 outputTo:outStreamOrNil |
1414 outputTo:outStreamOrNil |
1415 errorTo:errStreamOrNil |
1415 errorTo:errStreamOrNil |
1416 auxFrom:nil |
1416 auxFrom:nil |
1417 inDirectory:aDirectory |
1417 inDirectory:aDirectory |
1418 lineWise:false |
1418 lineWise:false |
1419 onError:[:status| false] |
1419 onError:[:status| false] |
1420 |
1420 |
1421 " |
1421 " |
1422 OperatingSystem executeCommand:'tdump date.obj' inDirectory:'c:\winstx\stx\libbasic\objbc'. |
1422 OperatingSystem executeCommand:'tdump date.obj' inDirectory:'c:\winstx\stx\libbasic\objbc'. |
1423 OperatingSystem executeCommand:'xxdir date.obj' inDirectory:'c:\winstx\stx\libbasic\objbc'. |
1423 OperatingSystem executeCommand:'xxdir date.obj' inDirectory:'c:\winstx\stx\libbasic\objbc'. |
1424 OperatingSystem executeCommand:'dir' inDirectory:'c:\'. |
1424 OperatingSystem executeCommand:'dir' inDirectory:'c:\'. |
1443 those internal stream(s). |
1443 those internal stream(s). |
1444 Nil stream args will execute the command connected to ST/X's standard input, output or |
1444 Nil stream args will execute the command connected to ST/X's standard input, output or |
1445 error resp. - i.e. usually, i/o will be from/to the terminal" |
1445 error resp. - i.e. usually, i/o will be from/to the terminal" |
1446 |
1446 |
1447 ^ self |
1447 ^ self |
1448 executeCommand:aCommandString |
1448 executeCommand:aCommandString |
1449 inputFrom:anInStream |
1449 inputFrom:anInStream |
1450 outputTo:anOutStream |
1450 outputTo:anOutStream |
1451 errorTo:anErrStream |
1451 errorTo:anErrStream |
1452 auxFrom:nil |
1452 auxFrom:nil |
1453 inDirectory:dirOrNil |
1453 inDirectory:dirOrNil |
1454 lineWise:lineWise |
1454 lineWise:lineWise |
1455 onError:aBlock |
1455 onError:aBlock |
1456 ! |
1456 ! |
1457 |
1457 |
1458 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream errorTo:anErrStream inDirectory:dirOrNil onError:aBlock |
1458 executeCommand:aCommandString inputFrom:anInStream outputTo:anOutStream errorTo:anErrStream inDirectory:dirOrNil onError:aBlock |
1459 "execute the unix command specified by the argument, aCommandString. |
1459 "execute the unix command specified by the argument, aCommandString. |
1460 The commandString is passed to a shell for execution - see the description of |
1460 The commandString is passed to a shell for execution - see the description of |
1468 those internal stream(s). |
1468 those internal stream(s). |
1469 Nil stream args will execute the command connected to ST/X's input, output or |
1469 Nil stream args will execute the command connected to ST/X's input, output or |
1470 error resp. - i.e. i/o will be from/to the xterminal" |
1470 error resp. - i.e. i/o will be from/to the xterminal" |
1471 |
1471 |
1472 ^ self |
1472 ^ self |
1473 executeCommand:aCommandString |
1473 executeCommand:aCommandString |
1474 inputFrom:anInStream |
1474 inputFrom:anInStream |
1475 outputTo:anOutStream |
1475 outputTo:anOutStream |
1476 errorTo:anErrStream |
1476 errorTo:anErrStream |
1477 auxFrom:nil |
1477 auxFrom:nil |
1478 inDirectory:dirOrNil |
1478 inDirectory:dirOrNil |
1479 lineWise:false |
1479 lineWise:false |
1480 onError:aBlock |
1480 onError:aBlock |
1481 |
1481 |
1482 " |
1482 " |
1483 OperatingSystem |
1483 OperatingSystem |
1484 executeCommand:'dir' |
1484 executeCommand:'dir' |
1485 inputFrom:nil |
1485 inputFrom:nil |
1486 outputTo:nil |
1486 outputTo:nil |
1487 errorTo:nil |
1487 errorTo:nil |
1488 inDirectory:'c:' |
1488 inDirectory:'c:' |
1489 onError:[:status | Transcript flash] |
1489 onError:[:status | Transcript flash] |
1490 |
1490 |
1491 OperatingSystem |
1491 OperatingSystem |
1492 executeCommand:'foo' |
1492 executeCommand:'foo' |
1493 inputFrom:nil |
1493 inputFrom:nil |
1494 outputTo:nil |
1494 outputTo:nil |
1495 errorTo:nil |
1495 errorTo:nil |
1496 inDirectory:'/etc' |
1496 inDirectory:'/etc' |
1497 onError:[:status | Transcript flash] |
1497 onError:[:status | Transcript flash] |
1498 |
1498 |
1499 |s| |
1499 |s| |
1500 s := '' writeStream. |
1500 s := '' writeStream. |
1501 OperatingSystem |
1501 OperatingSystem |
1502 executeCommand:'ls -l' |
1502 executeCommand:'ls -l' |
1503 inputFrom:nil |
1503 inputFrom:nil |
1504 outputTo:s |
1504 outputTo:s |
1505 errorTo:nil |
1505 errorTo:nil |
1506 onError:[:status | Transcript flash]. |
1506 onError:[:status | Transcript flash]. |
1507 Transcript showCR:s contents. |
1507 Transcript showCR:s contents. |
1508 |
1508 |
1509 |s| |
1509 |s| |
1510 s := '' writeStream. |
1510 s := '' writeStream. |
1511 OperatingSystem |
1511 OperatingSystem |
1512 executeCommand:'sh foo' |
1512 executeCommand:'sh foo' |
1513 inputFrom:nil |
1513 inputFrom:nil |
1514 outputTo:s |
1514 outputTo:s |
1515 errorTo:s |
1515 errorTo:s |
1516 onError:[:status | Transcript flash]. |
1516 onError:[:status | Transcript flash]. |
1517 Transcript showCR:s contents. |
1517 Transcript showCR:s contents. |
1518 " |
1518 " |
1519 |
1519 |
1520 "Modified: / 25.3.1997 / 11:02:02 / stefan" |
1520 "Modified: / 25.3.1997 / 11:02:02 / stefan" |
1521 "Modified: / 28.1.1998 / 14:46:36 / md" |
1521 "Modified: / 28.1.1998 / 14:46:36 / md" |
1530 Return true if successful, the value from aBlock if not. |
1530 Return true if successful, the value from aBlock if not. |
1531 If not successfull, aBlock is called with an OsProcessStatus |
1531 If not successfull, aBlock is called with an OsProcessStatus |
1532 (containing the exit status) as argument." |
1532 (containing the exit status) as argument." |
1533 |
1533 |
1534 ^ self |
1534 ^ self |
1535 executeCommand:aCommandString |
1535 executeCommand:aCommandString |
1536 inputFrom:anInStream |
1536 inputFrom:anInStream |
1537 outputTo:anOutStream |
1537 outputTo:anOutStream |
1538 errorTo:anErrStream |
1538 errorTo:anErrStream |
1539 auxFrom:nil |
1539 auxFrom:nil |
1540 inDirectory:nil |
1540 inDirectory:nil |
1541 lineWise:false |
1541 lineWise:false |
1542 onError:aBlock |
1542 onError:aBlock |
1543 |
1543 |
1544 " |
1544 " |
1545 OperatingSystem |
1545 OperatingSystem |
1546 executeCommand:'dir' |
1546 executeCommand:'dir' |
1547 inputFrom:nil |
1547 inputFrom:nil |
1548 outputTo:nil |
1548 outputTo:nil |
1549 errorTo:nil |
1549 errorTo:nil |
1550 onError:[:status | Transcript flash] |
1550 onError:[:status | Transcript flash] |
1551 |
1551 |
1552 OperatingSystem |
1552 OperatingSystem |
1553 executeCommand:'foo' |
1553 executeCommand:'foo' |
1554 inputFrom:nil |
1554 inputFrom:nil |
1555 outputTo:nil |
1555 outputTo:nil |
1556 errorTo:nil |
1556 errorTo:nil |
1557 onError:[:status | Transcript flash] |
1557 onError:[:status | Transcript flash] |
1558 " |
1558 " |
1559 " |
1559 " |
1560 |outStr errStr| |
1560 |outStr errStr| |
1561 |
1561 |
1562 outStr := '' writeStream. |
1562 outStr := '' writeStream. |
1563 errStr := '' writeStream. |
1563 errStr := '' writeStream. |
1564 OperatingSystem |
1564 OperatingSystem |
1565 executeCommand:'ls' |
1565 executeCommand:'ls' |
1566 inputFrom:nil |
1566 inputFrom:nil |
1567 outputTo:outStr |
1567 outputTo:outStr |
1568 errorTo:errStr |
1568 errorTo:errStr |
1569 onError:[:status | Transcript flash]. |
1569 onError:[:status | Transcript flash]. |
1570 Transcript show:'out:'; showCR:outStr contents. |
1570 Transcript show:'out:'; showCR:outStr contents. |
1571 Transcript show:'err:'; showCR:errStr contents. |
1571 Transcript show:'err:'; showCR:errStr contents. |
1572 " |
1572 " |
1573 " |
1573 " |
1574 |outStr errStr| |
1574 |outStr errStr| |
1575 |
1575 |
1576 outStr := '' writeStream. |
1576 outStr := '' writeStream. |
1577 errStr := '' writeStream. |
1577 errStr := '' writeStream. |
1578 OperatingSystem |
1578 OperatingSystem |
1579 executeCommand:'ls /fooBar' |
1579 executeCommand:'ls /fooBar' |
1580 inputFrom:nil |
1580 inputFrom:nil |
1581 outputTo:outStr |
1581 outputTo:outStr |
1582 errorTo:errStr |
1582 errorTo:errStr |
1583 onError:[:status | Transcript flash]. |
1583 onError:[:status | Transcript flash]. |
1584 Transcript show:'out:'; showCR:outStr contents. |
1584 Transcript show:'out:'; showCR:outStr contents. |
1585 Transcript show:'err:'; showCR:errStr contents. |
1585 Transcript show:'err:'; showCR:errStr contents. |
1586 " |
1586 " |
1587 |
1587 |
1588 "Modified: / 10.11.1998 / 20:51:39 / cg" |
1588 "Modified: / 10.11.1998 / 20:51:39 / cg" |
1589 ! |
1589 ! |
1590 |
1590 |
1595 Return true if successful, the value from aBlock if not. |
1595 Return true if successful, the value from aBlock if not. |
1596 If not successfull, aBlock is called with an OsProcessStatus |
1596 If not successfull, aBlock is called with an OsProcessStatus |
1597 (containing the exit status) as argument." |
1597 (containing the exit status) as argument." |
1598 |
1598 |
1599 ^ self |
1599 ^ self |
1600 executeCommand:aCommandString |
1600 executeCommand:aCommandString |
1601 inputFrom:nil |
1601 inputFrom:nil |
1602 outputTo:nil |
1602 outputTo:nil |
1603 errorTo:nil |
1603 errorTo:nil |
1604 auxFrom:nil |
1604 auxFrom:nil |
1605 inDirectory:nil |
1605 inDirectory:nil |
1606 lineWise:false |
1606 lineWise:false |
1607 onError:aBlock |
1607 onError:aBlock |
1608 |
1608 |
1609 "unix: |
1609 "unix: |
1610 |
1610 |
1611 OperatingSystem executeCommand:'sleep 30' onError:[]. |
1611 OperatingSystem executeCommand:'sleep 30' onError:[]. |
1612 OperatingSystem executeCommand:'pwd' onError:[:status|status inspect]. |
1612 OperatingSystem executeCommand:'pwd' onError:[:status|status inspect]. |
1637 <resource:#obsolete> |
1637 <resource:#obsolete> |
1638 |
1638 |
1639 self obsoleteMethodWarning:'use executeCommand:inDirectory:onError:'. |
1639 self obsoleteMethodWarning:'use executeCommand:inDirectory:onError:'. |
1640 |
1640 |
1641 ^ self |
1641 ^ self |
1642 executeCommand:aCommandString |
1642 executeCommand:aCommandString |
1643 inputFrom:nil |
1643 inputFrom:nil |
1644 outputTo:nil |
1644 outputTo:nil |
1645 errorTo:nil |
1645 errorTo:nil |
1646 auxFrom:nil |
1646 auxFrom:nil |
1647 inDirectory:aDirectory |
1647 inDirectory:aDirectory |
1648 lineWise:false |
1648 lineWise:false |
1649 onError:aBlock |
1649 onError:aBlock |
1650 |
1650 |
1651 "Modified: / 10.11.1998 / 20:54:37 / cg" |
1651 "Modified: / 10.11.1998 / 20:54:37 / cg" |
1652 ! |
1652 ! |
1653 |
1653 |
1654 executeCommand:aCommandString outputTo:anOutStreamOrNil |
1654 executeCommand:aCommandString outputTo:anOutStreamOrNil |
1656 The commandString is passed to a shell for execution - see the description of |
1656 The commandString is passed to a shell for execution - see the description of |
1657 'sh -c' in your UNIX manual. |
1657 'sh -c' in your UNIX manual. |
1658 Return true if successful, false otherwise." |
1658 Return true if successful, false otherwise." |
1659 |
1659 |
1660 ^ self |
1660 ^ self |
1661 executeCommand:aCommandString |
1661 executeCommand:aCommandString |
1662 inputFrom:nil |
1662 inputFrom:nil |
1663 outputTo:anOutStreamOrNil |
1663 outputTo:anOutStreamOrNil |
1664 errorTo:nil |
1664 errorTo:nil |
1665 auxFrom:nil |
1665 auxFrom:nil |
1666 inDirectory:nil |
1666 inDirectory:nil |
1667 lineWise:false |
1667 lineWise:false |
1668 onError:[:status| false] |
1668 onError:[:status| false] |
1669 |
1669 |
1670 " |
1670 " |
1671 String streamContents:[:s|OperatingSystem |
1671 String streamContents:[:s|OperatingSystem |
1672 executeCommand:'ls' |
1672 executeCommand:'ls' |
1673 outputTo:s |
1673 outputTo:s |
1674 ] |
1674 ] |
1675 " |
1675 " |
1676 |
1676 |
1677 " |
1677 " |
1678 String streamContents:[:s|OperatingSystem |
1678 String streamContents:[:s|OperatingSystem |
1679 executeCommand:'pwd' |
1679 executeCommand:'pwd' |
1680 outputTo:s |
1680 outputTo:s |
1681 ] |
1681 ] |
1682 " |
1682 " |
1683 ! |
1683 ! |
1684 |
1684 |
1685 executeCommand:aCommandString outputTo:outStreamOrNil errorTo:errStreamOrNil inDirectory:aDirectory |
1685 executeCommand:aCommandString outputTo:outStreamOrNil errorTo:errStreamOrNil inDirectory:aDirectory |
1686 "much like #executeCommand:, but changes the current directory |
1686 "much like #executeCommand:, but changes the current directory |
1687 for the command. Since this is OS specific, use this instead of |
1687 for the command. Since this is OS specific, use this instead of |
1688 hardwiring any 'cd ..' command strings into your applictions." |
1688 hardwiring any 'cd ..' command strings into your applictions." |
1689 |
1689 |
1690 ^ self |
1690 ^ self |
1691 executeCommand:aCommandString |
1691 executeCommand:aCommandString |
1692 inputFrom:nil |
1692 inputFrom:nil |
1693 outputTo:outStreamOrNil |
1693 outputTo:outStreamOrNil |
1694 errorTo:errStreamOrNil |
1694 errorTo:errStreamOrNil |
1695 auxFrom:nil |
1695 auxFrom:nil |
1696 inDirectory:aDirectory |
1696 inDirectory:aDirectory |
1697 lineWise:false |
1697 lineWise:false |
1698 onError:[:status| false] |
1698 onError:[:status| false] |
1699 |
1699 |
1700 " |
1700 " |
1701 OperatingSystem executeCommand:'tdump date.obj' inDirectory:'c:\winstx\stx\libbasic\objbc'. |
1701 OperatingSystem executeCommand:'tdump date.obj' inDirectory:'c:\winstx\stx\libbasic\objbc'. |
1702 OperatingSystem executeCommand:'xxdir date.obj' inDirectory:'c:\winstx\stx\libbasic\objbc'. |
1702 OperatingSystem executeCommand:'xxdir date.obj' inDirectory:'c:\winstx\stx\libbasic\objbc'. |
1703 OperatingSystem executeCommand:'dir' inDirectory:'c:\'. |
1703 OperatingSystem executeCommand:'dir' inDirectory:'c:\'. |
1718 |
1718 |
1719 |result| |
1719 |result| |
1720 |
1720 |
1721 result := self getCommandOutputFrom:aCommand maxNumberOfLines:1 errorDisposition:#discard. |
1721 result := self getCommandOutputFrom:aCommand maxNumberOfLines:1 errorDisposition:#discard. |
1722 result notNil ifTrue:[ |
1722 result notNil ifTrue:[ |
1723 ^ result firstIfEmpty:[''] |
1723 ^ result firstIfEmpty:[''] |
1724 ]. |
1724 ]. |
1725 ^ result |
1725 ^ result |
1726 |
1726 |
1727 " |
1727 " |
1728 OperatingSystem getCommandOutputFrom:'hostname' |
1728 OperatingSystem getCommandOutputFrom:'hostname' |
1749 Nil is treated like #stderr" |
1749 Nil is treated like #stderr" |
1750 |
1750 |
1751 |result| |
1751 |result| |
1752 |
1752 |
1753 PipeFailed ~~ true ifTrue:[ |
1753 PipeFailed ~~ true ifTrue:[ |
1754 PipeStream openErrorSignal handle:[:ex | |
1754 PipeStream openErrorSignal handle:[:ex | |
1755 PipeFailed := true. |
1755 PipeFailed := true. |
1756 'OperatingSystem [warning]: cannot fork/popen' errorPrintCR. |
1756 'OperatingSystem [warning]: cannot fork/popen' errorPrintCR. |
1757 ex return. |
1757 ex return. |
1758 ] do:[ |
1758 ] do:[ |
1759 |p line| |
1759 |p line| |
1760 |
1760 |
1761 p := PipeStream |
1761 p := PipeStream |
1762 readingFrom:aCommand |
1762 readingFrom:aCommand |
1763 errorDisposition:errorDisposition |
1763 errorDisposition:errorDisposition |
1764 inDirectory:nil. |
1764 inDirectory:nil. |
1765 result := StringCollection new. |
1765 result := StringCollection new. |
1766 [p atEnd] whileFalse:[ |
1766 [p atEnd] whileFalse:[ |
1767 line := p nextLine. |
1767 line := p nextLine. |
1768 (numLinesOrNil isNil |
1768 (numLinesOrNil isNil |
1769 or:[result size < numLinesOrNil]) ifTrue:[ |
1769 or:[result size < numLinesOrNil]) ifTrue:[ |
1770 result add:line |
1770 result add:line |
1771 ]. |
1771 ]. |
1772 ]. |
1772 ]. |
1773 p close. |
1773 p close. |
1774 (p exitStatus notNil |
1774 (p exitStatus notNil |
1775 and:[p exitStatus success]) ifFalse:[ |
1775 and:[p exitStatus success]) ifFalse:[ |
1776 result isEmpty ifTrue:[ |
1776 result isEmpty ifTrue:[ |
1777 result := nil |
1777 result := nil |
1778 ] |
1778 ] |
1779 ]. |
1779 ]. |
1780 ]. |
1780 ]. |
1781 ]. |
1781 ]. |
1782 ^ result |
1782 ^ result |
1783 |
1783 |
1784 " |
1784 " |
1785 OperatingSystem getCommandOutputFrom:'ls' maxNumberOfLines:1 |
1785 OperatingSystem getCommandOutputFrom:'ls' maxNumberOfLines:1 |
1819 ^ fn exists and:[fn isExecutableProgram]. |
1819 ^ fn exists and:[fn isExecutableProgram]. |
1820 |
1820 |
1821 " |
1821 " |
1822 OperatingSystem canExecuteCommand:'fooBar' |
1822 OperatingSystem canExecuteCommand:'fooBar' |
1823 OperatingSystem canExecuteCommand:'ls' |
1823 OperatingSystem canExecuteCommand:'ls' |
1824 OperatingSystem canExecuteCommand:'cvs' |
1824 OperatingSystem canExecuteCommand:'cvs' |
1825 OperatingSystem canExecuteCommand:'diff' |
1825 OperatingSystem canExecuteCommand:'diff' |
1826 OperatingSystem canExecuteCommand:'cvs.exe' |
1826 OperatingSystem canExecuteCommand:'cvs.exe' |
1827 " |
1827 " |
1828 |
1828 |
1829 "Created: 4.11.1995 / 19:13:54 / cg" |
1829 "Created: 4.11.1995 / 19:13:54 / cg" |
1830 ! |
1830 ! |
1831 |
1831 |
1887 If successful, this method does NOT return and smalltalk is gone. |
1887 If successful, this method does NOT return and smalltalk is gone. |
1888 If not successful, it does return. |
1888 If not successful, it does return. |
1889 Can be used on UNIX with fork or on other systems to chain to another program." |
1889 Can be used on UNIX with fork or on other systems to chain to another program." |
1890 |
1890 |
1891 ^ self |
1891 ^ self |
1892 exec:aCommandPath |
1892 exec:aCommandPath |
1893 withArguments:argArray |
1893 withArguments:argArray |
1894 environment:nil |
1894 environment:nil |
1895 fileDescriptors:#(0 1 2) |
1895 fileDescriptors:#(0 1 2) |
1896 fork:false |
1896 fork:false |
1897 newPgrp:false |
1897 newPgrp:false |
1898 inDirectory:nil |
1898 inDirectory:nil |
1899 |
1899 |
1900 "/ never reached ... |
1900 "/ never reached ... |
1901 |
1901 |
1902 "Modified: / 12.11.1998 / 14:44:26 / cg" |
1902 "Modified: / 12.11.1998 / 14:44:26 / cg" |
1903 ! |
1903 ! |
1904 |
1904 |
1905 exec:aCommandPath withArguments:argArray fileDescriptors:fileDescriptors fork:doFork newPgrp:newPgrp inDirectory:aDirectory |
1905 exec:aCommandPath withArguments:argArray fileDescriptors:fileDescriptors fork:doFork newPgrp:newPgrp inDirectory:aDirectory |
1906 ^ self |
1906 ^ self |
1907 exec:aCommandPath |
1907 exec:aCommandPath |
1908 withArguments:argArray |
1908 withArguments:argArray |
1909 environment:nil |
1909 environment:nil |
1910 fileDescriptors:fileDescriptors |
1910 fileDescriptors:fileDescriptors |
1911 fork:doFork |
1911 fork:doFork |
1912 newPgrp:newPgrp |
1912 newPgrp:newPgrp |
1913 inDirectory:aDirectory |
1913 inDirectory:aDirectory |
1914 ! |
1914 ! |
1915 |
1915 |
1916 exec:aCommandPath withArguments:argArray fork:doFork |
1916 exec:aCommandPath withArguments:argArray fork:doFork |
1917 "execute an OS command without I/O redirection. |
1917 "execute an OS command without I/O redirection. |
1918 The command reads its input and writes its output |
1918 The command reads its input and writes its output |
1919 from/to whatever terminal device ST/X was started |
1919 from/to whatever terminal device ST/X was started |
1920 (typically, the terminal window)" |
1920 (typically, the terminal window)" |
1921 |
1921 |
1922 ^ self |
1922 ^ self |
1923 exec:aCommandPath |
1923 exec:aCommandPath |
1924 withArguments:argArray |
1924 withArguments:argArray |
1925 environment:nil |
1925 environment:nil |
1926 fileDescriptors:#(0 1 2) |
1926 fileDescriptors:#(0 1 2) |
1927 fork:doFork |
1927 fork:doFork |
1928 newPgrp:false |
1928 newPgrp:false |
1929 inDirectory:nil |
1929 inDirectory:nil |
1930 |
1930 |
1931 " |
1931 " |
1932 |id| |
1932 |id| |
1933 |
1933 |
1934 id := OperatingSystem fork. |
1934 id := OperatingSystem fork. |
1935 id == 0 ifTrue:[ |
1935 id == 0 ifTrue:[ |
1936 'I am the child'. |
1936 'I am the child'. |
1937 OperatingSystem |
1937 OperatingSystem |
1938 exec:'/bin/ls' |
1938 exec:'/bin/ls' |
1939 withArguments:#('ls' '/tmp') |
1939 withArguments:#('ls' '/tmp') |
1940 fork:false. |
1940 fork:false. |
1941 'not reached'. |
1941 'not reached'. |
1942 ] |
1942 ] |
1943 " |
1943 " |
1944 |
1944 |
1945 " |
1945 " |
1946 |id| |
1946 |id| |
1947 |
1947 |
1948 id := OperatingSystem fork. |
1948 id := OperatingSystem fork. |
1949 id == 0 ifTrue:[ |
1949 id == 0 ifTrue:[ |
1950 'I am the child'. |
1950 'I am the child'. |
1951 OperatingSystem |
1951 OperatingSystem |
1952 exec:'/bin/sh' |
1952 exec:'/bin/sh' |
1953 withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2') |
1953 withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2') |
1954 fork:false. |
1954 fork:false. |
1955 'not reached'. |
1955 'not reached'. |
1956 ]. |
1956 ]. |
1957 id printNL. |
1957 id printNL. |
1958 (Delay forSeconds:3.5) wait. |
1958 (Delay forSeconds:3.5) wait. |
1959 'killing ...' printNL. |
1959 'killing ...' printNL. |
1960 OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id. |
1960 OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id. |
1970 The command reads its input and writes its output |
1970 The command reads its input and writes its output |
1971 from/to whatever terminal device ST/X was started |
1971 from/to whatever terminal device ST/X was started |
1972 (typically, the terminal window)" |
1972 (typically, the terminal window)" |
1973 |
1973 |
1974 ^ self |
1974 ^ self |
1975 exec:aCommandPath |
1975 exec:aCommandPath |
1976 withArguments:argArray |
1976 withArguments:argArray |
1977 environment:nil |
1977 environment:nil |
1978 fileDescriptors:#(0 1 2) |
1978 fileDescriptors:#(0 1 2) |
1979 fork:doFork |
1979 fork:doFork |
1980 newPgrp:false |
1980 newPgrp:false |
1981 inDirectory:aDirectory |
1981 inDirectory:aDirectory |
1982 |
1982 |
1983 " |
1983 " |
1984 |id| |
1984 |id| |
1985 |
1985 |
1986 id := OperatingSystem fork. |
1986 id := OperatingSystem fork. |
1987 id == 0 ifTrue:[ |
1987 id == 0 ifTrue:[ |
1988 'I am the child'. |
1988 'I am the child'. |
1989 OperatingSystem |
1989 OperatingSystem |
1990 exec:'/bin/ls' |
1990 exec:'/bin/ls' |
1991 withArguments:#('ls' '/tmp') |
1991 withArguments:#('ls' '/tmp') |
1992 fork:false. |
1992 fork:false. |
1993 'not reached'. |
1993 'not reached'. |
1994 ] |
1994 ] |
1995 " |
1995 " |
1996 |
1996 |
1997 " |
1997 " |
1998 |id| |
1998 |id| |
1999 |
1999 |
2000 id := OperatingSystem fork. |
2000 id := OperatingSystem fork. |
2001 id == 0 ifTrue:[ |
2001 id == 0 ifTrue:[ |
2002 'I am the child'. |
2002 'I am the child'. |
2003 OperatingSystem |
2003 OperatingSystem |
2004 exec:'/bin/sh' |
2004 exec:'/bin/sh' |
2005 withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2') |
2005 withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2') |
2006 fork:false. |
2006 fork:false. |
2007 'not reached'. |
2007 'not reached'. |
2008 ]. |
2008 ]. |
2009 id printNL. |
2009 id printNL. |
2010 (Delay forSeconds:3.5) wait. |
2010 (Delay forSeconds:3.5) wait. |
2011 'killing ...' printNL. |
2011 'killing ...' printNL. |
2012 OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id. |
2012 OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id. |
2116 files/directories recursively to destinationPathName. |
2116 files/directories recursively to destinationPathName. |
2117 Return true if successful. |
2117 Return true if successful. |
2118 Here, false is returned and the caller should be prepared |
2118 Here, false is returned and the caller should be prepared |
2119 for a fallBack solution. |
2119 for a fallBack solution. |
2120 Notice: |
2120 Notice: |
2121 this is not a public interface; instead, it is used |
2121 this is not a public interface; instead, it is used |
2122 internally by the Filename class, to try a fast copy |
2122 internally by the Filename class, to try a fast copy |
2123 before doing things manually. |
2123 before doing things manually. |
2124 Please use Filename recursiveCopyTo:" |
2124 Please use Filename recursiveCopyTo:" |
2125 |
2125 |
2126 ^ false |
2126 ^ false |
2127 |
2127 |
2128 " |
2128 " |
2129 OperatingSystem recursiveCopyDirectory:'.' to:'/tmp/foo' |
2129 OperatingSystem recursiveCopyDirectory:'.' to:'/tmp/foo' |
2139 is returned, a partial created tree may be left, |
2139 is returned, a partial created tree may be left, |
2140 which is not cleaned-up here." |
2140 which is not cleaned-up here." |
2141 |
2141 |
2142 self createDirectory:dirName. |
2142 self createDirectory:dirName. |
2143 (self isDirectory:dirName) ifFalse:[ |
2143 (self isDirectory:dirName) ifFalse:[ |
2144 (self recursiveCreateDirectory:(dirName asFilename directoryName)) ifFalse:[^ false]. |
2144 (self recursiveCreateDirectory:(dirName asFilename directoryName)) ifFalse:[^ false]. |
2145 ^ self createDirectory:dirName |
2145 ^ self createDirectory:dirName |
2146 ]. |
2146 ]. |
2147 ^ true |
2147 ^ true |
2148 |
2148 |
2149 " |
2149 " |
2150 OperatingSystem recursiveCreateDirectory:'foo/bar/baz' |
2150 OperatingSystem recursiveCreateDirectory:'foo/bar/baz' |
2158 "remove the directory named 'fullPathName' and all contained files/directories. |
2158 "remove the directory named 'fullPathName' and all contained files/directories. |
2159 Return true if successful. |
2159 Return true if successful. |
2160 Here, false is returned and the caller should be prepared |
2160 Here, false is returned and the caller should be prepared |
2161 for a fallBack solution. |
2161 for a fallBack solution. |
2162 Notice: |
2162 Notice: |
2163 this is not a public interface; instead, it is used |
2163 this is not a public interface; instead, it is used |
2164 internally by the Filename class, to try a fast remove |
2164 internally by the Filename class, to try a fast remove |
2165 before doing things manually. |
2165 before doing things manually. |
2166 Please use Filename recursiveRemoveDirectory:" |
2166 Please use Filename recursiveRemoveDirectory:" |
2167 |
2167 |
2168 ^ false |
2168 ^ false |
2169 |
2169 |
2170 " |
2170 " |
2171 OperatingSystem recursiveCreateDirectory:'foo/bar/baz' |
2171 OperatingSystem recursiveCreateDirectory:'foo/bar/baz' |
2229 Notice that the returned number is OS dependent - use the |
2229 Notice that the returned number is OS dependent - use the |
2230 modeMasks as returned by OperatingSystem>>accessMaskFor:" |
2230 modeMasks as returned by OperatingSystem>>accessMaskFor:" |
2231 |
2231 |
2232 " |
2232 " |
2233 this could have been implemented as: |
2233 this could have been implemented as: |
2234 (self infoOf:aPathName) at:#mode |
2234 (self infoOf:aPathName) at:#mode |
2235 but for huge directory searches the code below is faster |
2235 but for huge directory searches the code below is faster |
2236 " |
2236 " |
2237 |
2237 |
2238 ^ (self infoOf:aPathName) at:#mode |
2238 ^ (self infoOf:aPathName) at:#mode |
2239 |
2239 |
2381 getDiskInfoOf:aDirectoryPath |
2381 getDiskInfoOf:aDirectoryPath |
2382 "return some disk info. |
2382 "return some disk info. |
2383 The amount of information returned depends upon the OS, and is |
2383 The amount of information returned depends upon the OS, and is |
2384 not guaranteed to be consistent across architectures. |
2384 not guaranteed to be consistent across architectures. |
2385 On unix and msdos, the information returned is (at least): |
2385 On unix and msdos, the information returned is (at least): |
2386 freeBytes |
2386 freeBytes |
2387 totalBytes |
2387 totalBytes |
2388 Do not depend on any information being present in the returned dictionary; |
2388 Do not depend on any information being present in the returned dictionary; |
2389 users of this method should always use #at:ifAbsent:, and care for the absent case. |
2389 users of this method should always use #at:ifAbsent:, and care for the absent case. |
2390 Nil is returned if no such information can be obtained. |
2390 Nil is returned if no such information can be obtained. |
2391 " |
2391 " |
2392 |
2392 |
2410 "/ |
2410 "/ |
2411 "/ default: return an array filled with |
2411 "/ default: return an array filled with |
2412 "/ root, home and current directories. |
2412 "/ root, home and current directories. |
2413 "/ |
2413 "/ |
2414 ^ Array |
2414 ^ Array |
2415 with:'/' |
2415 with:'/' |
2416 with:(self getHomeDirectory) |
2416 with:(self getHomeDirectory) |
2417 with:(Filename currentDirectory pathName) |
2417 with:(Filename currentDirectory pathName) |
2418 |
2418 |
2419 "Modified: / 5.5.1999 / 01:06:26 / cg" |
2419 "Modified: / 5.5.1999 / 01:06:26 / cg" |
2420 ! |
2420 ! |
2421 |
2421 |
2422 getMountedVolumes |
2422 getMountedVolumes |
2423 "return info about mounted volumes. |
2423 "return info about mounted volumes. |
2424 The amount of information returned depends upon the OS, and is |
2424 The amount of information returned depends upon the OS, and is |
2425 not guaranteed to be consistent across architectures. |
2425 not guaranteed to be consistent across architectures. |
2426 On unix, the information returned is (at least): |
2426 On unix, the information returned is (at least): |
2427 mountPoint - mount point |
2427 mountPoint - mount point |
2428 fileSystem - device or NFS-remotePath |
2428 fileSystem - device or NFS-remotePath |
2429 " |
2429 " |
2430 |
2430 |
2431 ^ #() |
2431 ^ #() |
2432 |
2432 |
2433 " |
2433 " |
2470 |
2470 |
2471 infoOf:aPathName |
2471 infoOf:aPathName |
2472 "return some object filled with info for the file 'aPathName'; |
2472 "return some object filled with info for the file 'aPathName'; |
2473 the info (for which corresponding access methods are understood by |
2473 the info (for which corresponding access methods are understood by |
2474 the returned object) is: |
2474 the returned object) is: |
2475 type - a symbol giving the files type |
2475 type - a symbol giving the files type |
2476 mode - numeric access mode |
2476 mode - numeric access mode |
2477 uid - owners user id |
2477 uid - owners user id |
2478 gid - owners group id |
2478 gid - owners group id |
2479 size - files size |
2479 size - files size |
2480 id - files number (i.e. inode number) |
2480 id - files number (i.e. inode number) |
2481 accessed - last access time (as Timestamp) |
2481 accessed - last access time (as Timestamp) |
2482 modified - last modification time (as Timestamp) |
2482 modified - last modification time (as Timestamp) |
2483 statusChanged - last status change time (as Timestamp) |
2483 statusChanged - last status change time (as Timestamp) |
2484 alternativeName - (windows only: the MSDOS name of the file) |
2484 alternativeName - (windows only: the MSDOS name of the file) |
2485 |
2485 |
2486 Some of the fields may be returned as nil on systems which do not provide |
2486 Some of the fields may be returned as nil on systems which do not provide |
2487 all of the information. |
2487 all of the information. |
2488 Return nil if such a file does not exist. |
2488 Return nil if such a file does not exist. |
2489 For symbolic links (if supported by the OS), |
2489 For symbolic links (if supported by the OS), |
2782 ! |
2782 ! |
2783 |
2783 |
2784 disableTimer |
2784 disableTimer |
2785 "disable timer interrupts. |
2785 "disable timer interrupts. |
2786 WARNING: |
2786 WARNING: |
2787 the system will not operate correctly with timer interrupts |
2787 the system will not operate correctly with timer interrupts |
2788 disabled, because no scheduling or timeouts are possible." |
2788 disabled, because no scheduling or timeouts are possible." |
2789 |
2789 |
2790 self subclassResponsibility |
2790 self subclassResponsibility |
2791 ! |
2791 ! |
2792 |
2792 |
2793 disableUserInterrupts |
2793 disableUserInterrupts |
2794 "disable userInterrupt processing; |
2794 "disable userInterrupt processing; |
2795 when disabled, no ^C processing takes place. |
2795 when disabled, no ^C processing takes place. |
2796 WARNING: |
2796 WARNING: |
2797 If at all, use this only for debugged stand-alone applications, since |
2797 If at all, use this only for debugged stand-alone applications, since |
2798 no exit to the debugger is possible with user interrupts disabled. |
2798 no exit to the debugger is possible with user interrupts disabled. |
2799 We recommend setting up a handler for the signal instead of disabling it." |
2799 We recommend setting up a handler for the signal instead of disabling it." |
2800 |
2800 |
2801 self disableSignal:(self sigBREAK). |
2801 self disableSignal:(self sigBREAK). |
2802 self disableSignal:(self sigINT). |
2802 self disableSignal:(self sigINT). |
2803 ! |
2803 ! |
2804 |
2804 |
2932 killProcess:processId |
2932 killProcess:processId |
2933 "kill an OS process. |
2933 "kill an OS process. |
2934 The process has a no chance to do some cleanup. |
2934 The process has a no chance to do some cleanup. |
2935 |
2935 |
2936 WARNING: in order to avoid zombie processes (on unix), |
2936 WARNING: in order to avoid zombie processes (on unix), |
2937 you may have to fetch the processes exitstatus with |
2937 you may have to fetch the processes exitstatus with |
2938 OperatingSystem>>getStatusOfProcess:aProcessId." |
2938 OperatingSystem>>getStatusOfProcess:aProcessId." |
2939 |
2939 |
2940 self subclassResponsibility |
2940 self subclassResponsibility |
2941 |
2941 |
2942 "Modified: / 10.6.1998 / 12:00:07 / cg" |
2942 "Modified: / 10.6.1998 / 12:00:07 / cg" |
2943 ! |
2943 ! |
2945 killProcessGroup:processGroupId |
2945 killProcessGroup:processGroupId |
2946 "kill an OS process group. |
2946 "kill an OS process group. |
2947 The process has NO chance to do some cleanup. |
2947 The process has NO chance to do some cleanup. |
2948 |
2948 |
2949 WARNING: in order to avoid zombie processes (on unix), |
2949 WARNING: in order to avoid zombie processes (on unix), |
2950 you may have to fetch the processes exitstatus with |
2950 you may have to fetch the processes exitstatus with |
2951 OperatingSystem>>getStatusOfProcess:aProcessId." |
2951 OperatingSystem>>getStatusOfProcess:aProcessId." |
2952 |
2952 |
2953 self subclassResponsibility |
2953 self subclassResponsibility |
2954 |
2954 |
2955 "Created: / 10.6.1998 / 12:00:26 / cg" |
2955 "Created: / 10.6.1998 / 12:00:26 / cg" |
2956 ! |
2956 ! |
2996 aSignalNumber == self sigRETRACT ifTrue:[^ 'HFT access relinquish']. |
2996 aSignalNumber == self sigRETRACT ifTrue:[^ 'HFT access relinquish']. |
2997 aSignalNumber == self sigSOUND ifTrue:[^ 'HFT sound complete']. |
2997 aSignalNumber == self sigSOUND ifTrue:[^ 'HFT sound complete']. |
2998 aSignalNumber == self sigDANGER ifTrue:[^ 'low on paging space']. |
2998 aSignalNumber == self sigDANGER ifTrue:[^ 'low on paging space']. |
2999 |
2999 |
3000 "notice: many systems map SIGPOLL and/or SIGUSR onto SIGIO |
3000 "notice: many systems map SIGPOLL and/or SIGUSR onto SIGIO |
3001 therefore, keep SIGIO always above the two below" |
3001 therefore, keep SIGIO always above the two below" |
3002 aSignalNumber == self sigPOLL ifTrue:[^ 'io available']. |
3002 aSignalNumber == self sigPOLL ifTrue:[^ 'io available']. |
3003 aSignalNumber == self sigURG ifTrue:[^ 'urgent']. |
3003 aSignalNumber == self sigURG ifTrue:[^ 'urgent']. |
3004 |
3004 |
3005 ^ 'unknown signal' |
3005 ^ 'unknown signal' |
3006 |
3006 |
3013 operatingSystemSignal:signalNumber |
3013 operatingSystemSignal:signalNumber |
3014 "return the signal to be raised when an |
3014 "return the signal to be raised when an |
3015 operatingSystem-signal occurs, or nil" |
3015 operatingSystem-signal occurs, or nil" |
3016 |
3016 |
3017 OSSignals notNil ifTrue:[ |
3017 OSSignals notNil ifTrue:[ |
3018 ^ OSSignals at:signalNumber ifAbsent:[nil] |
3018 ^ OSSignals at:signalNumber ifAbsent:[nil] |
3019 ]. |
3019 ]. |
3020 ^ nil |
3020 ^ nil |
3021 ! |
3021 ! |
3022 |
3022 |
3023 operatingSystemSignal:signalNumber install:aSignal |
3023 operatingSystemSignal:signalNumber install:aSignal |
3024 "install a signal to be raised when an operatingSystem-signal occurs" |
3024 "install a signal to be raised when an operatingSystem-signal occurs" |
3025 |
3025 |
3026 OSSignals isNil ifTrue:[ |
3026 OSSignals isNil ifTrue:[ |
3027 OSSignals := Array new:32 |
3027 OSSignals := Array new:32 |
3028 ]. |
3028 ]. |
3029 OSSignals at:signalNumber put:aSignal |
3029 OSSignals at:signalNumber put:aSignal |
3030 ! |
3030 ! |
3031 |
3031 |
3032 sendSignal:signalNumber to:processId |
3032 sendSignal:signalNumber to:processId |
3043 Return true, if the spy-timerInterrupt was enabled. |
3043 Return true, if the spy-timerInterrupt was enabled. |
3044 This was used by the old MessageTally for profiling. |
3044 This was used by the old MessageTally for profiling. |
3045 On systems, where no virtual timer is available, use the real timer |
3045 On systems, where no virtual timer is available, use the real timer |
3046 (which is of course less correct). |
3046 (which is of course less correct). |
3047 OBSOLETE: the new messageTally runs as a high prio process, not using |
3047 OBSOLETE: the new messageTally runs as a high prio process, not using |
3048 spy interrupts." |
3048 spy interrupts." |
3049 |
3049 |
3050 ^ false |
3050 ^ false |
3051 ! |
3051 ! |
3052 |
3052 |
3053 stopSpyTimer |
3053 stopSpyTimer |
3054 "stop spy timing - disable spy timer. |
3054 "stop spy timing - disable spy timer. |
3055 OBSOLETE: the new messageTally runs as a high prio process, not using |
3055 OBSOLETE: the new messageTally runs as a high prio process, not using |
3056 spy interrupts." |
3056 spy interrupts." |
3057 |
3057 |
3058 ^ false |
3058 ^ false |
3059 ! |
3059 ! |
3060 |
3060 |
3061 terminateProcess:processId |
3061 terminateProcess:processId |
3062 "terminate a unix process. |
3062 "terminate a unix process. |
3063 The process has a chance to do some cleanup. |
3063 The process has a chance to do some cleanup. |
3064 |
3064 |
3065 WARNING: in order to avoid zombie processes (on unix), |
3065 WARNING: in order to avoid zombie processes (on unix), |
3066 you may have to fetch the processes exitstatus with |
3066 you may have to fetch the processes exitstatus with |
3067 OperatingSystem>>getStatusOfProcess:aProcessId." |
3067 OperatingSystem>>getStatusOfProcess:aProcessId." |
3068 |
3068 |
3069 self subclassResponsibility |
3069 self subclassResponsibility |
3070 ! |
3070 ! |
3071 |
3071 |
3072 terminateProcessGroup:processGroupId |
3072 terminateProcessGroup:processGroupId |
3073 "terminate a unix process group. |
3073 "terminate a unix process group. |
3074 The process has a chance to do some cleanup. |
3074 The process has a chance to do some cleanup. |
3075 |
3075 |
3076 WARNING: in order to avoid zombie processes (on unix), |
3076 WARNING: in order to avoid zombie processes (on unix), |
3077 you may have to fetch the processes exitstatus with |
3077 you may have to fetch the processes exitstatus with |
3078 OperatingSystem>>getStatusOfProcess:aProcessId." |
3078 OperatingSystem>>getStatusOfProcess:aProcessId." |
3079 |
3079 |
3080 self subclassResponsibility |
3080 self subclassResponsibility |
3081 ! |
3081 ! |
3082 |
3082 |
3083 unblockInterrupts |
3083 unblockInterrupts |
3114 |
3114 |
3115 %{ /* NOCONTEXT */ |
3115 %{ /* NOCONTEXT */ |
3116 int code = 1; |
3116 int code = 1; |
3117 |
3117 |
3118 if (__isSmallInteger(exitCode)) { |
3118 if (__isSmallInteger(exitCode)) { |
3119 code = __intVal(exitCode); |
3119 code = __intVal(exitCode); |
3120 } |
3120 } |
3121 __mainExit(code); |
3121 __mainExit(code); |
3122 %} |
3122 %} |
3123 "OperatingSystem exit:1 - don't evaluate this" |
3123 "OperatingSystem exit:1 - don't evaluate this" |
3124 ! |
3124 ! |
3317 ! |
3317 ! |
3318 |
3318 |
3319 getDomainName |
3319 getDomainName |
3320 "return the domain this host is in. |
3320 "return the domain this host is in. |
3321 Notice: |
3321 Notice: |
3322 not all systems support this; on some, 'unknown' is returned." |
3322 not all systems support this; on some, 'unknown' is returned." |
3323 |
3323 |
3324 self subclassResponsibility |
3324 self subclassResponsibility |
3325 ! |
3325 ! |
3326 |
3326 |
3327 getEnvironment:aStringOrSymbol |
3327 getEnvironment:aStringOrSymbol |
3329 |
3329 |
3330 ^ self subclassResponsibility |
3330 ^ self subclassResponsibility |
3331 ! |
3331 ! |
3332 |
3332 |
3333 getHostName |
3333 getHostName |
3334 "return the hostname we are running on - |
3334 "return the hostname we are running on - |
3335 a fully qalified hostname at best. |
3335 a fully qalified hostname at best. |
3336 |
3336 |
3337 Notice: |
3337 Notice: |
3338 not all systems support this; on some, 'unknown' is returned." |
3338 not all systems support this; on some, 'unknown' is returned." |
3339 |
3339 |
3340 self subclassResponsibility |
3340 self subclassResponsibility |
3341 ! |
3341 ! |
3342 |
3342 |
3343 getLanguage |
3343 getLanguage |
3348 |
3348 |
3349 getLocaleInfo |
3349 getLocaleInfo |
3350 "return a dictionary filled with values from the locale information; |
3350 "return a dictionary filled with values from the locale information; |
3351 Not all fields may be present, depending on the OS's setup and capabilities. |
3351 Not all fields may be present, depending on the OS's setup and capabilities. |
3352 Possible fields are: |
3352 Possible fields are: |
3353 decimalPoint <String> |
3353 decimalPoint <String> |
3354 |
3354 |
3355 thousandsSep <String> |
3355 thousandsSep <String> |
3356 |
3356 |
3357 internationalCurrencySymbol <String> |
3357 internationalCurrencySymbol <String> |
3358 |
3358 |
3359 currencySymbol <String> |
3359 currencySymbol <String> |
3360 |
3360 |
3361 monetaryDecimalPoint <String> |
3361 monetaryDecimalPoint <String> |
3362 |
3362 |
3363 monetaryThousandsSeparator <String> |
3363 monetaryThousandsSeparator <String> |
3364 |
3364 |
3365 positiveSign <String> |
3365 positiveSign <String> |
3366 |
3366 |
3367 negativeSign <String> |
3367 negativeSign <String> |
3368 |
3368 |
3369 internationalFractionalDigits <Integer> |
3369 internationalFractionalDigits <Integer> |
3370 |
3370 |
3371 fractionalDigits <Integer> |
3371 fractionalDigits <Integer> |
3372 |
3372 |
3373 positiveSignPrecedesCurrencySymbol <Boolean> |
3373 positiveSignPrecedesCurrencySymbol <Boolean> |
3374 |
3374 |
3375 negativeSignPrecedesCurrencySymbol <Boolean> |
3375 negativeSignPrecedesCurrencySymbol <Boolean> |
3376 |
3376 |
3377 positiveSignSeparatedBySpaceFromCurrencySymbol <Boolean> |
3377 positiveSignSeparatedBySpaceFromCurrencySymbol <Boolean> |
3378 |
3378 |
3379 negativeSignSeparatedBySpaceFromCurrencySymbol <Boolean> |
3379 negativeSignSeparatedBySpaceFromCurrencySymbol <Boolean> |
3380 |
3380 |
3381 positiveSignPosition <Symbol> |
3381 positiveSignPosition <Symbol> |
3382 one of: #parenthesesAround, |
3382 one of: #parenthesesAround, |
3383 #signPrecedes, |
3383 #signPrecedes, |
3384 #signSuceeds, |
3384 #signSuceeds, |
3385 #signPrecedesCurrencySymbol, |
3385 #signPrecedesCurrencySymbol, |
3386 #signSuceedsCurrencySymbol |
3386 #signSuceedsCurrencySymbol |
3387 |
3387 |
3388 negativeSignPosition <like above> |
3388 negativeSignPosition <like above> |
3389 |
3389 |
3390 it is up to the application to deal with undefined values. |
3390 it is up to the application to deal with undefined values. |
3391 |
3391 |
3392 Notice, that (for now), the system does not use this information; |
3392 Notice, that (for now), the system does not use this information; |
3393 it should be used by applications as required. |
3393 it should be used by applications as required. |
3396 self subclassResponsibility |
3396 self subclassResponsibility |
3397 ! |
3397 ! |
3398 |
3398 |
3399 getNetworkAddresses |
3399 getNetworkAddresses |
3400 "return a dictionary with key:name of interface and |
3400 "return a dictionary with key:name of interface and |
3401 value:the network address for each interface" |
3401 value:the network address for each interface" |
3402 |
3402 |
3403 self subclassResponsibility |
3403 self subclassResponsibility |
3404 ! |
3404 ! |
3405 |
3405 |
3406 getNetworkMACAddresses |
3406 getNetworkMACAddresses |
3407 "return a dictionary with key:name of interface and |
3407 "return a dictionary with key:name of interface and |
3408 value:the MAC adress for each interface" |
3408 value:the MAC adress for each interface" |
3409 |
3409 |
3410 self subclassResponsibility |
3410 self subclassResponsibility |
3411 ! |
3411 ! |
3412 |
3412 |
3413 getNetworkMACAddressesForIf:ifName |
3413 getNetworkMACAddressesForIf:ifName |
3634 |
3634 |
3635 getSystemID |
3635 getSystemID |
3636 "if supported by the OS, return the systemID; |
3636 "if supported by the OS, return the systemID; |
3637 a unique per machine identification. |
3637 a unique per machine identification. |
3638 WARNING: |
3638 WARNING: |
3639 not all systems support this; on some, 'unknown' is returned." |
3639 not all systems support this; on some, 'unknown' is returned." |
3640 |
3640 |
3641 ^ 'unknown' |
3641 ^ 'unknown' |
3642 |
3642 |
3643 " |
3643 " |
3644 OperatingSystem getSystemID |
3644 OperatingSystem getSystemID |
3656 OS, for example, linux returns 'ix86', while WIN32 returns 'x86'. |
3656 OS, for example, linux returns 'ix86', while WIN32 returns 'x86'. |
3657 |
3657 |
3658 This method is mainly provided to augment error reports with some system |
3658 This method is mainly provided to augment error reports with some system |
3659 information. |
3659 information. |
3660 (in case of system/version specific OS errors, conditional workarounds and patches |
3660 (in case of system/version specific OS errors, conditional workarounds and patches |
3661 may be based upon this info). |
3661 may be based upon this info). |
3662 Your application should NOT depend upon this in any way. |
3662 Your application should NOT depend upon this in any way. |
3663 |
3663 |
3664 The returned info may (or may not) contain: |
3664 The returned info may (or may not) contain: |
3665 #system -> some operating system identification (irix, Linux, nt, win32s ...) |
3665 #system -> some operating system identification (irix, Linux, nt, win32s ...) |
3666 #version -> OS version (some os version identification) |
3666 #version -> OS version (some os version identification) |
3667 #release -> OS release (3.5, 1.2.1 ...) |
3667 #release -> OS release (3.5, 1.2.1 ...) |
3668 #node -> some host identification (hostname) |
3668 #node -> some host identification (hostname) |
3669 #domain -> domain name (hosts domain) |
3669 #domain -> domain name (hosts domain) |
3670 #machine -> type of machine (i586, mips ...) |
3670 #machine -> type of machine (i586, mips ...) |
3671 " |
3671 " |
3672 |
3672 |
3673 |info| |
3673 |info| |
3674 |
3674 |
3675 info := IdentityDictionary new. |
3675 info := IdentityDictionary new. |
3703 |
3703 |
3704 getWindowsDirectory |
3704 getWindowsDirectory |
3705 "internal interface - only for Windows based systems. |
3705 "internal interface - only for Windows based systems. |
3706 Return the windows directory, which, depending on the system, |
3706 Return the windows directory, which, depending on the system, |
3707 may be |
3707 may be |
3708 '\WINNT', '\WINDOWS' |
3708 '\WINNT', '\WINDOWS' |
3709 or whatever. |
3709 or whatever. |
3710 On non-windows systems, nil is returned." |
3710 On non-windows systems, nil is returned." |
3711 |
3711 |
3712 ^ nil |
3712 ^ nil |
3713 |
3713 |
3717 ! |
3717 ! |
3718 |
3718 |
3719 getWindowsSystemDirectory |
3719 getWindowsSystemDirectory |
3720 "internal interface - only for Windows based systems. |
3720 "internal interface - only for Windows based systems. |
3721 Return the windows system directory, which, depending on the system, |
3721 Return the windows system directory, which, depending on the system, |
3722 may be |
3722 may be |
3723 '\WINNT\SYSTEM32', '\WINDOWS\SYSTEM' |
3723 '\WINNT\SYSTEM32', '\WINDOWS\SYSTEM' |
3724 or whatever. |
3724 or whatever. |
3725 On non-windows systems, nil is returned." |
3725 On non-windows systems, nil is returned." |
3726 |
3726 |
3727 ^ nil |
3727 ^ nil |
3728 |
3728 |
3803 "return a collection of strings as possibly returned by getPlatformName. |
3803 "return a collection of strings as possibly returned by getPlatformName. |
3804 Should be used instead of getOSType or getSystemType if multiple choice |
3804 Should be used instead of getOSType or getSystemType if multiple choice |
3805 dialogs are presented to the user." |
3805 dialogs are presented to the user." |
3806 |
3806 |
3807 ^#( |
3807 ^#( |
3808 win32 |
3808 win32 |
3809 os2 "/ actually - this is no longer true |
3809 os2 "/ actually - this is no longer true |
3810 macos "/ actually - this is no longer true |
3810 macos "/ actually - this is no longer true |
3811 vms "/ actually - this is no longer true |
3811 vms "/ actually - this is no longer true |
3812 beos "/ actually - this was never true |
3812 beos "/ actually - this was never true |
3813 unix |
3813 unix |
3814 ) |
3814 ) |
3815 |
3815 |
3816 " |
3816 " |
3817 OperatingSystem knownPlatformNames |
3817 OperatingSystem knownPlatformNames |
3818 OperatingSystem platformName |
3818 OperatingSystem platformName |
3823 ! |
3823 ! |
3824 |
3824 |
3825 maxFileNameLength |
3825 maxFileNameLength |
3826 "return the max number of characters in a filename. |
3826 "return the max number of characters in a filename. |
3827 CAVEAT: |
3827 CAVEAT: |
3828 Actually, the following is somewhat wrong - some systems |
3828 Actually, the following is somewhat wrong - some systems |
3829 support different sizes, depending on the volume. |
3829 support different sizes, depending on the volume. |
3830 We return a somewhat conservative number here. |
3830 We return a somewhat conservative number here. |
3831 Another entry, to query for volume specific max |
3831 Another entry, to query for volume specific max |
3832 will be added in the future." |
3832 will be added in the future." |
3833 |
3833 |
3834 self subclassResponsibility |
3834 self subclassResponsibility |
3835 ! |
3835 ! |
3836 |
3836 |
3837 maxNumberOfOpenFiles |
3837 maxNumberOfOpenFiles |
3912 " |
3912 " |
3913 |
3913 |
3914 "Modified: 20.6.1997 / 17:37:26 / cg" |
3914 "Modified: 20.6.1997 / 17:37:26 / cg" |
3915 ! |
3915 ! |
3916 |
3916 |
3917 randomBytesInto:bufferOrInteger |
3917 randomBytesInto:bufferOrInteger |
3918 "If bufferOrInteger is a String or a ByteArray, |
3918 "If bufferOrInteger is a String or a ByteArray, |
3919 fill a given buffer with random bytes from the RtlGenRandom function |
3919 fill a given buffer with random bytes from the RtlGenRandom function |
3920 and nswer the buffer. |
3920 and nswer the buffer. |
3921 |
3921 |
3922 If bufferOrInteger is a SmallInteger, |
3922 If bufferOrInteger is a SmallInteger, |
3923 return this many bytes (max 4) as a SmallInteger. |
3923 return this many bytes (max 4) as a SmallInteger. |
3924 |
3924 |
3925 Return nil on error (may raise PrimitiveFailure, too). |
3925 Return nil on error (may raise PrimitiveFailure, too). |
3926 |
3926 |
3927 NOTE: This is a private interface, please use RandomGenerator!! |
3927 NOTE: This is a private interface, please use RandomGenerator!! |
3928 |
3928 |
3929 Subclasses should implement this, if the OperatingSystem supports a random generator." |
3929 Subclasses should implement this, if the OperatingSystem supports a random generator." |
3930 |
3930 |
3931 ^ nil "not implemented" |
3931 ^ nil "not implemented" |
3932 ! |
3932 ! |
3933 |
3933 |
3934 setEnvironment:aStringOrSymbol to:newValueString |
3934 setEnvironment:aStringOrSymbol to:newValueString |
3935 "set an environment variable" |
3935 "set an environment variable" |
3936 |
3936 |
4100 "/ the executable's directory: |
4100 "/ the executable's directory: |
4101 "/ (/opt/stx/bin/stx -> /opt/stx/bin) |
4101 "/ (/opt/stx/bin/stx -> /opt/stx/bin) |
4102 "/ |
4102 "/ |
4103 appDirName := self pathOfSTXExecutable asFilename directory. |
4103 appDirName := self pathOfSTXExecutable asFilename directory. |
4104 (packagePath includes:appDirName) ifFalse:[ |
4104 (packagePath includes:appDirName) ifFalse:[ |
4105 packagePath add:appDirName. |
4105 packagePath add:appDirName. |
4106 ]. |
4106 ]. |
4107 |
4107 |
4108 "/ |
4108 "/ |
4109 "/ the executable's parent directory: |
4109 "/ the executable's parent directory: |
4110 "/ (/opt/stx/bin/stx -> /opt/stx/packages) |
4110 "/ (/opt/stx/bin/stx -> /opt/stx/packages) |
4111 "/ |
4111 "/ |
4112 appDir := self pathOfSTXExecutable asFilename directory directory. |
4112 appDir := self pathOfSTXExecutable asFilename directory directory. |
4113 dirName := appDir pathName. |
4113 dirName := appDir pathName. |
4114 (packagePath includes:dirName) ifFalse:[ |
4114 (packagePath includes:dirName) ifFalse:[ |
4115 packagePath add:dirName. |
4115 packagePath add:dirName. |
4116 ]. |
4116 ]. |
4117 |
4117 |
4118 homeDirName := OperatingSystem getHomeDirectory. |
4118 homeDirName := OperatingSystem getHomeDirectory. |
4119 homeDirName notNil ifTrue:[ |
4119 homeDirName notNil ifTrue:[ |
4120 "/ |
4120 "/ |
4121 "/ a users private smalltalk directory in its home (login) directory: |
4121 "/ a users private smalltalk directory in its home (login) directory: |
4122 "/ $HOME/.smalltalk/packages or $HOME\smalltalk\packages |
4122 "/ $HOME/.smalltalk/packages or $HOME\smalltalk\packages |
4123 "/ |
4123 "/ |
4124 OperatingSystem isUNIXlike ifTrue:[ |
4124 OperatingSystem isUNIXlike ifTrue:[ |
4125 priv := '.smalltalk'. |
4125 priv := '.smalltalk'. |
4126 ] ifFalse:[ |
4126 ] ifFalse:[ |
4127 priv := 'smalltalk'. |
4127 priv := 'smalltalk'. |
4128 ]. |
4128 ]. |
4129 userPrivateSTXDir := homeDirName asFilename / priv. |
4129 userPrivateSTXDir := homeDirName asFilename / priv. |
4130 (userPrivateSTXDir isDirectory) ifTrue:[ |
4130 (userPrivateSTXDir isDirectory) ifTrue:[ |
4131 dirName := userPrivateSTXDir pathName. |
4131 dirName := userPrivateSTXDir pathName. |
4132 (packagePath includes:dirName) ifFalse:[ |
4132 (packagePath includes:dirName) ifFalse:[ |
4133 packagePath add:dirName |
4133 packagePath add:dirName |
4134 ] |
4134 ] |
4135 ]. |
4135 ]. |
4136 ]. |
4136 ]. |
4137 |
4137 |
4138 "/ |
4138 "/ |
4139 "/ STX_TOPDIR from the environment: |
4139 "/ STX_TOPDIR from the environment: |
4140 "/ $STX_TOPDIR/packages |
4140 "/ $STX_TOPDIR/packages |
4141 "/ |
4141 "/ |
4142 topDirName := OperatingSystem getEnvironment:'STX_TOPDIR'. |
4142 topDirName := OperatingSystem getEnvironment:'STX_TOPDIR'. |
4143 topDirName notNil ifTrue:[ |
4143 topDirName notNil ifTrue:[ |
4144 (packagePath includes:topDirName) ifFalse:[ |
4144 (packagePath includes:topDirName) ifFalse:[ |
4145 packagePath add:topDirName |
4145 packagePath add:topDirName |
4146 ]. |
4146 ]. |
4147 ]. |
4147 ]. |
4148 |
4148 |
4149 packagePath := packagePath select:[:each | (each asFilename / 'packages') exists] |
4149 packagePath := packagePath select:[:each | (each asFilename / 'packages') exists] |
4150 thenCollect:[:each | (each asFilename constructString:'packages')]. |
4150 thenCollect:[:each | (each asFilename constructString:'packages')]. |
4151 |
4151 |
4152 " |
4152 " |
4153 unconditionally prepend all directories from $STX_PACKAGEPATH |
4153 unconditionally prepend all directories from $STX_PACKAGEPATH |
4154 " |
4154 " |
4155 (dirName := OperatingSystem getEnvironment:'STX_PACKAGEPATH') notNil ifTrue:[ |
4155 (dirName := OperatingSystem getEnvironment:'STX_PACKAGEPATH') notNil ifTrue:[ |
4156 dirName := dirName asCollectionOfSubstringsSeparatedBy:$:. |
4156 dirName := dirName asCollectionOfSubstringsSeparatedBy:$:. |
4157 dirName reverseDo:[:eachDirectoryName| |
4157 dirName reverseDo:[:eachDirectoryName| |
4158 (packagePath includes:eachDirectoryName) ifFalse:[ |
4158 (packagePath includes:eachDirectoryName) ifFalse:[ |
4159 packagePath addFirst:eachDirectoryName. |
4159 packagePath addFirst:eachDirectoryName. |
4160 ]. |
4160 ]. |
4161 ]. |
4161 ]. |
4162 ]. |
4162 ]. |
4163 |
4163 |
4164 "maybe the sources are kept in a central place..." |
4164 "maybe the sources are kept in a central place..." |
4165 (appDir / 'source') isDirectory ifTrue:[ |
4165 (appDir / 'source') isDirectory ifTrue:[ |
4166 packagePath add:(appDir / 'source') pathName. |
4166 packagePath add:(appDir / 'source') pathName. |
4167 ]. |
4167 ]. |
4168 |
4168 |
4169 "maybe we are running in the build environment: XXX/stx /projects /smalltalk |
4169 "maybe we are running in the build environment: XXX/stx /projects /smalltalk |
4170 or: XXX/exept /expecco /application |
4170 or: XXX/exept /expecco /application |
4171 - if XXX/stx/libbasic exists, add XXX to the package path" |
4171 - if XXX/stx/libbasic exists, add XXX to the package path" |
4172 |
4172 |
4173 topDirName isNil ifTrue:[ |
4173 topDirName isNil ifTrue:[ |
4174 "appdir is now: projects" |
4174 "appdir is now: projects" |
4175 appDir := appDir directory directory. |
4175 appDir := appDir directory directory. |
4176 (appDir / 'stx' / 'libbasic') isDirectory ifTrue:[ |
4176 (appDir / 'stx' / 'libbasic') isDirectory ifTrue:[ |
4177 packagePath add:appDir pathName. |
4177 packagePath add:appDir pathName. |
4178 ]. |
4178 ]. |
4179 ]. |
4179 ]. |
4180 |
4180 |
4181 ^ packagePath |
4181 ^ packagePath |
4182 |
4182 |
4183 " |
4183 " |
4210 "/ the executable's directory |
4210 "/ the executable's directory |
4211 "/ and the executables parent directory (if it is an installed version) |
4211 "/ and the executables parent directory (if it is an installed version) |
4212 "/ |
4212 "/ |
4213 appPath := self pathOfSTXExecutable. |
4213 appPath := self pathOfSTXExecutable. |
4214 appPath notNil ifTrue:[ |
4214 appPath notNil ifTrue:[ |
4215 appDir := appPath asFilename directory. |
4215 appDir := appPath asFilename directory. |
4216 appPath := appDir pathName. |
4216 appPath := appDir pathName. |
4217 (sysPath includes:appPath) ifFalse:[ |
4217 (sysPath includes:appPath) ifFalse:[ |
4218 sysPath add:appPath. |
4218 sysPath add:appPath. |
4219 ]. |
4219 ]. |
4220 appDir baseName = 'bin' ifTrue:[ |
4220 appDir baseName = 'bin' ifTrue:[ |
4221 appPath := appDir directory pathName. |
4221 appPath := appDir directory pathName. |
4222 (sysPath includes:appPath) ifFalse:[ |
4222 (sysPath includes:appPath) ifFalse:[ |
4223 sysPath add:appPath. |
4223 sysPath add:appPath. |
4224 ]. |
4224 ]. |
4225 ]. |
4225 ]. |
4226 ]. |
4226 ]. |
4227 |
4227 |
4228 "/ |
4228 "/ |
4229 "/ the users home (login) directory |
4229 "/ the users home (login) directory |
4230 "/ |
4230 "/ |
4231 homePath := self getHomeDirectory. |
4231 homePath := self getHomeDirectory. |
4232 homePath notNil ifTrue:[ |
4232 homePath notNil ifTrue:[ |
4233 "/ |
4233 "/ |
4234 "/ a users private smalltalk directory in its home (login) directory |
4234 "/ a users private smalltalk directory in its home (login) directory |
4235 "/ |
4235 "/ |
4236 OperatingSystem isUNIXlike ifTrue:[ |
4236 OperatingSystem isUNIXlike ifTrue:[ |
4237 priv := '.smalltalk'. |
4237 priv := '.smalltalk'. |
4238 ] ifFalse:[ |
4238 ] ifFalse:[ |
4239 priv := 'smalltalk'. |
4239 priv := 'smalltalk'. |
4240 ]. |
4240 ]. |
4241 userPrivateSTXDir := homePath asFilename construct:priv. |
4241 userPrivateSTXDir := homePath asFilename construct:priv. |
4242 (userPrivateSTXDir isDirectory) ifTrue:[ |
4242 (userPrivateSTXDir isDirectory) ifTrue:[ |
4243 userPrivateSTXDir := userPrivateSTXDir pathName. |
4243 userPrivateSTXDir := userPrivateSTXDir pathName. |
4244 (sysPath includes:userPrivateSTXDir) ifFalse:[ |
4244 (sysPath includes:userPrivateSTXDir) ifFalse:[ |
4245 sysPath add:userPrivateSTXDir |
4245 sysPath add:userPrivateSTXDir |
4246 ] |
4246 ] |
4247 ]. |
4247 ]. |
4248 ]. |
4248 ]. |
4249 |
4249 |
4250 "/ |
4250 "/ |
4251 "/ SMALLTALK_LIBDIR, STX_LIBDIR and STX_TOPDIR from the environment |
4251 "/ SMALLTALK_LIBDIR, STX_LIBDIR and STX_TOPDIR from the environment |
4252 "/ |
4252 "/ |
4253 #( |
4253 #( |
4254 'SMALLTALK_LIBDIR' |
4254 'SMALLTALK_LIBDIR' |
4255 'STX_LIBDIR' |
4255 'STX_LIBDIR' |
4256 'STX_TOPDIR' |
4256 'STX_TOPDIR' |
4257 ) do:[:each | |
4257 ) do:[:each | |
4258 p := OperatingSystem getEnvironment:each. |
4258 p := OperatingSystem getEnvironment:each. |
4259 p notNil ifTrue:[ |
4259 p notNil ifTrue:[ |
4260 p := p asFilename pathName. |
4260 p := p asFilename pathName. |
4261 (p asFilename isDirectory) ifTrue:[ |
4261 (p asFilename isDirectory) ifTrue:[ |
4262 (sysPath includes:p) ifFalse:[ |
4262 (sysPath includes:p) ifFalse:[ |
4263 sysPath add:p |
4263 sysPath add:p |
4264 ] |
4264 ] |
4265 ] |
4265 ] |
4266 ]. |
4266 ]. |
4267 ]. |
4267 ]. |
4268 ^ sysPath |
4268 ^ sysPath |
4269 |
4269 |
4270 " |
4270 " |
4271 OperatingSystem defaultSystemPath |
4271 OperatingSystem defaultSystemPath |
4272 " |
4272 " |
4273 |
4273 |
4274 "Modified: / 24.12.1999 / 00:30:27 / cg" |
4274 "Modified: / 24.12.1999 / 00:30:27 / cg" |
4275 ! ! |
4275 ! ! |
4276 |
4276 |
4303 |domainCode| |
4303 |domainCode| |
4304 |
4304 |
4305 %{ /*NOCONTEXT*/ |
4305 %{ /*NOCONTEXT*/ |
4306 |
4306 |
4307 if (__isSmallInteger(aSymbolOrInteger) || aSymbolOrInteger == nil) { |
4307 if (__isSmallInteger(aSymbolOrInteger) || aSymbolOrInteger == nil) { |
4308 RETURN (aSymbolOrInteger); |
4308 RETURN (aSymbolOrInteger); |
4309 } |
4309 } |
4310 |
4310 |
4311 #ifdef AF_INET |
4311 #ifdef AF_INET |
4312 else if ((aSymbolOrInteger == @symbol(AF_INET)) || (aSymbolOrInteger == @symbol(inet))) |
4312 else if ((aSymbolOrInteger == @symbol(AF_INET)) || (aSymbolOrInteger == @symbol(inet))) |
4313 domainCode = __mkSmallInteger(AF_INET); |
4313 domainCode = __mkSmallInteger(AF_INET); |
4499 |domainSymbol| |
4499 |domainSymbol| |
4500 |
4500 |
4501 %{ /*NOCONTEXT*/ |
4501 %{ /*NOCONTEXT*/ |
4502 |
4502 |
4503 if (__isSmallInteger(anInteger)) { |
4503 if (__isSmallInteger(anInteger)) { |
4504 switch(__intVal(anInteger)) { |
4504 switch(__intVal(anInteger)) { |
4505 #ifdef AF_INET |
4505 #ifdef AF_INET |
4506 case AF_INET: |
4506 case AF_INET: |
4507 domainSymbol = @symbol(AF_INET); |
4507 domainSymbol = @symbol(AF_INET); |
4508 break; |
4508 break; |
4509 #endif |
4509 #endif |
4510 #ifdef AF_INET6 |
4510 #ifdef AF_INET6 |
4511 case AF_INET6: |
4511 case AF_INET6: |
4512 domainSymbol = @symbol(AF_INET6); |
4512 domainSymbol = @symbol(AF_INET6); |
4513 break; |
4513 break; |
4514 #endif |
4514 #endif |
4515 #ifdef AF_UNIX |
4515 #ifdef AF_UNIX |
4516 case AF_UNIX: |
4516 case AF_UNIX: |
4517 domainSymbol = @symbol(AF_UNIX); |
4517 domainSymbol = @symbol(AF_UNIX); |
4518 break; |
4518 break; |
4519 #endif |
4519 #endif |
4520 #ifdef AF_APPLETALK |
4520 #ifdef AF_APPLETALK |
4521 case AF_APPLETALK: |
4521 case AF_APPLETALK: |
4522 domainSymbol = @symbol(AF_APPLETALK); |
4522 domainSymbol = @symbol(AF_APPLETALK); |
4523 break; |
4523 break; |
4524 #endif |
4524 #endif |
4525 #ifdef AF_DECnet |
4525 #ifdef AF_DECnet |
4526 case AF_DECnet: |
4526 case AF_DECnet: |
4527 domainSymbol = @symbol(AF_DECnet); |
4527 domainSymbol = @symbol(AF_DECnet); |
4528 break; |
4528 break; |
4529 #endif |
4529 #endif |
4530 #ifdef AF_NS |
4530 #ifdef AF_NS |
4531 case AF_NS: |
4531 case AF_NS: |
4532 domainSymbol = @symbol(AF_NS); |
4532 domainSymbol = @symbol(AF_NS); |
4533 break; |
4533 break; |
4534 #endif |
4534 #endif |
4535 #ifdef AF_X25 |
4535 #ifdef AF_X25 |
4536 case AF_X25: |
4536 case AF_X25: |
4537 domainSymbol = @symbol(AF_X25); |
4537 domainSymbol = @symbol(AF_X25); |
4538 break; |
4538 break; |
4539 #endif |
4539 #endif |
4540 #ifdef AF_SNA |
4540 #ifdef AF_SNA |
4541 case AF_SNA: |
4541 case AF_SNA: |
4542 domainSymbol = @symbol(AF_SNA); |
4542 domainSymbol = @symbol(AF_SNA); |
4543 break; |
4543 break; |
4544 #endif |
4544 #endif |
4545 #ifdef AF_RAW |
4545 #ifdef AF_RAW |
4546 case AF_RAW: |
4546 case AF_RAW: |
4547 domainSymbol = @symbol(AF_RAW); |
4547 domainSymbol = @symbol(AF_RAW); |
4548 break; |
4548 break; |
4549 #endif |
4549 #endif |
4550 #ifdef AF_ISO |
4550 #ifdef AF_ISO |
4551 case AF_ISO: |
4551 case AF_ISO: |
4552 domainSymbol = @symbol(AF_ISO); |
4552 domainSymbol = @symbol(AF_ISO); |
4553 break; |
4553 break; |
4554 #endif |
4554 #endif |
4555 #ifdef AF_ECMA |
4555 #ifdef AF_ECMA |
4556 case AF_ECMA: |
4556 case AF_ECMA: |
4557 domainSymbol = @symbol(AF_ECMA); |
4557 domainSymbol = @symbol(AF_ECMA); |
4558 break; |
4558 break; |
4559 #endif |
4559 #endif |
4560 #ifdef AF_NETBIOS |
4560 #ifdef AF_NETBIOS |
4561 case AF_NETBIOS: |
4561 case AF_NETBIOS: |
4562 domainSymbol = @symbol(AF_NETBIOS); |
4562 domainSymbol = @symbol(AF_NETBIOS); |
4563 break; |
4563 break; |
4564 #endif |
4564 #endif |
4565 #ifdef AF_IPX |
4565 #ifdef AF_IPX |
4566 case AF_IPX: |
4566 case AF_IPX: |
4567 domainSymbol = @symbol(AF_IPX); |
4567 domainSymbol = @symbol(AF_IPX); |
4568 break; |
4568 break; |
4569 #endif |
4569 #endif |
4570 #ifdef AF_AX25 |
4570 #ifdef AF_AX25 |
4571 case AF_AX25: |
4571 case AF_AX25: |
4572 domainSymbol = @symbol(AF_AX25); |
4572 domainSymbol = @symbol(AF_AX25); |
4573 break; |
4573 break; |
4574 #endif |
4574 #endif |
4575 #ifdef AF_NETROM |
4575 #ifdef AF_NETROM |
4576 case AF_NETROM: |
4576 case AF_NETROM: |
4577 domainSymbol = @symbol(AF_NETROM); |
4577 domainSymbol = @symbol(AF_NETROM); |
4578 break; |
4578 break; |
4579 #endif |
4579 #endif |
4580 #ifdef AF_BRIDGE |
4580 #ifdef AF_BRIDGE |
4581 case AF_BRIDGE: |
4581 case AF_BRIDGE: |
4582 domainSymbol = @symbol(AF_BRIDGE); |
4582 domainSymbol = @symbol(AF_BRIDGE); |
4583 break; |
4583 break; |
4584 #endif |
4584 #endif |
4585 #ifdef AF_BSC |
4585 #ifdef AF_BSC |
4586 case AF_BSC: |
4586 case AF_BSC: |
4587 domainSymbol = @symbol(AF_BSC); |
4587 domainSymbol = @symbol(AF_BSC); |
4588 break; |
4588 break; |
4589 #endif |
4589 #endif |
4590 #ifdef AF_ROSE |
4590 #ifdef AF_ROSE |
4591 case AF_ROSE: |
4591 case AF_ROSE: |
4592 domainSymbol = @symbol(AF_ROSE); |
4592 domainSymbol = @symbol(AF_ROSE); |
4593 break; |
4593 break; |
4594 #endif |
4594 #endif |
4595 #ifdef AF_IRDA |
4595 #ifdef AF_IRDA |
4596 case AF_IRDA: |
4596 case AF_IRDA: |
4597 domainSymbol = @symbol(AF_IRDA); |
4597 domainSymbol = @symbol(AF_IRDA); |
4598 break; |
4598 break; |
4599 #endif |
4599 #endif |
4600 #ifdef AF_BAN |
4600 #ifdef AF_BAN |
4601 case AF_BAN: |
4601 case AF_BAN: |
4602 domainSymbol = @symbol(AF_BAN); |
4602 domainSymbol = @symbol(AF_BAN); |
4603 break; |
4603 break; |
4604 #endif |
4604 #endif |
4605 #ifdef AF_VOICEVIEW |
4605 #ifdef AF_VOICEVIEW |
4606 case AF_VOICEVIEW: |
4606 case AF_VOICEVIEW: |
4607 domainSymbol = @symbol(AF_VOICEVIEW); |
4607 domainSymbol = @symbol(AF_VOICEVIEW); |
4608 break; |
4608 break; |
4609 #endif |
4609 #endif |
4610 #ifdef AF_ATM |
4610 #ifdef AF_ATM |
4611 case AF_ATM: |
4611 case AF_ATM: |
4612 domainSymbol = @symbol(AF_ATM); |
4612 domainSymbol = @symbol(AF_ATM); |
4613 break; |
4613 break; |
4614 #endif |
4614 #endif |
4615 #ifdef AF_ATMPVC |
4615 #ifdef AF_ATMPVC |
4616 case AF_ATMPVC: |
4616 case AF_ATMPVC: |
4617 domainSymbol = @symbol(AF_ATMPVC); |
4617 domainSymbol = @symbol(AF_ATMPVC); |
4618 break; |
4618 break; |
4619 #endif |
4619 #endif |
4620 #ifdef AF_ATMSVC |
4620 #ifdef AF_ATMSVC |
4621 case AF_ATMSVC: |
4621 case AF_ATMSVC: |
4622 domainSymbol = @symbol(AF_ATMSVC); |
4622 domainSymbol = @symbol(AF_ATMSVC); |
4623 break; |
4623 break; |
4624 #endif |
4624 #endif |
4625 #ifdef AF_SECURITY |
4625 #ifdef AF_SECURITY |
4626 case AF_SECURITY: |
4626 case AF_SECURITY: |
4627 domainSymbol = @symbol(AF_SECURITY); |
4627 domainSymbol = @symbol(AF_SECURITY); |
4628 break; |
4628 break; |
4629 #endif |
4629 #endif |
4630 #ifdef AF_KEY |
4630 #ifdef AF_KEY |
4631 case AF_KEY: |
4631 case AF_KEY: |
4632 domainSymbol = @symbol(AF_KEY); |
4632 domainSymbol = @symbol(AF_KEY); |
4633 break; |
4633 break; |
4634 #endif |
4634 #endif |
4635 #ifdef AF_NETLINK |
4635 #ifdef AF_NETLINK |
4636 case AF_NETLINK: |
4636 case AF_NETLINK: |
4637 domainSymbol = @symbol(AF_NETLINK); |
4637 domainSymbol = @symbol(AF_NETLINK); |
4638 break; |
4638 break; |
4639 #endif |
4639 #endif |
4640 #ifdef AF_PACKET |
4640 #ifdef AF_PACKET |
4641 case AF_PACKET: |
4641 case AF_PACKET: |
4642 domainSymbol = @symbol(AF_PACKET); |
4642 domainSymbol = @symbol(AF_PACKET); |
4643 break; |
4643 break; |
4644 #endif |
4644 #endif |
4645 #ifdef AF_ASH |
4645 #ifdef AF_ASH |
4646 case AF_ASH: |
4646 case AF_ASH: |
4647 domainSymbol = @symbol(AF_ASH); |
4647 domainSymbol = @symbol(AF_ASH); |
4648 break; |
4648 break; |
4649 #endif |
4649 #endif |
4650 #ifdef AF_ECONET |
4650 #ifdef AF_ECONET |
4651 case AF_ECONET: |
4651 case AF_ECONET: |
4652 domainSymbol = @symbol(AF_ECONET); |
4652 domainSymbol = @symbol(AF_ECONET); |
4653 break; |
4653 break; |
4654 #endif |
4654 #endif |
4655 #ifdef AF_IMPLINK |
4655 #ifdef AF_IMPLINK |
4656 case AF_IMPLINK: |
4656 case AF_IMPLINK: |
4657 domainSymbol = @symbol(AF_IMPLINK); |
4657 domainSymbol = @symbol(AF_IMPLINK); |
4658 break; |
4658 break; |
4659 #endif |
4659 #endif |
4660 #ifdef AF_PUP |
4660 #ifdef AF_PUP |
4661 case AF_PUP: |
4661 case AF_PUP: |
4662 domainSymbol = @symbol(AF_PUP); |
4662 domainSymbol = @symbol(AF_PUP); |
4663 break; |
4663 break; |
4664 #endif |
4664 #endif |
4665 #ifdef AF_CHAOS |
4665 #ifdef AF_CHAOS |
4666 case AF_CHAOS: |
4666 case AF_CHAOS: |
4667 domainSymbol = @symbol(AF_CHAOS); |
4667 domainSymbol = @symbol(AF_CHAOS); |
4668 break; |
4668 break; |
4669 #endif |
4669 #endif |
4670 #ifdef AF_DLI |
4670 #ifdef AF_DLI |
4671 case AF_DLI: |
4671 case AF_DLI: |
4672 domainSymbol = @symbol(AF_DLI); |
4672 domainSymbol = @symbol(AF_DLI); |
4673 break; |
4673 break; |
4674 #endif |
4674 #endif |
4675 #ifdef AF_LAT |
4675 #ifdef AF_LAT |
4676 case AF_LAT: |
4676 case AF_LAT: |
4677 domainSymbol = @symbol(AF_LAT); |
4677 domainSymbol = @symbol(AF_LAT); |
4678 break; |
4678 break; |
4679 #endif |
4679 #endif |
4680 #ifdef AF_HYLINK |
4680 #ifdef AF_HYLINK |
4681 case AF_HYLINK: |
4681 case AF_HYLINK: |
4682 domainSymbol = @symbol(AF_HYLINK); |
4682 domainSymbol = @symbol(AF_HYLINK); |
4683 break; |
4683 break; |
4684 #endif |
4684 #endif |
4685 #ifdef AF_FIREFOX |
4685 #ifdef AF_FIREFOX |
4686 case AF_FIREFOX: |
4686 case AF_FIREFOX: |
4687 domainSymbol = @symbol(AF_FIREFOX); |
4687 domainSymbol = @symbol(AF_FIREFOX); |
4688 break; |
4688 break; |
4689 #endif |
4689 #endif |
4690 #ifdef AF_CLUSTER |
4690 #ifdef AF_CLUSTER |
4691 case AF_CLUSTER: |
4691 case AF_CLUSTER: |
4692 domainSymbol = @symbol(AF_CLUSTER); |
4692 domainSymbol = @symbol(AF_CLUSTER); |
4693 break; |
4693 break; |
4694 #endif |
4694 #endif |
4695 #ifdef AF_12844 |
4695 #ifdef AF_12844 |
4696 case AF_12844: |
4696 case AF_12844: |
4697 domainSymbol = @symbol(AF_12844); |
4697 domainSymbol = @symbol(AF_12844); |
4698 break; |
4698 break; |
4699 #endif |
4699 #endif |
4700 #ifdef AF_NETDES |
4700 #ifdef AF_NETDES |
4701 case AF_NETDES: |
4701 case AF_NETDES: |
4702 domainSymbol = @symbol(AF_NETDES); |
4702 domainSymbol = @symbol(AF_NETDES); |
4703 break; |
4703 break; |
4704 #endif |
4704 #endif |
4705 } |
4705 } |
4706 } |
4706 } |
4707 %}. |
4707 %}. |
4708 |
4708 |
4709 ^ domainSymbol. |
4709 ^ domainSymbol. |
4710 |
4710 |
4727 |protocolCode| |
4727 |protocolCode| |
4728 |
4728 |
4729 %{ /*NOCONTEXT*/ |
4729 %{ /*NOCONTEXT*/ |
4730 |
4730 |
4731 if (__isSmallInteger(aSymbolOrInteger) || aSymbolOrInteger == nil) { |
4731 if (__isSmallInteger(aSymbolOrInteger) || aSymbolOrInteger == nil) { |
4732 RETURN (aSymbolOrInteger); |
4732 RETURN (aSymbolOrInteger); |
4733 } |
4733 } |
4734 |
4734 |
4735 #ifdef IPPROTO_IP |
4735 #ifdef IPPROTO_IP |
4736 else if ((aSymbolOrInteger == @symbol(IPPROTO_IP)) || (aSymbolOrInteger == @symbol(ip))) |
4736 else if ((aSymbolOrInteger == @symbol(IPPROTO_IP)) || (aSymbolOrInteger == @symbol(ip))) |
4737 protocolCode = __mkSmallInteger(IPPROTO_IP); |
4737 protocolCode = __mkSmallInteger(IPPROTO_IP); |
4789 |protocolSymbol| |
4789 |protocolSymbol| |
4790 |
4790 |
4791 %{ /*NOCONTEXT*/ |
4791 %{ /*NOCONTEXT*/ |
4792 |
4792 |
4793 if (__isSmallInteger(anInteger)) { |
4793 if (__isSmallInteger(anInteger)) { |
4794 switch(__intVal(anInteger)) { |
4794 switch(__intVal(anInteger)) { |
4795 #ifdef IPPROTO_IP |
4795 #ifdef IPPROTO_IP |
4796 case IPPROTO_IP: |
4796 case IPPROTO_IP: |
4797 // protocolSymbol = @symbol(IPPROTO_IP); |
4797 // protocolSymbol = @symbol(IPPROTO_IP); |
4798 protocolSymbol = @symbol(ip); |
4798 protocolSymbol = @symbol(ip); |
4799 break; |
4799 break; |
4800 #endif |
4800 #endif |
4801 #ifdef IPPROTO_ICMP |
4801 #ifdef IPPROTO_ICMP |
4802 case IPPROTO_ICMP: |
4802 case IPPROTO_ICMP: |
4803 // protocolSymbol = @symbol(IPPROTO_ICMP); |
4803 // protocolSymbol = @symbol(IPPROTO_ICMP); |
4804 protocolSymbol = @symbol(icmp); |
4804 protocolSymbol = @symbol(icmp); |
4805 break; |
4805 break; |
4806 #endif |
4806 #endif |
4807 #ifdef IPPROTO_IGMP |
4807 #ifdef IPPROTO_IGMP |
4808 case IPPROTO_IGMP: |
4808 case IPPROTO_IGMP: |
4809 // protocolSymbol = @symbol(IPPROTO_IGMP); |
4809 // protocolSymbol = @symbol(IPPROTO_IGMP); |
4810 protocolSymbol = @symbol(igmp); |
4810 protocolSymbol = @symbol(igmp); |
4811 break; |
4811 break; |
4812 #endif |
4812 #endif |
4813 #ifdef IPPROTO_GGP |
4813 #ifdef IPPROTO_GGP |
4814 case IPPROTO_GGP: |
4814 case IPPROTO_GGP: |
4815 // protocolSymbol = @symbol(IPPROTO_GGP); |
4815 // protocolSymbol = @symbol(IPPROTO_GGP); |
4816 protocolSymbol = @symbol(ggp); |
4816 protocolSymbol = @symbol(ggp); |
4817 break; |
4817 break; |
4818 #endif |
4818 #endif |
4819 #ifdef IPPROTO_TCP |
4819 #ifdef IPPROTO_TCP |
4820 case IPPROTO_TCP: |
4820 case IPPROTO_TCP: |
4821 // protocolSymbol = @symbol(IPPROTO_TCP); |
4821 // protocolSymbol = @symbol(IPPROTO_TCP); |
4822 protocolSymbol = @symbol(tcp); |
4822 protocolSymbol = @symbol(tcp); |
4823 break; |
4823 break; |
4824 #endif |
4824 #endif |
4825 #ifdef IPPROTO_PUP |
4825 #ifdef IPPROTO_PUP |
4826 case IPPROTO_PUP: |
4826 case IPPROTO_PUP: |
4827 // protocolSymbol = @symbol(IPPROTO_PUP); |
4827 // protocolSymbol = @symbol(IPPROTO_PUP); |
4828 protocolSymbol = @symbol(pup); |
4828 protocolSymbol = @symbol(pup); |
4829 break; |
4829 break; |
4830 #endif |
4830 #endif |
4831 #ifdef IPPROTO_UDP |
4831 #ifdef IPPROTO_UDP |
4832 case IPPROTO_UDP: |
4832 case IPPROTO_UDP: |
4833 // protocolSymbol = @symbol(IPPROTO_UDP); |
4833 // protocolSymbol = @symbol(IPPROTO_UDP); |
4834 protocolSymbol = @symbol(udp); |
4834 protocolSymbol = @symbol(udp); |
4835 break; |
4835 break; |
4836 #endif |
4836 #endif |
4837 #ifdef IPPROTO_IDP |
4837 #ifdef IPPROTO_IDP |
4838 case IPPROTO_IDP: |
4838 case IPPROTO_IDP: |
4839 // protocolSymbol = @symbol(IPPROTO_IDP); |
4839 // protocolSymbol = @symbol(IPPROTO_IDP); |
4840 protocolSymbol = @symbol(idp); |
4840 protocolSymbol = @symbol(idp); |
4841 break; |
4841 break; |
4842 #endif |
4842 #endif |
4843 #ifdef IPPROTO_ND |
4843 #ifdef IPPROTO_ND |
4844 case IPPROTO_ND: |
4844 case IPPROTO_ND: |
4845 // protocolSymbol = @symbol(IPPROTO_ND); |
4845 // protocolSymbol = @symbol(IPPROTO_ND); |
4846 protocolSymbol = @symbol(nd); |
4846 protocolSymbol = @symbol(nd); |
4847 break; |
4847 break; |
4848 #endif |
4848 #endif |
4849 #ifdef IPPROTO_RAW |
4849 #ifdef IPPROTO_RAW |
4850 case IPPROTO_RAW: |
4850 case IPPROTO_RAW: |
4851 // protocolSymbol = @symbol(IPPROTO_RAW); |
4851 // protocolSymbol = @symbol(IPPROTO_RAW); |
4852 protocolSymbol = @symbol(raw); |
4852 protocolSymbol = @symbol(raw); |
4853 break; |
4853 break; |
4854 #endif |
4854 #endif |
4855 } |
4855 } |
4856 } |
4856 } |
4857 %}. |
4857 %}. |
4858 |
4858 |
4859 ^ protocolSymbol. |
4859 ^ protocolSymbol. |
4860 |
4860 |
4873 |
4873 |
4874 domainCode := OperatingSystem domainCodeOf:aSymbolOrInteger. |
4874 domainCode := OperatingSystem domainCodeOf:aSymbolOrInteger. |
4875 |
4875 |
4876 %{ |
4876 %{ |
4877 if (__isSmallInteger(domainCode)) { |
4877 if (__isSmallInteger(domainCode)) { |
4878 switch (__intVal(domainCode)) { |
4878 switch (__intVal(domainCode)) { |
4879 #ifdef AF_INET |
4879 #ifdef AF_INET |
4880 case AF_INET: |
4880 case AF_INET: |
4881 socketSize = __mkSmallInteger( sizeof(struct sockaddr_in) ); |
4881 socketSize = __mkSmallInteger( sizeof(struct sockaddr_in) ); |
4882 break; |
4882 break; |
4883 #endif |
4883 #endif |
4884 #ifdef AF_INET6 |
4884 #ifdef AF_INET6 |
4885 case AF_INET6: |
4885 case AF_INET6: |
4886 socketSize = __mkSmallInteger( sizeof(struct sockaddr_in6) ); |
4886 socketSize = __mkSmallInteger( sizeof(struct sockaddr_in6) ); |
4887 break; |
4887 break; |
4888 #endif |
4888 #endif |
4889 #ifdef AF_UNIX |
4889 #ifdef AF_UNIX |
4890 case AF_UNIX: |
4890 case AF_UNIX: |
4891 socketSize = __mkSmallInteger( sizeof(struct sockaddr_un) ); |
4891 socketSize = __mkSmallInteger( sizeof(struct sockaddr_un) ); |
4892 break; |
4892 break; |
4893 #endif |
4893 #endif |
4894 #ifdef AF_APPLETALK |
4894 #ifdef AF_APPLETALK |
4895 case AF_APPLETALK: |
4895 case AF_APPLETALK: |
4896 socketSize = __mkSmallInteger( sizeof(struct sockaddr_at) ); |
4896 socketSize = __mkSmallInteger( sizeof(struct sockaddr_at) ); |
4897 break; |
4897 break; |
4898 #endif |
4898 #endif |
4899 #ifdef AF_DECnet |
4899 #ifdef AF_DECnet |
4900 case AF_DECnet: |
4900 case AF_DECnet: |
4901 socketSize = __mkSmallInteger( sizeof(struct sockaddr_dn) ); |
4901 socketSize = __mkSmallInteger( sizeof(struct sockaddr_dn) ); |
4902 break; |
4902 break; |
4903 #endif |
4903 #endif |
4904 #ifdef AF_NS |
4904 #ifdef AF_NS |
4905 case AF_NS: |
4905 case AF_NS: |
4906 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ns) ); |
4906 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ns) ); |
4907 break; |
4907 break; |
4908 #endif |
4908 #endif |
4909 #ifdef AF_X25 |
4909 #ifdef AF_X25 |
4910 case AF_X25: |
4910 case AF_X25: |
4911 socketSize = __mkSmallInteger( sizeof(struct sockaddr_x25) ); |
4911 socketSize = __mkSmallInteger( sizeof(struct sockaddr_x25) ); |
4912 break; |
4912 break; |
4913 #endif |
4913 #endif |
4914 #ifdef AF_SNA |
4914 #ifdef AF_SNA |
4915 case AF_SNA: |
4915 case AF_SNA: |
4916 socketSize = __mkSmallInteger( sizeof(struct sockaddr_sna) ); |
4916 socketSize = __mkSmallInteger( sizeof(struct sockaddr_sna) ); |
4917 break; |
4917 break; |
4918 #endif |
4918 #endif |
4919 #ifdef AF_RAW |
4919 #ifdef AF_RAW |
4920 case AF_RAW: |
4920 case AF_RAW: |
4921 socketSize = __mkSmallInteger( sizeof(struct sockaddr_raw) ); |
4921 socketSize = __mkSmallInteger( sizeof(struct sockaddr_raw) ); |
4922 break; |
4922 break; |
4923 #endif |
4923 #endif |
4924 #ifdef AF_ISO |
4924 #ifdef AF_ISO |
4925 case AF_ISO: |
4925 case AF_ISO: |
4926 socketSize = __mkSmallInteger( sizeof(struct sockaddr_iso) ); |
4926 socketSize = __mkSmallInteger( sizeof(struct sockaddr_iso) ); |
4927 break; |
4927 break; |
4928 #endif |
4928 #endif |
4929 #ifdef AF_ECMA |
4929 #ifdef AF_ECMA |
4930 # if 0 |
4930 # if 0 |
4931 case AF_ECMA: |
4931 case AF_ECMA: |
4932 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ecma) ); |
4932 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ecma) ); |
4933 break; |
4933 break; |
4934 # endif |
4934 # endif |
4935 #endif |
4935 #endif |
4936 #ifdef AF_NETBIOS |
4936 #ifdef AF_NETBIOS |
4937 case AF_NETBIOS: |
4937 case AF_NETBIOS: |
4938 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netbios) ); |
4938 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netbios) ); |
4939 break; |
4939 break; |
4940 #endif |
4940 #endif |
4941 #ifdef AF_NETBEUI |
4941 #ifdef AF_NETBEUI |
4942 case AF_NETBEUI: |
4942 case AF_NETBEUI: |
4943 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netbeui) ); |
4943 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netbeui) ); |
4944 break; |
4944 break; |
4945 #endif |
4945 #endif |
4946 #ifdef AF_IPX |
4946 #ifdef AF_IPX |
4947 case AF_IPX: |
4947 case AF_IPX: |
4948 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ipx) ); |
4948 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ipx) ); |
4949 break; |
4949 break; |
4950 #endif |
4950 #endif |
4951 #ifdef AF_AX25 |
4951 #ifdef AF_AX25 |
4952 case AF_AX25: |
4952 case AF_AX25: |
4953 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ax25) ); |
4953 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ax25) ); |
4954 break; |
4954 break; |
4955 #endif |
4955 #endif |
4956 #ifdef AF_NETROM |
4956 #ifdef AF_NETROM |
4957 case AF_NETROM: |
4957 case AF_NETROM: |
4958 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netrom) ); |
4958 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netrom) ); |
4959 break; |
4959 break; |
4960 #endif |
4960 #endif |
4961 #ifdef AF_BRIDGE |
4961 #ifdef AF_BRIDGE |
4962 case AF_BRIDGE: |
4962 case AF_BRIDGE: |
4963 socketSize = __mkSmallInteger( sizeof(struct sockaddr_bridge) ); |
4963 socketSize = __mkSmallInteger( sizeof(struct sockaddr_bridge) ); |
4964 break; |
4964 break; |
4965 #endif |
4965 #endif |
4966 #ifdef AF_BSC |
4966 #ifdef AF_BSC |
4967 case AF_BSC: |
4967 case AF_BSC: |
4968 socketSize = __mkSmallInteger( sizeof(struct sockaddr_bsc) ); |
4968 socketSize = __mkSmallInteger( sizeof(struct sockaddr_bsc) ); |
4969 break; |
4969 break; |
4970 #endif |
4970 #endif |
4971 #ifdef AF_ROSE |
4971 #ifdef AF_ROSE |
4972 case AF_ROSE: |
4972 case AF_ROSE: |
4973 socketSize = __mkSmallInteger( sizeof(struct sockaddr_rose) ); |
4973 socketSize = __mkSmallInteger( sizeof(struct sockaddr_rose) ); |
4974 break; |
4974 break; |
4975 #endif |
4975 #endif |
4976 #ifdef AF_IRDA |
4976 #ifdef AF_IRDA |
4977 case AF_IRDA: |
4977 case AF_IRDA: |
4978 socketSize = __mkSmallInteger( sizeof(struct sockaddr_irda) ); |
4978 socketSize = __mkSmallInteger( sizeof(struct sockaddr_irda) ); |
4979 break; |
4979 break; |
4980 #endif |
4980 #endif |
4981 #ifdef AF_BAN |
4981 #ifdef AF_BAN |
4982 case AF_BAN: |
4982 case AF_BAN: |
4983 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ban) ); |
4983 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ban) ); |
4984 break; |
4984 break; |
4985 #endif |
4985 #endif |
4986 #ifdef AF_VOICEVIEW |
4986 #ifdef AF_VOICEVIEW |
4987 case AF_VOICEVIEW: |
4987 case AF_VOICEVIEW: |
4988 socketSize = __mkSmallInteger( sizeof(struct sockaddr_voiceview) ); |
4988 socketSize = __mkSmallInteger( sizeof(struct sockaddr_voiceview) ); |
4989 break; |
4989 break; |
4990 #endif |
4990 #endif |
4991 #ifdef AF_ATM |
4991 #ifdef AF_ATM |
4992 case AF_ATM: |
4992 case AF_ATM: |
4993 socketSize = __mkSmallInteger( sizeof(struct sockaddr_atm) ); |
4993 socketSize = __mkSmallInteger( sizeof(struct sockaddr_atm) ); |
4994 break; |
4994 break; |
4995 #endif |
4995 #endif |
4996 #ifdef AF_ATMPVC |
4996 #ifdef AF_ATMPVC |
4997 case AF_ATMPVC: |
4997 case AF_ATMPVC: |
4998 socketSize = __mkSmallInteger( sizeof(struct sockaddr_atmpvc) ); |
4998 socketSize = __mkSmallInteger( sizeof(struct sockaddr_atmpvc) ); |
4999 break; |
4999 break; |
5000 #endif |
5000 #endif |
5001 #ifdef AF_ATMSVC |
5001 #ifdef AF_ATMSVC |
5002 case AF_ATMSVC: |
5002 case AF_ATMSVC: |
5003 socketSize = __mkSmallInteger( sizeof(struct sockaddr_atmsvc) ); |
5003 socketSize = __mkSmallInteger( sizeof(struct sockaddr_atmsvc) ); |
5004 break; |
5004 break; |
5005 #endif |
5005 #endif |
5006 #ifdef AF_NETLINK |
5006 #ifdef AF_NETLINK |
5007 case AF_NETLINK: |
5007 case AF_NETLINK: |
5008 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netlink) ); |
5008 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netlink) ); |
5009 break; |
5009 break; |
5010 #endif |
5010 #endif |
5011 #ifdef AF_PACKET |
5011 #ifdef AF_PACKET |
5012 case AF_PACKET: |
5012 case AF_PACKET: |
5013 socketSize = __mkSmallInteger( sizeof(struct sockaddr_packet) ); |
5013 socketSize = __mkSmallInteger( sizeof(struct sockaddr_packet) ); |
5014 break; |
5014 break; |
5015 #endif |
5015 #endif |
5016 #ifdef AF_ASH |
5016 #ifdef AF_ASH |
5017 case AF_ASH: |
5017 case AF_ASH: |
5018 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ash) ); |
5018 socketSize = __mkSmallInteger( sizeof(struct sockaddr_ash) ); |
5019 break; |
5019 break; |
5020 #endif |
5020 #endif |
5021 #ifdef AF_ECONET |
5021 #ifdef AF_ECONET |
5022 case AF_ECONET: |
5022 case AF_ECONET: |
5023 socketSize = __mkSmallInteger( sizeof(struct sockaddr_eco) ); |
5023 socketSize = __mkSmallInteger( sizeof(struct sockaddr_eco) ); |
5024 break; |
5024 break; |
5025 #endif |
5025 #endif |
5026 #ifdef AF_IMPLINK |
5026 #ifdef AF_IMPLINK |
5027 case AF_IMPLINK: |
5027 case AF_IMPLINK: |
5028 socketSize = __mkSmallInteger( sizeof(struct sockaddr_implink) ); |
5028 socketSize = __mkSmallInteger( sizeof(struct sockaddr_implink) ); |
5029 break; |
5029 break; |
5030 #endif |
5030 #endif |
5031 #ifdef AF_PUP |
5031 #ifdef AF_PUP |
5032 # if 0 |
5032 # if 0 |
5033 case AF_PUP: |
5033 case AF_PUP: |
5034 socketSize = __mkSmallInteger( sizeof(struct sockaddr_pup) ); |
5034 socketSize = __mkSmallInteger( sizeof(struct sockaddr_pup) ); |
5035 break; |
5035 break; |
5036 # endif |
5036 # endif |
5037 #endif |
5037 #endif |
5038 #ifdef AF_CHAOS |
5038 #ifdef AF_CHAOS |
5039 case AF_CHAOS: |
5039 case AF_CHAOS: |
5040 socketSize = __mkSmallInteger( sizeof(struct sockaddr_chaos) ); |
5040 socketSize = __mkSmallInteger( sizeof(struct sockaddr_chaos) ); |
5041 break; |
5041 break; |
5042 #endif |
5042 #endif |
5043 #ifdef AF_DLI |
5043 #ifdef AF_DLI |
5044 case AF_DLI: |
5044 case AF_DLI: |
5045 socketSize = __mkSmallInteger( sizeof(struct sockaddr_dli) ); |
5045 socketSize = __mkSmallInteger( sizeof(struct sockaddr_dli) ); |
5046 break; |
5046 break; |
5047 #endif |
5047 #endif |
5048 #ifdef AF_LAT |
5048 #ifdef AF_LAT |
5049 case AF_LAT: |
5049 case AF_LAT: |
5050 socketSize = __mkSmallInteger( sizeof(struct sockaddr_lat) ); |
5050 socketSize = __mkSmallInteger( sizeof(struct sockaddr_lat) ); |
5051 break; |
5051 break; |
5052 #endif |
5052 #endif |
5053 #ifdef AF_HYLINK |
5053 #ifdef AF_HYLINK |
5054 case AF_HYLINK: |
5054 case AF_HYLINK: |
5055 socketSize = __mkSmallInteger( sizeof(struct sockaddr_hylink) ); |
5055 socketSize = __mkSmallInteger( sizeof(struct sockaddr_hylink) ); |
5056 break; |
5056 break; |
5057 #endif |
5057 #endif |
5058 #ifdef AF_FIREFOX |
5058 #ifdef AF_FIREFOX |
5059 case AF_FIREFOX: |
5059 case AF_FIREFOX: |
5060 socketSize = __mkSmallInteger( sizeof(struct sockaddr_firefox) ); |
5060 socketSize = __mkSmallInteger( sizeof(struct sockaddr_firefox) ); |
5061 break; |
5061 break; |
5062 #endif |
5062 #endif |
5063 #ifdef AF_CLUSTER |
5063 #ifdef AF_CLUSTER |
5064 case AF_CLUSTER: |
5064 case AF_CLUSTER: |
5065 socketSize = __mkSmallInteger( sizeof(struct sockaddr_cluster) ); |
5065 socketSize = __mkSmallInteger( sizeof(struct sockaddr_cluster) ); |
5066 break; |
5066 break; |
5067 #endif |
5067 #endif |
5068 #ifdef AF_12844 |
5068 #ifdef AF_12844 |
5069 case AF_12844: |
5069 case AF_12844: |
5070 socketSize = __mkSmallInteger( sizeof(struct sockaddr_12844) ); |
5070 socketSize = __mkSmallInteger( sizeof(struct sockaddr_12844) ); |
5071 break; |
5071 break; |
5072 #endif |
5072 #endif |
5073 #ifdef AF_NETDES |
5073 #ifdef AF_NETDES |
5074 case AF_NETDES: |
5074 case AF_NETDES: |
5075 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netdes) ); |
5075 socketSize = __mkSmallInteger( sizeof(struct sockaddr_netdes) ); |
5076 break; |
5076 break; |
5077 #endif |
5077 #endif |
5078 } |
5078 } |
5079 } |
5079 } |
5080 %}. |
5080 %}. |
5081 ^ socketSize |
5081 ^ socketSize |
5082 |
5082 |
5083 " |
5083 " |
5094 |typeCode| |
5094 |typeCode| |
5095 |
5095 |
5096 %{ /*NOCONTEXT*/ |
5096 %{ /*NOCONTEXT*/ |
5097 |
5097 |
5098 if (__isSmallInteger(aSymbolOrInteger) || aSymbolOrInteger == nil) { |
5098 if (__isSmallInteger(aSymbolOrInteger) || aSymbolOrInteger == nil) { |
5099 typeCode = aSymbolOrInteger; |
5099 typeCode = aSymbolOrInteger; |
5100 } |
5100 } |
5101 |
5101 |
5102 #ifdef SOCK_STREAM |
5102 #ifdef SOCK_STREAM |
5103 else if ((aSymbolOrInteger == @symbol(stream)) || (aSymbolOrInteger == @symbol(SOCK_STREAM))) |
5103 else if ((aSymbolOrInteger == @symbol(stream)) || (aSymbolOrInteger == @symbol(SOCK_STREAM))) |
5104 typeCode = __mkSmallInteger(SOCK_STREAM); |
5104 typeCode = __mkSmallInteger(SOCK_STREAM); |
5105 #endif |
5105 #endif |
5106 #ifdef SOCK_DGRAM |
5106 #ifdef SOCK_DGRAM |
5107 else if ((aSymbolOrInteger == @symbol(datagram)) || (aSymbolOrInteger == @symbol(SOCK_DGRAM))) |
5107 else if ((aSymbolOrInteger == @symbol(datagram)) || (aSymbolOrInteger == @symbol(SOCK_DGRAM))) |
5108 typeCode = __mkSmallInteger(SOCK_DGRAM); |
5108 typeCode = __mkSmallInteger(SOCK_DGRAM); |
5109 #endif |
5109 #endif |
5110 #ifdef SOCK_RAW |
5110 #ifdef SOCK_RAW |
5111 else if ((aSymbolOrInteger == @symbol(raw)) || (aSymbolOrInteger == @symbol(SOCK_RAW))) |
5111 else if ((aSymbolOrInteger == @symbol(raw)) || (aSymbolOrInteger == @symbol(SOCK_RAW))) |
5112 typeCode = __mkSmallInteger(SOCK_RAW); |
5112 typeCode = __mkSmallInteger(SOCK_RAW); |
5113 #endif |
5113 #endif |
5114 #ifdef SOCK_RDM |
5114 #ifdef SOCK_RDM |
5115 else if ((aSymbolOrInteger == @symbol(rdm)) || (aSymbolOrInteger == @symbol(SOCK_RDM))) |
5115 else if ((aSymbolOrInteger == @symbol(rdm)) || (aSymbolOrInteger == @symbol(SOCK_RDM))) |
5116 typeCode = __mkSmallInteger(SOCK_RDM); |
5116 typeCode = __mkSmallInteger(SOCK_RDM); |
5117 #endif |
5117 #endif |
5118 #ifdef SOCK_SEQPACKET |
5118 #ifdef SOCK_SEQPACKET |
5119 else if ((aSymbolOrInteger == @symbol(seqpacket)) || (aSymbolOrInteger == @symbol(SOCK_SEQPACKET))) |
5119 else if ((aSymbolOrInteger == @symbol(seqpacket)) || (aSymbolOrInteger == @symbol(SOCK_SEQPACKET))) |
5120 typeCode = __mkSmallInteger(SOCK_SEQPACKET); |
5120 typeCode = __mkSmallInteger(SOCK_SEQPACKET); |
5121 #endif |
5121 #endif |
5122 #ifdef SOCK_PACKET |
5122 #ifdef SOCK_PACKET |
5123 else if ((aSymbolOrInteger == @symbol(packet)) || (aSymbolOrInteger == @symbol(SOCK_PACKET))) |
5123 else if ((aSymbolOrInteger == @symbol(packet)) || (aSymbolOrInteger == @symbol(SOCK_PACKET))) |
5124 typeCode = __mkSmallInteger(SOCK_PACKET); |
5124 typeCode = __mkSmallInteger(SOCK_PACKET); |
5125 #endif |
5125 #endif |
5126 %}. |
5126 %}. |
5127 |
5127 |
5128 ^ typeCode. |
5128 ^ typeCode. |
5129 |
5129 |
5141 |socketTypeSymbol| |
5141 |socketTypeSymbol| |
5142 |
5142 |
5143 %{ /*NOCONTEXT*/ |
5143 %{ /*NOCONTEXT*/ |
5144 |
5144 |
5145 if (__isSmallInteger(anInteger)) { |
5145 if (__isSmallInteger(anInteger)) { |
5146 switch(__intVal(anInteger)) { |
5146 switch(__intVal(anInteger)) { |
5147 #ifdef SOCK_STREAM |
5147 #ifdef SOCK_STREAM |
5148 case SOCK_STREAM: |
5148 case SOCK_STREAM: |
5149 socketTypeSymbol = @symbol(SOCK_STREAM); |
5149 socketTypeSymbol = @symbol(SOCK_STREAM); |
5150 break; |
5150 break; |
5151 #endif |
5151 #endif |
5152 #ifdef SOCK_DGRAM |
5152 #ifdef SOCK_DGRAM |
5153 case SOCK_DGRAM: |
5153 case SOCK_DGRAM: |
5154 socketTypeSymbol = @symbol(SOCK_DGRAM); |
5154 socketTypeSymbol = @symbol(SOCK_DGRAM); |
5155 break; |
5155 break; |
5156 #endif |
5156 #endif |
5157 #ifdef SOCK_RAW |
5157 #ifdef SOCK_RAW |
5158 case SOCK_RAW: |
5158 case SOCK_RAW: |
5159 socketTypeSymbol = @symbol(SOCK_RAW); |
5159 socketTypeSymbol = @symbol(SOCK_RAW); |
5160 break; |
5160 break; |
5161 #endif |
5161 #endif |
5162 #ifdef SOCK_RDM |
5162 #ifdef SOCK_RDM |
5163 case SOCK_RDM: |
5163 case SOCK_RDM: |
5164 socketTypeSymbol = @symbol(SOCK_RDM); |
5164 socketTypeSymbol = @symbol(SOCK_RDM); |
5165 break; |
5165 break; |
5166 #endif |
5166 #endif |
5167 #ifdef SOCK_SEQPACKET |
5167 #ifdef SOCK_SEQPACKET |
5168 case SOCK_SEQPACKET: |
5168 case SOCK_SEQPACKET: |
5169 socketTypeSymbol = @symbol(SOCK_SEQPACKET); |
5169 socketTypeSymbol = @symbol(SOCK_SEQPACKET); |
5170 break; |
5170 break; |
5171 #endif |
5171 #endif |
5172 #ifdef SOCK_PACKET |
5172 #ifdef SOCK_PACKET |
5173 case SOCK_PACKET: |
5173 case SOCK_PACKET: |
5174 socketTypeSymbol = @symbol(SOCK_PACKET); |
5174 socketTypeSymbol = @symbol(SOCK_PACKET); |
5175 break; |
5175 break; |
5176 #endif |
5176 #endif |
5177 } |
5177 } |
5178 } |
5178 } |
5179 %}. |
5179 %}. |
5180 ^ socketTypeSymbol. |
5180 ^ socketTypeSymbol. |
5181 ! |
5181 ! |
5182 |
5182 |
5186 socket creation may still fail, if your system was built without it. |
5186 socket creation may still fail, if your system was built without it. |
5187 For backward compatibility, the returned list includes the old |
5187 For backward compatibility, the returned list includes the old |
5188 (non-AF-prefixed) symbols; these will vanish." |
5188 (non-AF-prefixed) symbols; these will vanish." |
5189 |
5189 |
5190 ^ #( |
5190 ^ #( |
5191 #AF_INET #inet |
5191 #AF_INET #inet |
5192 #AF_UNIX #unix |
5192 #AF_UNIX #unix |
5193 #AF_INET6 #inet6 |
5193 #AF_INET6 #inet6 |
5194 #AF_APPLETALK #appletalk |
5194 #AF_APPLETALK #appletalk |
5195 #AF_DECnet #decnet |
5195 #AF_DECnet #decnet |
5196 #AF_NS #ns |
5196 #AF_NS #ns |
5197 #AF_X25 #x25 |
5197 #AF_X25 #x25 |
5198 #AF_SNA |
5198 #AF_SNA |
5199 #AF_RAW |
5199 #AF_RAW |
5200 #AF_ISO |
5200 #AF_ISO |
5201 #AF_ECMA |
5201 #AF_ECMA |
5202 #AF_NETBIOS #netbios |
5202 #AF_NETBIOS #netbios |
5203 #AF_IPX |
5203 #AF_IPX |
5204 #AF_AX25 |
5204 #AF_AX25 |
5205 #AF_NETROM |
5205 #AF_NETROM |
5206 #AF_BRIDGE |
5206 #AF_BRIDGE |
5207 #AF_BSC |
5207 #AF_BSC |
5208 #AF_ROSE |
5208 #AF_ROSE |
5209 #AF_IRDA #irda |
5209 #AF_IRDA #irda |
5210 #AF_NETLINK |
5210 #AF_NETLINK |
5211 #AF_NETLINK |
5211 #AF_NETLINK |
5212 #AF_NETBEUI |
5212 #AF_NETBEUI |
5213 #AF_ATM |
5213 #AF_ATM |
5214 #AF_ATMPVC |
5214 #AF_ATMPVC |
5215 #AF_ATMSVC |
5215 #AF_ATMSVC |
5216 #AF_BAN |
5216 #AF_BAN |
5217 #AF_VOICEVIEW |
5217 #AF_VOICEVIEW |
5218 #AF_ECONET |
5218 #AF_ECONET |
5219 #AF_IMPLINK |
5219 #AF_IMPLINK |
5220 #AF_PUP |
5220 #AF_PUP |
5221 #AF_CHAOS |
5221 #AF_CHAOS |
5222 #AF_DLI |
5222 #AF_DLI |
5223 #AF_LAT |
5223 #AF_LAT |
5224 #AF_HYLINK |
5224 #AF_HYLINK |
5225 #AF_FIREFOX |
5225 #AF_FIREFOX |
5226 #AF_CLUSTER |
5226 #AF_CLUSTER |
5227 #AF_12844 |
5227 #AF_12844 |
5228 #AF_NETDES |
5228 #AF_NETDES |
5229 ) select:[:sym | (AbstractOperatingSystem domainCodeOf:sym) isNumber ] |
5229 ) select:[:sym | (AbstractOperatingSystem domainCodeOf:sym) isNumber ] |
5230 |
5230 |
5231 " |
5231 " |
5232 AbstractOperatingSystem supportedProtocolFamilies |
5232 AbstractOperatingSystem supportedProtocolFamilies |
5233 " |
5233 " |
5236 supportedSocketTypes |
5236 supportedSocketTypes |
5237 "return the symbolic typeName of a given numeric SOCK_xxx socket type code. |
5237 "return the symbolic typeName of a given numeric SOCK_xxx socket type code. |
5238 Return nil for invalid or unsupported socket types." |
5238 Return nil for invalid or unsupported socket types." |
5239 |
5239 |
5240 ^ #( |
5240 ^ #( |
5241 #SOCK_STREAM |
5241 #SOCK_STREAM |
5242 #SOCK_DGRAM |
5242 #SOCK_DGRAM |
5243 #SOCK_RAW |
5243 #SOCK_RAW |
5244 #SOCK_RDM |
5244 #SOCK_RDM |
5245 #SOCK_SEQPACKET |
5245 #SOCK_SEQPACKET |
5246 #SOCK_PACKET |
5246 #SOCK_PACKET |
5247 ) select:[:sym | (AbstractOperatingSystem socketTypeCodeOf:sym) isNumber ] |
5247 ) select:[:sym | (AbstractOperatingSystem socketTypeCodeOf:sym) isNumber ] |
5248 |
5248 |
5249 " |
5249 " |
5250 AbstractOperatingSystem supportedSocketTypes |
5250 AbstractOperatingSystem supportedSocketTypes |
5251 " |
5251 " |
5297 i := self computeTimeAndDateFrom:osTime. |
5297 i := self computeTimeAndDateFrom:osTime. |
5298 aBlock value:i year value:i month value:i day |
5298 aBlock value:i year value:i month value:i day |
5299 |
5299 |
5300 " |
5300 " |
5301 OperatingSystem computeDatePartsOf:0 for:[:y :m :d | |
5301 OperatingSystem computeDatePartsOf:0 for:[:y :m :d | |
5302 y printCR. m printCR. d printCR |
5302 y printCR. m printCR. d printCR |
5303 ] |
5303 ] |
5304 " |
5304 " |
5305 ! |
5305 ! |
5306 |
5306 |
5307 computeOSTimeFromUTCYear:y month:m day:d hour:h minute:min second:s millisecond:millis |
5307 computeOSTimeFromUTCYear:y month:m day:d hour:h minute:min second:s millisecond:millis |
5359 |
5359 |
5360 aBlock value:hours value:minutes value:seconds value:millis |
5360 aBlock value:hours value:minutes value:seconds value:millis |
5361 |
5361 |
5362 " |
5362 " |
5363 OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli | |
5363 OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli | |
5364 Transcript show:h; space; show:m; space; show:s; space; showCR:milli. |
5364 Transcript show:h; space; show:m; space; show:s; space; showCR:milli. |
5365 ] |
5365 ] |
5366 " |
5366 " |
5367 ! |
5367 ! |
5368 |
5368 |
5369 computeUTCTimeAndDateFrom:osTime |
5369 computeUTCTimeAndDateFrom:osTime |
5370 "given an OS-dependent time in osTime, return an Array |
5370 "given an OS-dependent time in osTime, return an Array |
5371 containing: |
5371 containing: |
5372 (full-) year, |
5372 (full-) year, |
5373 month, (1..) |
5373 month, (1..) |
5374 day, (1..) |
5374 day, (1..) |
5375 hour, (0..23) |
5375 hour, (0..23) |
5376 minute (0..59) |
5376 minute (0..59) |
5377 seconds, (0..59) |
5377 seconds, (0..59) |
5378 offset to UTC, (seconds) |
5378 offset to UTC, (seconds) |
5379 daylight savings time flag, |
5379 daylight savings time flag, |
5380 milliseconds, (0..999) |
5380 milliseconds, (0..999) |
5381 dayInYear (1..) |
5381 dayInYear (1..) |
5382 dayInWeek (1..). |
5382 dayInWeek (1..). |
5383 Conversion is to utc." |
5383 Conversion is to utc." |
5384 |
5384 |
5385 |divMod ret| |
5385 |divMod ret| |
5386 |
5386 |
5387 divMod := osTime divMod:1000. |
5387 divMod := osTime divMod:1000. |
5418 "get a CPU specific cycle counter value. |
5418 "get a CPU specific cycle counter value. |
5419 Can be used for exact timing & performance measurements. |
5419 Can be used for exact timing & performance measurements. |
5420 Notice, that the # of cycles has to be multiplied by the cycle time (1/cpu-frequency). |
5420 Notice, that the # of cycles has to be multiplied by the cycle time (1/cpu-frequency). |
5421 |
5421 |
5422 For x86: |
5422 For x86: |
5423 the CPU cycle count register value is returned (RDTSC instruction). |
5423 the CPU cycle count register value is returned (RDTSC instruction). |
5424 Fails if RDTSC instruction is not supported (which is unlikely, nowadays). |
5424 Fails if RDTSC instruction is not supported (which is unlikely, nowadays). |
5425 For others: |
5425 For others: |
5426 currently fails" |
5426 currently fails" |
5427 |
5427 |
5428 %{ /* NOCONTEXT */ |
5428 %{ /* NOCONTEXT */ |
5429 unsigned int low, high; |
5429 unsigned int low, high; |
5430 |
5430 |
5431 #ifdef i386 |
5431 #ifdef i386 |
5432 // use RDTSC instruction (retrieves 64bit cycle count; hi in EDX, lo in EAX) |
5432 // use RDTSC instruction (retrieves 64bit cycle count; hi in EDX, lo in EAX) |
5433 |
5433 |
5434 # if defined(__BORLANDC__) |
5434 # if defined(__BORLANDC__) |
5435 _asm { push edx }; |
5435 _asm { push edx }; |
5436 __emit__(0x0F,0x31); /* RDTSC instruction */ |
5436 __emit__(0x0F,0x31); /* RDTSC instruction */ |
5437 _asm { mov low,eax }; |
5437 _asm { mov low,eax }; |
5438 _asm { mov high,edx }; |
5438 _asm { mov high,edx }; |
5439 _asm { pop edx }; |
5439 _asm { pop edx }; |
5440 # elif defined(_MSC_VER) |
|
5441 _asm { push edx }; |
|
5442 _asm { _emit 0fh }; _asm { _emit 031h }; |
|
5443 _asm { mov low,eax }; |
|
5444 _asm { mov high,edx }; |
|
5445 _asm { pop edx }; |
|
5446 # elif defined(__MINGW_H) || defined(__GNUC__) |
5440 # elif defined(__MINGW_H) || defined(__GNUC__) |
5447 asm volatile("rdtsc" : "=a"(low), "=d"(high)); |
5441 asm volatile("rdtsc" : "=a"(low), "=d"(high)); |
5448 # else |
5442 # else |
5449 goto unsupported; |
5443 goto unsupported; |
5450 # endif |
5444 # endif |
5479 Since this value is wrapping around in regular intervals, this can only be used for |
5473 Since this value is wrapping around in regular intervals, this can only be used for |
5480 short relative time deltas. |
5474 short relative time deltas. |
5481 Use the millisecondTimeXXX:-methods to compare and add time deltas - these know about the wrap. |
5475 Use the millisecondTimeXXX:-methods to compare and add time deltas - these know about the wrap. |
5482 |
5476 |
5483 BAD DESIGN: |
5477 BAD DESIGN: |
5484 This should be changed to return some instance of RelativeTime, |
5478 This should be changed to return some instance of RelativeTime, |
5485 and these computations moved there. |
5479 and these computations moved there. |
5486 |
5480 |
5487 Dont use this method in application code since it is an internal (private) |
5481 Dont use this method in application code since it is an internal (private) |
5488 interface. For compatibility with ST-80, use Time millisecondClockValue. |
5482 interface. For compatibility with ST-80, use Time millisecondClockValue. |
5489 " |
5483 " |
5490 |
5484 |
5525 |
5519 |
5526 now := self getMillisecondTime. |
5520 now := self getMillisecondTime. |
5527 then := self millisecondTimeAdd:now and:millis. |
5521 then := self millisecondTimeAdd:now and:millis. |
5528 |
5522 |
5529 [(delta := self millisecondTimeDeltaBetween:then and:now) > 0] whileTrue:[ |
5523 [(delta := self millisecondTimeDeltaBetween:then and:now) > 0] whileTrue:[ |
5530 self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta. |
5524 self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta. |
5531 now := self getMillisecondTime. |
5525 now := self getMillisecondTime. |
5532 ] |
5526 ] |
5533 |
5527 |
5534 " |
5528 " |
5535 OperatingSystem millisecondDelay:5000 |
5529 OperatingSystem millisecondDelay:5000 |
5536 " |
5530 " |
5542 (such as returned getMillisecondTime) which wrap at 16r1FFFFFFF. |
5536 (such as returned getMillisecondTime) which wrap at 16r1FFFFFFF. |
5543 |
5537 |
5544 This should really be moved to some RelativeTime class." |
5538 This should really be moved to some RelativeTime class." |
5545 |
5539 |
5546 (msTime1 > msTime2) ifTrue:[ |
5540 (msTime1 > msTime2) ifTrue:[ |
5547 ((msTime1 - msTime2) < 16r10000000) ifTrue:[ |
5541 ((msTime1 - msTime2) < 16r10000000) ifTrue:[ |
5548 ^ true |
5542 ^ true |
5549 ]. |
5543 ]. |
5550 ] ifFalse:[ |
5544 ] ifFalse:[ |
5551 ((msTime2 - msTime1) > 16r10000000) ifTrue:[ |
5545 ((msTime2 - msTime1) > 16r10000000) ifTrue:[ |
5552 ^ true |
5546 ^ true |
5553 ]. |
5547 ]. |
5554 ]. |
5548 ]. |
5555 ^ false |
5549 ^ false |
5556 ! |
5550 ! |
5557 |
5551 |
5558 millisecondTimeAdd:msTime1 and:msTime2 |
5552 millisecondTimeAdd:msTime1 and:msTime2 |
5563 |
5557 |
5564 |sum| |
5558 |sum| |
5565 |
5559 |
5566 sum := msTime1 + msTime2. |
5560 sum := msTime1 + msTime2. |
5567 (sum > 16r1FFFFFFF) ifTrue:[ |
5561 (sum > 16r1FFFFFFF) ifTrue:[ |
5568 self assert:(sum <= 16r3FFFFFFF) message:'overflow in timer computation'. |
5562 self assert:(sum <= 16r3FFFFFFF) message:'overflow in timer computation'. |
5569 ^ sum - 16r20000000. |
5563 ^ sum - 16r20000000. |
5570 ]. |
5564 ]. |
5571 (sum < 0) ifTrue:[^ sum + 16r20000000]. |
5565 (sum < 0) ifTrue:[^ sum + 16r20000000]. |
5572 ^ sum |
5566 ^ sum |
5573 ! |
5567 ! |
5574 |
5568 |
5584 |
5578 |
5585 |diff| |
5579 |diff| |
5586 |
5580 |
5587 diff := msTime1 - msTime2. |
5581 diff := msTime1 - msTime2. |
5588 diff > 16r-10000000 ifTrue:[ |
5582 diff > 16r-10000000 ifTrue:[ |
5589 (diff < 16r10000000) ifTrue:[ |
5583 (diff < 16r10000000) ifTrue:[ |
5590 ^ diff. |
5584 ^ diff. |
5591 ] ifFalse:[ |
5585 ] ifFalse:[ |
5592 ^ diff - 16r20000000. |
5586 ^ diff - 16r20000000. |
5593 ]. |
5587 ]. |
5594 ]. |
5588 ]. |
5595 ^ diff + 16r20000000 |
5589 ^ diff + 16r20000000 |
5596 |
5590 |
5597 |
5591 |
5598 " |
5592 " |
5673 "{ Pragma: +optSpace }" |
5667 "{ Pragma: +optSpace }" |
5674 |
5668 |
5675 ^ self getHomeDirectory asFilename constructString:('.',appName) |
5669 ^ self getHomeDirectory asFilename constructString:('.',appName) |
5676 |
5670 |
5677 " |
5671 " |
5678 OperatingSystem getApplicationDataDirectoryFor:'expecco' |
5672 OperatingSystem getApplicationDataDirectoryFor:'expecco' |
5679 " |
5673 " |
5680 |
5674 |
5681 "Created: / 29-07-2010 / 12:07:25 / sr" |
5675 "Created: / 29-07-2010 / 12:07:25 / sr" |
5682 ! |
5676 ! |
5683 |
5677 |
5688 The fallback here returns the users home directory." |
5682 The fallback here returns the users home directory." |
5689 |
5683 |
5690 ^ self getHomeDirectory |
5684 ^ self getHomeDirectory |
5691 |
5685 |
5692 " |
5686 " |
5693 OperatingSystem getDesktopDirectory |
5687 OperatingSystem getDesktopDirectory |
5694 " |
5688 " |
5695 |
5689 |
5696 "Created: / 16-05-2007 / 13:20:53 / cg" |
5690 "Created: / 16-05-2007 / 13:20:53 / cg" |
5697 ! |
5691 ! |
5698 |
5692 |
5704 "{ Pragma: +optSpace }" |
5698 "{ Pragma: +optSpace }" |
5705 |
5699 |
5706 ^ self getHomeDirectory |
5700 ^ self getHomeDirectory |
5707 |
5701 |
5708 " |
5702 " |
5709 OperatingSystem getDocumentsDirectory |
5703 OperatingSystem getDocumentsDirectory |
5710 " |
5704 " |
5711 ! |
5705 ! |
5712 |
5706 |
5713 getEffectiveGroupID |
5707 getEffectiveGroupID |
5714 "{ Pragma: +optSpace }" |
5708 "{ Pragma: +optSpace }" |
5836 This is the login name, not the fullName." |
5830 This is the login name, not the fullName." |
5837 |
5831 |
5838 "/ fallBack dummy |
5832 "/ fallBack dummy |
5839 |
5833 |
5840 aNumber == self getUserID ifTrue:[ |
5834 aNumber == self getUserID ifTrue:[ |
5841 ^ self getLoginName |
5835 ^ self getLoginName |
5842 ]. |
5836 ]. |
5843 |
5837 |
5844 ^ '? (' , aNumber printString , ')' |
5838 ^ '? (' , aNumber printString , ')' |
5845 |
5839 |
5846 " |
5840 " |
5923 ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0] |
5917 ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0] |
5924 ! |
5918 ! |
5925 |
5919 |
5926 readCheck:fd |
5920 readCheck:fd |
5927 "return true, if a read is possible without blocking. |
5921 "return true, if a read is possible without blocking. |
5928 This is the case if data is available on a filedescriptor |
5922 This is the case if data is available on a filedescriptor |
5929 or the read would return an error. |
5923 or the read would return an error. |
5930 This depends on a working select or FIONREAD to be provided by the OS." |
5924 This depends on a working select or FIONREAD to be provided by the OS." |
5931 |
5925 |
5932 |result| |
5926 |result| |
5933 |
5927 |
5934 self supportsSelect ifFalse:[ |
5928 self supportsSelect ifFalse:[ |
5935 "/ mhmh - what should we do then ? |
5929 "/ mhmh - what should we do then ? |
5936 "/ For now, return true as if data was present, |
5930 "/ For now, return true as if data was present, |
5937 "/ and let the thread fall into the read. |
5931 "/ and let the thread fall into the read. |
5938 "/ It will then (hopefully) be descheduled there and |
5932 "/ It will then (hopefully) be descheduled there and |
5939 "/ effectively polling for input. |
5933 "/ effectively polling for input. |
5940 |
5934 |
5941 ^ true |
5935 ^ true |
5942 ]. |
5936 ]. |
5943 |
5937 |
5944 result := self |
5938 result := self |
5945 selectOnAnyReadable:(Array with:fd) |
5939 selectOnAnyReadable:(Array with:fd) |
5946 writable:nil |
5940 writable:nil |
5947 exception:nil |
5941 exception:nil |
5948 withTimeOut:0. |
5942 withTimeOut:0. |
5949 |
5943 |
5950 "on select error, a read will immediately return, so answer true" |
5944 "on select error, a read will immediately return, so answer true" |
5951 ^ result == fd or:[result == #error]. |
5945 ^ result == fd or:[result == #error]. |
5952 ! |
5946 ! |
5953 |
5947 |
5954 readWriteCheck:fd |
5948 readWriteCheck:fd |
5955 "return true, if filedescriptor can be read or written without blocking. |
5949 "return true, if filedescriptor can be read or written without blocking. |
5956 This is the case if data is available on a filedescriptor |
5950 This is the case if data is available on a filedescriptor |
5957 or the read or write would return an error. |
5951 or the read or write would return an error. |
5958 This is actually only used with sockets, to wait for a connect to |
5952 This is actually only used with sockets, to wait for a connect to |
5959 be finished." |
5953 be finished." |
5960 |
5954 |
5961 |result| |
5955 |result| |
5962 |
5956 |
5963 self supportsSelect ifFalse:[ |
5957 self supportsSelect ifFalse:[ |
5964 "/ mhmh - what should we do then ? |
5958 "/ mhmh - what should we do then ? |
5965 "/ For now, return true as if data was present, |
5959 "/ For now, return true as if data was present, |
5966 "/ and let the thread fall into the write. |
5960 "/ and let the thread fall into the write. |
5967 "/ It will then (hopefully) be desceduled there and |
5961 "/ It will then (hopefully) be desceduled there and |
5968 "/ effectively polling for output. |
5962 "/ effectively polling for output. |
5969 ^ true |
5963 ^ true |
5970 ]. |
5964 ]. |
5971 |
5965 |
5972 result := self selectOnAnyReadable:(Array with:fd) |
5966 result := self selectOnAnyReadable:(Array with:fd) |
5973 writable:(Array with:fd) |
5967 writable:(Array with:fd) |
5974 exception:nil |
5968 exception:nil |
5975 withTimeOut:0. |
5969 withTimeOut:0. |
5976 |
5970 |
5977 ^ result == fd or:[result == #error]. |
5971 ^ result == fd or:[result == #error]. |
5978 ! |
5972 ! |
5979 |
5973 |
5980 selectOn:fd1 and:fd2 withTimeOut:millis |
5974 selectOn:fd1 and:fd2 withTimeOut:millis |
5981 <resource: #obsolete> |
5975 <resource: #obsolete> |
5982 "wait for any fd to become ready; timeout after t milliseconds. |
5976 "wait for any fd to become ready; timeout after t milliseconds. |
5983 A zero timeout-time will immediately return (i.e. poll). |
5977 A zero timeout-time will immediately return (i.e. poll). |
5984 Return fd if i/o ok, nil if timed-out or interrupted. |
5978 Return fd if i/o ok, nil if timed-out or interrupted. |
5985 Obsolete: |
5979 Obsolete: |
5986 This is a leftover method and will vanish." |
5980 This is a leftover method and will vanish." |
5987 |
5981 |
5988 ^ self selectOnAnyReadable:(Array with:fd1 with:fd2) |
5982 ^ self selectOnAnyReadable:(Array with:fd1 with:fd2) |
5989 writable:(Array with:fd1 with:fd2) |
5983 writable:(Array with:fd1 with:fd2) |
5990 exception:nil |
5984 exception:nil |
5991 withTimeOut:millis |
5985 withTimeOut:millis |
5992 ! |
5986 ! |
5993 |
5987 |
5994 selectOn:fd withTimeOut:millis |
5988 selectOn:fd withTimeOut:millis |
5995 "wait for aFileDesriptor to become ready; timeout after t milliseconds. |
5989 "wait for aFileDesriptor to become ready; timeout after t milliseconds. |
5996 Return true, if i/o ok, false if timed-out or interrupted. |
5990 Return true, if i/o ok, false if timed-out or interrupted. |
5997 With 0 as timeout argument, this can be used to check for availability |
5991 With 0 as timeout argument, this can be used to check for availability |
5998 of read-data. |
5992 of read-data. |
5999 Experimental." |
5993 Experimental." |
6000 |
5994 |
6001 ^ self selectOnAnyReadable:(Array with:fd) |
5995 ^ self selectOnAnyReadable:(Array with:fd) |
6002 writable:(Array with:fd) |
5996 writable:(Array with:fd) |
6003 exception:nil |
5997 exception:nil |
6004 withTimeOut:millis |
5998 withTimeOut:millis |
6005 ! |
5999 ! |
6006 |
6000 |
6007 selectOnAny:fdArray withTimeOut:millis |
6001 selectOnAny:fdArray withTimeOut:millis |
6008 "wait for any fd in fdArray (an Array of integers) to become ready; |
6002 "wait for any fd in fdArray (an Array of integers) to become ready; |
6009 timeout after t milliseconds. An empty set will always wait. |
6003 timeout after t milliseconds. An empty set will always wait. |
6010 Return first ready fd if i/o ok, nil if timed-out or interrupted. |
6004 Return first ready fd if i/o ok, nil if timed-out or interrupted. |
6011 Experimental." |
6005 Experimental." |
6012 |
6006 |
6013 ^ self selectOnAnyReadable:fdArray |
6007 ^ self selectOnAnyReadable:fdArray |
6014 writable:fdArray |
6008 writable:fdArray |
6015 exception:nil |
6009 exception:nil |
6016 withTimeOut:millis |
6010 withTimeOut:millis |
6017 ! |
6011 ! |
6018 |
6012 |
6019 selectOnAnyReadable:fdArray withTimeOut:millis |
6013 selectOnAnyReadable:fdArray withTimeOut:millis |
6020 "wait for any fd in fdArray (an Array of integers) to become ready for |
6014 "wait for any fd in fdArray (an Array of integers) to become ready for |
6021 reading. Timeout after t milliseconds. An empty set will always wait. |
6015 reading. Timeout after t milliseconds. An empty set will always wait. |
6022 A zero timeout-time will immediately return (i.e. poll). |
6016 A zero timeout-time will immediately return (i.e. poll). |
6023 Return first ready fd if i/o ok, nil if timed-out or interrupted. |
6017 Return first ready fd if i/o ok, nil if timed-out or interrupted. |
6024 Experimental." |
6018 Experimental." |
6025 |
6019 |
6026 ^ self selectOnAnyReadable:fdArray |
6020 ^ self selectOnAnyReadable:fdArray |
6027 writable:nil |
6021 writable:nil |
6028 exception:nil |
6022 exception:nil |
6029 withTimeOut:millis |
6023 withTimeOut:millis |
6030 ! |
6024 ! |
6031 |
6025 |
6032 selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray |
6026 selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray |
6033 readableInto:readableResultFdArray writableInto:writableResultFdArray |
6027 readableInto:readableResultFdArray writableInto:writableResultFdArray |
6034 exceptionInto:exceptionResultFdArray |
6028 exceptionInto:exceptionResultFdArray |
6035 withTimeOut:millis |
6029 withTimeOut:millis |
6036 |
6030 |
6037 "wait for any fd in readFdArray (an Array of integers) to become ready for reading, |
6031 "wait for any fd in readFdArray (an Array of integers) to become ready for reading, |
6038 writeFdArray to become ready for writing, |
6032 writeFdArray to become ready for writing, |
6039 or exceptFdArray to arrive exceptional data (i.e. out-of-band data). |
6033 or exceptFdArray to arrive exceptional data (i.e. out-of-band data). |
6040 Timeout after t milliseconds or - if the timeout time is 0 - immediately.. |
6034 Timeout after t milliseconds or - if the timeout time is 0 - immediately.. |
6075 self subclassResponsibility |
6069 self subclassResponsibility |
6076 ! |
6070 ! |
6077 |
6071 |
6078 writeCheck:fd |
6072 writeCheck:fd |
6079 "return true, if filedescriptor can be written without blocking. |
6073 "return true, if filedescriptor can be written without blocking. |
6080 This is the case if data can be written to a filedescriptor |
6074 This is the case if data can be written to a filedescriptor |
6081 or the write would return an error." |
6075 or the write would return an error." |
6082 |
6076 |
6083 |result| |
6077 |result| |
6084 |
6078 |
6085 self supportsSelect ifFalse:[ |
6079 self supportsSelect ifFalse:[ |
6086 "/ mhmh - what should we do then ? |
6080 "/ mhmh - what should we do then ? |
6087 "/ For now, return true as if data was present, |
6081 "/ For now, return true as if data was present, |
6088 "/ and let the thread fall into the write. |
6082 "/ and let the thread fall into the write. |
6089 "/ It will then (hopefully) be desceduled there and |
6083 "/ It will then (hopefully) be desceduled there and |
6090 "/ effectively polling for output. |
6084 "/ effectively polling for output. |
6091 ^ true |
6085 ^ true |
6092 ]. |
6086 ]. |
6093 |
6087 |
6094 result := self selectOnAnyReadable:nil |
6088 result := self selectOnAnyReadable:nil |
6095 writable:(Array with:fd) |
6089 writable:(Array with:fd) |
6096 exception:nil |
6090 exception:nil |
6097 withTimeOut:0. |
6091 withTimeOut:0. |
6098 |
6092 |
6099 ^ result == fd or:[result == #error]. |
6093 ^ result == fd or:[result == #error]. |
6100 ! ! |
6094 ! ! |
6101 |
6095 |
6102 !AbstractOperatingSystem::PrinterInfo class methodsFor:'constants'! |
6096 !AbstractOperatingSystem::PrinterInfo class methodsFor:'constants'! |
6149 ^ d. |
6143 ^ d. |
6150 |
6144 |
6151 "Created: / 31-07-2006 / 15:35:37 / fm" |
6145 "Created: / 31-07-2006 / 15:35:37 / fm" |
6152 ! |
6146 ! |
6153 |
6147 |
6154 paperSizeNumberToNameTable |
6148 paperSizeNumberToNameTable |
6155 |
6149 |
6156 ^Dictionary withKeysAndValues: |
6150 ^Dictionary withKeysAndValues: |
6157 #( |
6151 #( |
6158 'Letter, 8 1/2- by 11-inches' 1 "/ Letter |
6152 'Letter, 8 1/2- by 11-inches' 1 "/ Letter |
6159 'Legal 8 1/2- by 14-inches' 5 "/ Legal |
6153 'Legal 8 1/2- by 14-inches' 5 "/ Legal |
6160 '10- by 14-inch sheet' 16 "/ 10x14 |
6154 '10- by 14-inch sheet' 16 "/ 10x14 |
6161 '11- by 17-inch sheet' 17 "/ 11x17 |
6155 '11- by 17-inch sheet' 17 "/ 11x17 |
6162 "/ '12X11' "/ Windows 98/Me, Windows NT 4.0 and later: 12- by 11-inch sheet |
6156 "/ '12X11' "/ Windows 98/Me, Windows NT 4.0 and later: 12- by 11-inch sheet |
6163 'A3 sheet, 297- by 420-millimeters' 8 "/ A3 |
6157 'A3 sheet, 297- by 420-millimeters' 8 "/ A3 |
6164 'A3 rotated sheet, 420- by 297-millimeters' 67 "/ A3_rotated |
6158 'A3 rotated sheet, 420- by 297-millimeters' 67 "/ A3_rotated |
6165 'A4 sheet, 210- by 297-millimeters' 9 "/ A4 |
6159 'A4 sheet, 210- by 297-millimeters' 9 "/ A4 |
6166 'A4 rotated sheet, 297- by 210-millimeters' 55 "/ A4_rotated |
6160 'A4 rotated sheet, 297- by 210-millimeters' 55 "/ A4_rotated |
6167 'A4 small sheet, 210- by 297-millimeters' 10 "/ A4 small |
6161 'A4 small sheet, 210- by 297-millimeters' 10 "/ A4 small |
6168 'A5 sheet, 148- by 210-millimeters' 11 "/ A5 |
6162 'A5 sheet, 148- by 210-millimeters' 11 "/ A5 |
6169 'A5 rotated sheet, 210- by 148-millimeters' 61 "/ A5 rotated |
6163 'A5 rotated sheet, 210- by 148-millimeters' 61 "/ A5 rotated |
6170 "/ 'a6' "/ Windows 98/Me, Windows NT 4.0 and later: A6 sheet, 105- by 148-millimeters |
6164 "/ 'a6' "/ Windows 98/Me, Windows NT 4.0 and later: A6 sheet, 105- by 148-millimeters |
6171 "/ 'a6_rotated' "/ Windows 98/Me, Windows NT 4.0 and later: A6 rotated sheet, 148- by 105-millimeters |
6165 "/ 'a6_rotated' "/ Windows 98/Me, Windows NT 4.0 and later: A6 rotated sheet, 148- by 105-millimeters |
6172 'B4 sheet, 250- by 354-millimeters' 12 "/ B4 |
6166 'B4 sheet, 250- by 354-millimeters' 12 "/ B4 |
6173 "/ b4_jis_rotated Windows 98/Me, Windows NT 4.0 and later: B4 (JIS) rotated sheet, 364- by 257-millimeters |
6167 "/ b4_jis_rotated Windows 98/Me, Windows NT 4.0 and later: B4 (JIS) rotated sheet, 364- by 257-millimeters |
6174 'B5 sheet, 182- by 257-millimeter paper' 13 "/ B5 |
6168 'B5 sheet, 182- by 257-millimeter paper' 13 "/ B5 |
6175 "/ b5_jis_rotated Windows 98/Me, Windows NT 4.0 and later: B5 (JIS) rotated sheet, 257- by 182-millimeters |
6169 "/ b5_jis_rotated Windows 98/Me, Windows NT 4.0 and later: B5 (JIS) rotated sheet, 257- by 182-millimeters |
6176 "/ b6_jis Windows 98/Me, Windows NT 4.0 and later: B6 (JIS) sheet, 128- by 182-millimeters |
6170 "/ b6_jis Windows 98/Me, Windows NT 4.0 and later: B6 (JIS) sheet, 128- by 182-millimeters |
6177 "/ b6_jis_rotated Windows 98/Me, Windows NT 4.0 and later: B6 (JIS) rotated sheet, 182- by 128-millimeters |
6171 "/ b6_jis_rotated Windows 98/Me, Windows NT 4.0 and later: B6 (JIS) rotated sheet, 182- by 128-millimeters |
6178 "/ csheet C Sheet, 17- by 22-inches |
6172 "/ csheet C Sheet, 17- by 22-inches |
6179 "/ dbl_japanese_postcard Windows 98/Me, Windows NT 4.0 and later: Double Japanese Postcard, 200- by 148-millimeters |
6173 "/ dbl_japanese_postcard Windows 98/Me, Windows NT 4.0 and later: Double Japanese Postcard, 200- by 148-millimeters |
6180 "/ dbl_japanese_postcard_rotated Windows 98/Me, Windows NT 4.0 and later: Double Japanese Postcard Rotated, 148- by 200-millimeters |
6174 "/ dbl_japanese_postcard_rotated Windows 98/Me, Windows NT 4.0 and later: Double Japanese Postcard Rotated, 148- by 200-millimeters |
6181 "/ dsheet D Sheet, 22- by 34-inches |
6175 "/ dsheet D Sheet, 22- by 34-inches |
6182 '#9 Envelope, 3 7/8- by 8 7/8-inches' 19 "/ env_9 |
6176 '#9 Envelope, 3 7/8- by 8 7/8-inches' 19 "/ env_9 |
6183 '#10 Envelope, 4 1/8- by 9 1/2-inches' 20 "/ env_10 |
6177 '#10 Envelope, 4 1/8- by 9 1/2-inches' 20 "/ env_10 |
6184 '#11 Envelope, 4 1/2- by 10 3/8-inches' 21 "/ env_11 |
6178 '#11 Envelope, 4 1/2- by 10 3/8-inches' 21 "/ env_11 |
6185 '#12 Envelope, 4 3/4- by 11-inches' 22 "/ env_12 |
6179 '#12 Envelope, 4 3/4- by 11-inches' 22 "/ env_12 |
6186 '#14 Envelope, 5- by 11 1/2-inches' 23 "/ env_15 |
6180 '#14 Envelope, 5- by 11 1/2-inches' 23 "/ env_15 |
6187 'C5 Envelope, 162- by 229-millimeters' 28 "/ env_c5 |
6181 'C5 Envelope, 162- by 229-millimeters' 28 "/ env_c5 |
6188 'C3 Envelope, 324- by 458-millimeters' 29 "/ env_c3 |
6182 'C3 Envelope, 324- by 458-millimeters' 29 "/ env_c3 |
6189 'C4 Envelope, 229- by 324-millimeters' 30 "/ env_c4 |
6183 'C4 Envelope, 229- by 324-millimeters' 30 "/ env_c4 |
6190 'C6 Envelope, 114- by 162-millimeters' 31 "/ env_c6 |
6184 'C6 Envelope, 114- by 162-millimeters' 31 "/ env_c6 |
6191 'C65 Envelope, 114- by 229-millimeters' 32 "/ env_c65 |
6185 'C65 Envelope, 114- by 229-millimeters' 32 "/ env_c65 |
6192 'B4 Envelope, 250- by 353-millimeters' 33 "/ env_b4 |
6186 'B4 Envelope, 250- by 353-millimeters' 33 "/ env_b4 |
6193 'B5 Envelope, 176- by 250-millimeters' 34 "/ env_b5 |
6187 'B5 Envelope, 176- by 250-millimeters' 34 "/ env_b5 |
6194 'B6 Envelope, 176- by 125-millimeters' 35 "/ env_b6 |
6188 'B6 Envelope, 176- by 125-millimeters' 35 "/ env_b6 |
6195 'DL Envelope, 110- by 220-millimeters' 27 "/ env_dl |
6189 'DL Envelope, 110- by 220-millimeters' 27 "/ env_dl |
6196 'Italy Envelope, 110- by 230-millimeters' 36 "/ env_italy |
6190 'Italy Envelope, 110- by 230-millimeters' 36 "/ env_italy |
6197 'Monarch Envelope, 3 7/8- by 7 1/2-inches' 37 "/ env_monarch |
6191 'Monarch Envelope, 3 7/8- by 7 1/2-inches' 37 "/ env_monarch |
6198 "/ env_personal 6 3/4 Envelope, 3 5/8- by 6 1/2-inches |
6192 "/ env_personal 6 3/4 Envelope, 3 5/8- by 6 1/2-inches |
6199 "/ esheet E Sheet, 34- by 44-inches |
6193 "/ esheet E Sheet, 34- by 44-inches |
6200 "/ executive Executive, 7 1/4- by 10 1/2-inches |
6194 "/ executive Executive, 7 1/4- by 10 1/2-inches |
6201 "/ fanfold_us US Std Fanfold, 14 7/8- by 11-inches |
6195 "/ fanfold_us US Std Fanfold, 14 7/8- by 11-inches |
6202 "/ fanfold_std_german German Std Fanfold, 8 1/2- by 12-inches |
6196 "/ fanfold_std_german German Std Fanfold, 8 1/2- by 12-inches |
6212 "/ jenv_kaku3 Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Kaku #3 |
6206 "/ jenv_kaku3 Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Kaku #3 |
6213 "/ jenv_kaku3_rotated Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Kaku #3 Rotated |
6207 "/ jenv_kaku3_rotated Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope Kaku #3 Rotated |
6214 "/ jenv_you4 Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope You #4 |
6208 "/ jenv_you4 Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope You #4 |
6215 "/ jenv_you4_rotated Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope You #4 Rotated |
6209 "/ jenv_you4_rotated Windows 98/Me, Windows NT 4.0 and later: Japanese Envelope You #4 Rotated |
6216 "/ last Windows 2000/XP: PENV_10_ROTATED |
6210 "/ last Windows 2000/XP: PENV_10_ROTATED |
6217 'Ledger, 17- by 11-inches' 4 "/ ledger |
6211 'Ledger, 17- by 11-inches' 4 "/ ledger |
6218 'Letter Rotated 11 by 8 1/2 11 inches' 54 "/ letter_rotated |
6212 'Letter Rotated 11 by 8 1/2 11 inches' 54 "/ letter_rotated |
6219 "/ lettersmall Letter Small, 8 1/2- by 11-inches |
6213 "/ lettersmall Letter Small, 8 1/2- by 11-inches |
6220 "/ note Note, 8 1/2- by 11-inches |
6214 "/ note Note, 8 1/2- by 11-inches |
6221 "/ p16k Windows 98/Me, Windows NT 4.0 and later: PRC 16K, 146- by 215-millimeters |
6215 "/ p16k Windows 98/Me, Windows NT 4.0 and later: PRC 16K, 146- by 215-millimeters |
6222 "/ p16k_rotated Windows 98/Me, Windows NT 4.0 and later: PRC 16K Rotated, 215- by 146-millimeters |
6216 "/ p16k_rotated Windows 98/Me, Windows NT 4.0 and later: PRC 16K Rotated, 215- by 146-millimeters |
6223 "/ p32k Windows 98/Me, Windows NT 4.0 and later: PRC 32K, 97- by 151-millimeters |
6217 "/ p32k Windows 98/Me, Windows NT 4.0 and later: PRC 32K, 97- by 151-millimeters |
6245 "/ penv_10 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #10, 324- by 458-millimeters |
6239 "/ penv_10 Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #10, 324- by 458-millimeters |
6246 "/ penv_10_rotated Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #10 Rotated, 458- by 324-millimeters |
6240 "/ penv_10_rotated Windows 98/Me, Windows NT 4.0 and later: PRC Envelope #10 Rotated, 458- by 324-millimeters |
6247 "/ quarto Quarto, 215- by 275-millimeter paper |
6241 "/ quarto Quarto, 215- by 275-millimeter paper |
6248 "/ statement Statement, 5 1/2- by 8 1/2-inches |
6242 "/ statement Statement, 5 1/2- by 8 1/2-inches |
6249 "/ tabloid Tabloid, 11- by 17-inches |
6243 "/ tabloid Tabloid, 11- by 17-inches |
6250 ). |
6244 ). |
6251 |
6245 |
6252 "Created: / 31-07-2006 / 15:35:37 / fm" |
6246 "Created: / 31-07-2006 / 15:35:37 / fm" |
6253 ! |
6247 ! |
6254 |
6248 |
6255 statusNumberToDescriptionForNumber:aNumber |
6249 statusNumberToDescriptionForNumber:aNumber |
6256 ^ self statusNumberToDescriptionMapping at:aNumber ifAbsent:[('Unknown (%1)' bindWith:aNumber printString)] |
6250 ^ self statusNumberToDescriptionMapping at:aNumber ifAbsent:[('Unknown (%1)' bindWith:aNumber printString)] |
6257 |
6251 |
6258 " |
6252 " |
6259 self statusNumberToDescriptionForNumber:1 |
6253 self statusNumberToDescriptionForNumber:1 |
6260 " |
6254 " |
6271 ^ d. |
6265 ^ d. |
6272 |
6266 |
6273 "Created: / 01-08-2006 / 14:31:05 / fm" |
6267 "Created: / 01-08-2006 / 14:31:05 / fm" |
6274 ! |
6268 ! |
6275 |
6269 |
6276 statusNumberToDescriptionTable |
6270 statusNumberToDescriptionTable |
6277 |
6271 |
6278 ^Dictionary withKeysAndValues: |
6272 ^Dictionary withKeysAndValues: |
6279 #( 'Ready' 0 "/ PRINTER_STATUS_READY |
6273 #( 'Ready' 0 "/ PRINTER_STATUS_READY |
6280 'Paused' 1 "/ PRINTER_STATUS_PAUSED |
6274 'Paused' 1 "/ PRINTER_STATUS_PAUSED |
6281 'Error' 2 "/ PRINTER_STATUS_ERROR |
6275 'Error' 2 "/ PRINTER_STATUS_ERROR |
6282 'Deleting...' 4 "/ PRINTER_STATUS_PENDING_DELETION |
6276 'Deleting...' 4 "/ PRINTER_STATUS_PENDING_DELETION |
6283 'Paper Jam' 8 "/ PRINTER_STATUS_PAPER_JAM |
6277 'Paper Jam' 8 "/ PRINTER_STATUS_PAPER_JAM |
6284 'Paper Out' 16 "/ PRINTER_STATUS_PAPER_OUT |
6278 'Paper Out' 16 "/ PRINTER_STATUS_PAPER_OUT |
6285 'Manual Feed Required' 32 "/ PRINTER_STATUS_MANUAL_FEED |
6279 'Manual Feed Required' 32 "/ PRINTER_STATUS_MANUAL_FEED |
6286 'Paper Problem' 64 "/ PRINTER_STATUS_PAPER_PROBLEM |
6280 'Paper Problem' 64 "/ PRINTER_STATUS_PAPER_PROBLEM |
6287 'Offline' 128 "/ PRINTER_STATUS_OFFLINE |
6281 'Offline' 128 "/ PRINTER_STATUS_OFFLINE |
6288 'Downloading Job' 256 "/ PRINTER_STATUS_IO_ACTIVE |
6282 'Downloading Job' 256 "/ PRINTER_STATUS_IO_ACTIVE |
6289 'Busy' 512 "/ PRINTER_STATUS_BUSY |
6283 'Busy' 512 "/ PRINTER_STATUS_BUSY |
6290 'Printing' 1024 "/ PRINTER_STATUS_PRINTING |
6284 'Printing' 1024 "/ PRINTER_STATUS_PRINTING |
6291 'Output Bill Full' 2048 "/ PRINTER_STATUS_OUTPUT_BIN_FULL |
6285 'Output Bill Full' 2048 "/ PRINTER_STATUS_OUTPUT_BIN_FULL |
6292 'Not Available' 4096 "/ PRINTER_STATUS_NOT_AVAILABLE |
6286 'Not Available' 4096 "/ PRINTER_STATUS_NOT_AVAILABLE |
6293 'Waiting' 8192 "/ PRINTER_STATUS_WAITING |
6287 'Waiting' 8192 "/ PRINTER_STATUS_WAITING |
6294 'Processing Job' 16384 "/ PRINTER_STATUS_PROCESSING |
6288 'Processing Job' 16384 "/ PRINTER_STATUS_PROCESSING |
6295 'Initializing' 32768 "/ PRINTER_STATUS_INITIALIZING |
6289 'Initializing' 32768 "/ PRINTER_STATUS_INITIALIZING |
6296 'Warming Up' 65536 "/ PRINTER_STATUS_WARMING_UP |
6290 'Warming Up' 65536 "/ PRINTER_STATUS_WARMING_UP |
6297 'Toner Low' 131072 "/ PRINTER_STATUS_TONER_LOW |
6291 'Toner Low' 131072 "/ PRINTER_STATUS_TONER_LOW |
6298 'Toner Out' 262144 "/ PRINTER_STATUS_NO_TONER |
6292 'Toner Out' 262144 "/ PRINTER_STATUS_NO_TONER |
6299 'Page too Complex' 524288 "/ PRINTER_STATUS_PAGE_PUNT |
6293 'Page too Complex' 524288 "/ PRINTER_STATUS_PAGE_PUNT |
6300 'User Intervention Required'1048576 "/ PRINTER_STATUS_USER_INTERVENTION |
6294 'User Intervention Required'1048576 "/ PRINTER_STATUS_USER_INTERVENTION |
6301 'Out of Memory' 2097152 "/ PRINTER_STATUS_OUT_OF_MEMORY |
6295 'Out of Memory' 2097152 "/ PRINTER_STATUS_OUT_OF_MEMORY |
6302 'Door Open' 4194304 "/ PRINTER_STATUS_DOOR_OPEN |
6296 'Door Open' 4194304 "/ PRINTER_STATUS_DOOR_OPEN |
6303 'Unable to connect' 8388608 "/ PRINTER_STATUS_SERVER_UNKNOWN |
6297 'Unable to connect' 8388608 "/ PRINTER_STATUS_SERVER_UNKNOWN |
6304 'Power Save Mode' 16777216 "/ PRINTER_STATUS_POWER_SAVE |
6298 'Power Save Mode' 16777216 "/ PRINTER_STATUS_POWER_SAVE |
6305 ). |
6299 ). |
6306 |
6300 |
6307 "Created: / 01-08-2006 / 14:23:33 / fm" |
6301 "Created: / 01-08-2006 / 14:23:33 / fm" |
6308 ! ! |
6302 ! ! |
6309 |
6303 |
6310 !AbstractOperatingSystem::PrinterInfo methodsFor:'accessing'! |
6304 !AbstractOperatingSystem::PrinterInfo methodsFor:'accessing'! |
6327 ! |
6321 ! |
6328 |
6322 |
6329 collate: aBoolean |
6323 collate: aBoolean |
6330 |integer| |
6324 |integer| |
6331 |
6325 |
6332 integer:= aBoolean |
6326 integer:= aBoolean |
6333 ifTrue:[1] "DMCOLLATE_TRUE" |
6327 ifTrue:[1] "DMCOLLATE_TRUE" |
6334 ifFalse:[0]. "DMCOLLATE_FALSE" |
6328 ifFalse:[0]. "DMCOLLATE_FALSE" |
6335 self documentProperties collate: integer |
6329 self documentProperties collate: integer |
6336 |
6330 |
6337 "Created: / 01-08-2006 / 09:56:01 / fm" |
6331 "Created: / 01-08-2006 / 09:56:01 / fm" |
6338 "Modified: / 16-04-2007 / 12:01:30 / cg" |
6332 "Modified: / 16-04-2007 / 12:01:30 / cg" |
6339 ! |
6333 ! |
6368 |
6362 |
6369 "Created: / 28-07-2006 / 11:50:04 / fm" |
6363 "Created: / 28-07-2006 / 11:50:04 / fm" |
6370 "Modified: / 31-07-2006 / 13:06:24 / fm" |
6364 "Modified: / 31-07-2006 / 13:06:24 / fm" |
6371 ! |
6365 ! |
6372 |
6366 |
6373 documentProperties: aDevModeStructure |
6367 documentProperties: aDevModeStructure |
6374 |
6368 |
6375 documentProperties := aDevModeStructure. |
6369 documentProperties := aDevModeStructure. |
6376 |
6370 |
6377 "Created: / 28-07-2006 / 11:47:31 / fm" |
6371 "Created: / 28-07-2006 / 11:47:31 / fm" |
6378 ! |
6372 ! |
6416 |
6410 |
6417 "Created: / 28-07-2006 / 16:44:26 / fm" |
6411 "Created: / 28-07-2006 / 16:44:26 / fm" |
6418 "Modified: / 18-10-2006 / 12:01:36 / User" |
6412 "Modified: / 18-10-2006 / 12:01:36 / User" |
6419 ! |
6413 ! |
6420 |
6414 |
6421 orientation:anInteger |
6415 orientation:anInteger |
6422 |properties| |
6416 |properties| |
6423 |
6417 |
6424 properties := self documentProperties. |
6418 properties := self documentProperties. |
6425 properties notNil ifTrue:[ |
6419 properties notNil ifTrue:[ |
6426 properties orientation:anInteger |
6420 properties orientation:anInteger |
6427 ] |
6421 ] |
6428 |
6422 |
6429 "Created: / 28-07-2006 / 17:22:44 / fm" |
6423 "Created: / 28-07-2006 / 17:22:44 / fm" |
6430 "Modified: / 18-10-2006 / 12:01:40 / User" |
6424 "Modified: / 18-10-2006 / 12:01:40 / User" |
6431 ! |
6425 ! |
6447 "Created: / 31-07-2006 / 15:23:29 / fm" |
6441 "Created: / 31-07-2006 / 15:23:29 / fm" |
6448 "Modified: / 31-07-2006 / 16:25:58 / fm" |
6442 "Modified: / 31-07-2006 / 16:25:58 / fm" |
6449 "Modified: / 18-10-2006 / 12:01:45 / User" |
6443 "Modified: / 18-10-2006 / 12:01:45 / User" |
6450 ! |
6444 ! |
6451 |
6445 |
6452 paperSize:anInteger |
6446 paperSize:anInteger |
6453 |properties| |
6447 |properties| |
6454 |
6448 |
6455 properties := self documentProperties. |
6449 properties := self documentProperties. |
6456 properties notNil ifTrue:[ |
6450 properties notNil ifTrue:[ |
6457 properties paperSize:anInteger |
6451 properties paperSize:anInteger |
6458 ] |
6452 ] |
6459 |
6453 |
6460 "Created: / 31-07-2006 / 15:23:20 / fm" |
6454 "Created: / 31-07-2006 / 15:23:20 / fm" |
6461 "Modified: / 18-10-2006 / 12:01:48 / User" |
6455 "Modified: / 18-10-2006 / 12:01:48 / User" |
6462 ! |
6456 ! |
6465 ^ self class paperSizeNameForNumber:self paperSize ifAbsent:[nil]. |
6459 ^ self class paperSizeNameForNumber:self paperSize ifAbsent:[nil]. |
6466 |
6460 |
6467 "Created: / 31-07-2006 / 15:35:12 / fm" |
6461 "Created: / 31-07-2006 / 15:35:12 / fm" |
6468 ! |
6462 ! |
6469 |
6463 |
6470 paperSizeName:aString |
6464 paperSizeName:aString |
6471 self paperSize:(self class paperSizeNumberForName:aString) |
6465 self paperSize:(self class paperSizeNumberForName:aString) |
6472 |
6466 |
6473 "Modified: / 18-10-2006 / 12:01:56 / User" |
6467 "Modified: / 18-10-2006 / 12:01:56 / User" |
6474 ! |
6468 ! |
6475 |
6469 |
6483 ^ printerName |
6477 ^ printerName |
6484 |
6478 |
6485 "Created: / 27-07-2006 / 12:16:59 / fm" |
6479 "Created: / 27-07-2006 / 12:16:59 / fm" |
6486 ! |
6480 ! |
6487 |
6481 |
6488 printerName:printerNameArg attributes:attributesArg |
6482 printerName:printerNameArg attributes:attributesArg |
6489 |
6483 |
6490 printerName := printerNameArg. |
6484 printerName := printerNameArg. |
6491 attributes := attributesArg. |
6485 attributes := attributesArg. |
6492 |
6486 |
6493 "Created: / 27-07-2006 / 12:29:18 / fm" |
6487 "Created: / 27-07-2006 / 12:29:18 / fm" |
6515 "Modified: / 16-04-2007 / 12:03:41 / cg" |
6509 "Modified: / 16-04-2007 / 12:03:41 / cg" |
6516 ! |
6510 ! |
6517 |
6511 |
6518 userFriendlyName |
6512 userFriendlyName |
6519 ^self remotePrinterName isEmpty |
6513 ^self remotePrinterName isEmpty |
6520 ifTrue:[self printerName] |
6514 ifTrue:[self printerName] |
6521 ifFalse:[self remotePrinterName, ' on ', self remotePrinterHost] |
6515 ifFalse:[self remotePrinterName, ' on ', self remotePrinterHost] |
6522 |
6516 |
6523 "Created: / 03-08-2006 / 12:50:09 / fm" |
6517 "Created: / 03-08-2006 / 12:50:09 / fm" |
6524 ! ! |
6518 ! ! |
6525 |
6519 |
6526 !AbstractOperatingSystem::PrinterInfo methodsFor:'dc creation'! |
6520 !AbstractOperatingSystem::PrinterInfo methodsFor:'dc creation'! |
6530 |
6524 |
6531 driverName := self driverName. |
6525 driverName := self driverName. |
6532 pName := self printerName. |
6526 pName := self printerName. |
6533 "/ Transcript show:driverName; show:' '; showCR:printerName. |
6527 "/ Transcript show:driverName; show:' '; showCR:printerName. |
6534 |
6528 |
6535 ^OperatingSystem createPrinterDC:driverName |
6529 ^OperatingSystem createPrinterDC:driverName |
6536 device:pName |
6530 device:pName |
6537 output:self medium |
6531 output:self medium |
6538 initData:self documentProperties. |
6532 initData:self documentProperties. |
6539 |
6533 |
6540 "Created: / 02-08-2006 / 16:51:02 / fm" |
6534 "Created: / 02-08-2006 / 16:51:02 / fm" |
6541 "Modified: / 16-04-2007 / 13:56:56 / cg" |
6535 "Modified: / 16-04-2007 / 13:56:56 / cg" |
6542 ! ! |
6536 ! ! |
6543 |
6537 |
6547 "Returns true if the documentProperties have been accepted. Otherwise, returns false" |
6541 "Returns true if the documentProperties have been accepted. Otherwise, returns false" |
6548 |
6542 |
6549 |h newDocumentProperties| |
6543 |h newDocumentProperties| |
6550 |
6544 |
6551 h := OperatingSystem openPrinter: self printerName. |
6545 h := OperatingSystem openPrinter: self printerName. |
6552 newDocumentProperties := OperatingSystem documentPropertiesDialogFor:nil |
6546 newDocumentProperties := OperatingSystem documentPropertiesDialogFor:nil |
6553 hPrinter:h |
6547 hPrinter:h |
6554 pDeviceName: self printerName |
6548 pDeviceName: self printerName |
6555 devModeInput:self documentProperties. |
6549 devModeInput:self documentProperties. |
6556 (newDocumentProperties contains:[:el | el ~= 0]) |
6550 (newDocumentProperties contains:[:el | el ~= 0]) |
6557 ifFalse:[^false]. |
6551 ifFalse:[^false]. |
6558 self documentProperties: newDocumentProperties. |
6552 self documentProperties: newDocumentProperties. |
6559 OperatingSystem closePrinter:h. |
6553 OperatingSystem closePrinter:h. |
6560 ^true |
6554 ^true |
6561 |
6555 |
6562 "Created: / 28-07-2006 / 11:44:01 / fm" |
6556 "Created: / 28-07-2006 / 11:44:01 / fm" |
6607 |
6601 |
6608 |h devMode | |
6602 |h devMode | |
6609 |
6603 |
6610 h := OperatingSystem openPrinter: self printerName. |
6604 h := OperatingSystem openPrinter: self printerName. |
6611 devMode := OperatingSystem getDocumentProperties:nil |
6605 devMode := OperatingSystem getDocumentProperties:nil |
6612 hPrinter:h |
6606 hPrinter:h |
6613 pDeviceName: self printerName. |
6607 pDeviceName: self printerName. |
6614 OperatingSystem closePrinter: h. |
6608 OperatingSystem closePrinter: h. |
6615 ^devMode |
6609 ^devMode |
6616 |
6610 |
6617 "Created: / 28-07-2006 / 11:49:33 / fm" |
6611 "Created: / 28-07-2006 / 11:49:33 / fm" |
6618 "Modified: / 31-07-2006 / 10:33:04 / fm" |
6612 "Modified: / 31-07-2006 / 10:33:04 / fm" |
6619 "Modified: / 16-04-2007 / 12:02:00 / cg" |
6613 "Modified: / 16-04-2007 / 12:02:00 / cg" |
6620 ! |
6614 ! |
6621 |
6615 |
6622 getPrinterInfo2 |
6616 getPrinterInfo2 |
6623 "Returns a aPrinterInfo2 structure" |
6617 "Returns a aPrinterInfo2 structure" |
6624 |
6618 |
6625 printerInfo2 := OperatingSystem getPrinterInfo2:self printerName. |
6619 printerInfo2 := OperatingSystem getPrinterInfo2:self printerName. |
6626 ^ printerInfo2 |
6620 ^ printerInfo2 |
6627 |
6621 |
6628 "Created: / 01-08-2006 / 13:50:55 / fm" |
6622 "Created: / 01-08-2006 / 13:50:55 / fm" |
6629 "Modified: / 01-08-2006 / 15:11:03 / fm" |
6623 "Modified: / 01-08-2006 / 15:11:03 / fm" |
6630 "Modified: / 18-10-2006 / 12:03:54 / User" |
6624 "Modified: / 18-10-2006 / 12:03:54 / User" |
6631 ! |
6625 ! |
6632 |
6626 |
6633 printerInfo2 |
6627 printerInfo2 |
6634 "Returns a aPrinterInfo2 structure" |
6628 "Returns a aPrinterInfo2 structure" |
6635 |
6629 |
6636 printerInfo2 isNil ifTrue:[ |
6630 printerInfo2 isNil ifTrue:[ |
6637 self getPrinterInfo2. |
6631 self getPrinterInfo2. |
6638 ]. |
6632 ]. |
6639 ^ printerInfo2 |
6633 ^ printerInfo2 |
6640 |
6634 |
6641 "Created: / 01-08-2006 / 15:10:18 / fm" |
6635 "Created: / 01-08-2006 / 15:10:18 / fm" |
6642 "Modified: / 18-10-2006 / 12:03:57 / User" |
6636 "Modified: / 18-10-2006 / 12:03:57 / User" |
6643 ! |
6637 ! |
6644 |
6638 |
6645 setDocumentProperties |
6639 setDocumentProperties |
6646 "Sets a aDevModeStructure or nil if the printer is not available" |
6640 "Sets a aDevModeStructure or nil if the printer is not available" |
6647 |
6641 |
6648 self documentProperties: self getDocumentProperties |
6642 self documentProperties: self getDocumentProperties |
6649 |
6643 |
6650 "Created: / 31-07-2006 / 13:04:58 / fm" |
6644 "Created: / 31-07-2006 / 13:04:58 / fm" |
6651 ! ! |
6645 ! ! |
6667 |
6661 |
6668 <resource: #obsolete> |
6662 <resource: #obsolete> |
6669 self obsoleteMethodWarning:'use accessor for index ', index printString. |
6663 self obsoleteMethodWarning:'use accessor for index ', index printString. |
6670 |
6664 |
6671 index == 1 ifTrue:[ |
6665 index == 1 ifTrue:[ |
6672 ^ self year. |
6666 ^ self year. |
6673 ]. |
6667 ]. |
6674 index == 2 ifTrue:[ |
6668 index == 2 ifTrue:[ |
6675 ^ self month. |
6669 ^ self month. |
6676 ]. |
6670 ]. |
6677 index == 3 ifTrue:[ |
6671 index == 3 ifTrue:[ |
6678 ^ self day. |
6672 ^ self day. |
6679 ]. |
6673 ]. |
6680 index == 4 ifTrue:[ |
6674 index == 4 ifTrue:[ |
6681 ^ self hours. |
6675 ^ self hours. |
6682 ]. |
6676 ]. |
6683 index == 5 ifTrue:[ |
6677 index == 5 ifTrue:[ |
6684 ^ self minutes. |
6678 ^ self minutes. |
6685 ]. |
6679 ]. |
6686 index == 6 ifTrue:[ |
6680 index == 6 ifTrue:[ |
6687 ^ self seconds. |
6681 ^ self seconds. |
6688 ]. |
6682 ]. |
6689 index == 7 ifTrue:[ |
6683 index == 7 ifTrue:[ |
6690 ^ self utcOffset. |
6684 ^ self utcOffset. |
6691 ]. |
6685 ]. |
6692 index == 8 ifTrue:[ |
6686 index == 8 ifTrue:[ |
6693 ^ self dst. |
6687 ^ self dst. |
6694 ]. |
6688 ]. |
6695 index == 9 ifTrue:[ |
6689 index == 9 ifTrue:[ |
6696 ^ self milliseconds. |
6690 ^ self milliseconds. |
6697 ]. |
6691 ]. |
6698 index == 10 ifTrue:[ |
6692 index == 10 ifTrue:[ |
6699 ^ self dayInYear. |
6693 ^ self dayInYear. |
6700 ]. |
6694 ]. |
6701 index == 11 ifTrue:[ |
6695 index == 11 ifTrue:[ |
6702 ^ self dayInWeek. |
6696 ^ self dayInWeek. |
6703 ]. |
6697 ]. |
6704 self subscriptBoundsError:index |
6698 self subscriptBoundsError:index |
6705 ! |
6699 ! |
6706 |
6700 |
6707 day |
6701 day |
6717 (it is not set in windows)" |
6711 (it is not set in windows)" |
6718 |
6712 |
6719 |dayCount| |
6713 |dayCount| |
6720 |
6714 |
6721 dayInYear notNil ifTrue:[ |
6715 dayInYear notNil ifTrue:[ |
6722 ^ dayInYear. |
6716 ^ dayInYear. |
6723 ]. |
6717 ]. |
6724 |
6718 |
6725 dayCount := #(0 31 59 90 120 151 181 212 243 273 304 334) at:month. |
6719 dayCount := #(0 31 59 90 120 151 181 212 243 273 304 334) at:month. |
6726 (month > 2 |
6720 (month > 2 |
6727 and:[(year \\ 4 == 0) |
6721 and:[(year \\ 4 == 0) |
6728 and:[(year \\ 100 ~~ 0) |
6722 and:[(year \\ 100 ~~ 0) |
6729 and:[(year \\ 400 == 0)]]]) ifTrue:[ |
6723 and:[(year \\ 400 == 0)]]]) ifTrue:[ |
6730 "leap year and month after February" |
6724 "leap year and month after February" |
6731 dayCount := dayCount + 1. |
6725 dayCount := dayCount + 1. |
6732 ]. |
6726 ]. |
6733 |
6727 |
6734 ^ dayCount + day. |
6728 ^ dayCount + day. |
6735 |
6729 |
6736 |
6730 |
6737 " |
6731 " |
6738 |daysSoFar| |
6732 |daysSoFar| |
6739 |
6733 |
6740 daysSoFar := 0. |
6734 daysSoFar := 0. |
6741 #(0 31 28 31 30 31 30 31 31 30 31 30) collect:[:daysInMonth| daysSoFar := daysSoFar + daysInMonth. daysSoFar] |
6735 #(0 31 28 31 30 31 30 31 31 30 31 30) collect:[:daysInMonth| daysSoFar := daysSoFar + daysInMonth. daysSoFar] |
6742 " |
6736 " |
6834 !AbstractOperatingSystem::TimeZoneInfo class methodsFor:'documentation'! |
6828 !AbstractOperatingSystem::TimeZoneInfo class methodsFor:'documentation'! |
6835 |
6829 |
6836 documentation |
6830 documentation |
6837 " |
6831 " |
6838 Bias |
6832 Bias |
6839 The current bias for local time translation on this computer, in minutes. |
6833 The current bias for local time translation on this computer, in minutes. |
6840 The bias is the difference, in minutes, between Coordinated Universal Time (UTC) |
6834 The bias is the difference, in minutes, between Coordinated Universal Time (UTC) |
6841 and local time. |
6835 and local time. |
6842 All translations between UTC and local time are based on the following formula: |
6836 All translations between UTC and local time are based on the following formula: |
6843 |
6837 |
6844 UTC = local time + bias |
6838 UTC = local time + bias |
6845 |
6839 |
6846 StandardName |
6840 StandardName |
6847 A description for standard time. For example, 'EST' could indicate Eastern Standard Time. |
6841 A description for standard time. For example, 'EST' could indicate Eastern Standard Time. |
6848 The string will be returned unchanged by the GetTimeZoneInformation function. |
6842 The string will be returned unchanged by the GetTimeZoneInformation function. |
6849 This string can be empty. |
6843 This string can be empty. |
6850 This is for information only - do not depend on the value of the string. |
6844 This is for information only - do not depend on the value of the string. |
6851 |
6845 |
6852 StandardDate |
6846 StandardDate |
6853 A Timestamp that contains a date and local time when the transition from daylight saving |
6847 A Timestamp that contains a date and local time when the transition from daylight saving |
6854 time to standard time occurs on this operating system. |
6848 time to standard time occurs on this operating system. |
6855 If the time zone does not support daylight saving time or if the caller needs to disable |
6849 If the time zone does not support daylight saving time or if the caller needs to disable |
6856 daylight saving time, the standardDate is nil. |
6850 daylight saving time, the standardDate is nil. |
6857 If this date is specified, the DaylightDate member of this structure must also be specified. |
6851 If this date is specified, the DaylightDate member of this structure must also be specified. |
6858 Otherwise, the system assumes the time zone data is invalid and no changes will be applied. |
6852 Otherwise, the system assumes the time zone data is invalid and no changes will be applied. |
6859 |
6853 |
6860 To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members |
6854 To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members |
6861 to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate |
6855 to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate |
6862 the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence |
6856 the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence |
6863 during the month if that day of the week does not occur 5 times). |
6857 during the month if that day of the week does not occur 5 times). |
6864 |
6858 |
6865 Using this notation, specify 02:00 on the first Sunday in April as follows: |
6859 Using this notation, specify 02:00 on the first Sunday in April as follows: |
6866 wHour = 2, wMonth = 4, wDayOfWeek = 0, wDay = 1. |
6860 wHour = 2, wMonth = 4, wDayOfWeek = 0, wDay = 1. |
6867 Specify 02:00 on the last Thursday in October as follows: |
6861 Specify 02:00 on the last Thursday in October as follows: |
6868 wHour = 2, wMonth = 10, wDayOfWeek = 4, wDay = 5. |
6862 wHour = 2, wMonth = 10, wDayOfWeek = 4, wDay = 5. |
6869 |
6863 |
6870 If the wYear member is not zero, the transition date is absolute; it will only occur one time. |
6864 If the wYear member is not zero, the transition date is absolute; it will only occur one time. |
6871 Otherwise, it is a relative date that occurs yearly. |
6865 Otherwise, it is a relative date that occurs yearly. |
6872 |
6866 |
6873 StandardBias |
6867 StandardBias |
6874 The bias value to be used during local time translations that occur during standard time. |
6868 The bias value to be used during local time translations that occur during standard time. |
6875 This member is ignored if a value for the StandardDate member is not supplied. |
6869 This member is ignored if a value for the StandardDate member is not supplied. |
6876 |
6870 |
6877 This value is added to the value of the Bias member to form the bias used during standard time. |
6871 This value is added to the value of the Bias member to form the bias used during standard time. |
6878 In most time zones, the value of this member is zero. |
6872 In most time zones, the value of this member is zero. |
6879 |
6873 |
6880 DaylightName |
6874 DaylightName |
6881 A description for daylight saving time. For example, 'PDT' could indicate Pacific Daylight Time. |
6875 A description for daylight saving time. For example, 'PDT' could indicate Pacific Daylight Time. |
6882 The string will be returned unchanged by the GetTimeZoneInformation function. This string can be empty. |
6876 The string will be returned unchanged by the GetTimeZoneInformation function. This string can be empty. |
6883 This is for information only - do not depend on the value of the string. |
6877 This is for information only - do not depend on the value of the string. |
6884 |
6878 |
6885 DaylightDate |
6879 DaylightDate |
6886 A Timestamp structure that contains a date and local time when the transition from standard time |
6880 A Timestamp structure that contains a date and local time when the transition from standard time |
6887 to daylight saving time occurs on this operating system. |
6881 to daylight saving time occurs on this operating system. |
6888 If the time zone does not support daylight saving time or if the caller needs to disable daylight |
6882 If the time zone does not support daylight saving time or if the caller needs to disable daylight |
6889 saving time, this entry is nil. |
6883 saving time, this entry is nil. |
6890 If this date is specified, the StandardDate member in this structure must also be specified. |
6884 If this date is specified, the StandardDate member in this structure must also be specified. |
6891 Otherwise, the system assumes the time zone data is invalid and no changes will be applied. |
6885 Otherwise, the system assumes the time zone data is invalid and no changes will be applied. |
6892 |
6886 |
6893 To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to |
6887 To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to |
6894 the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate |
6888 the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate |
6895 the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence |
6889 the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence |
6896 during the month if that day of the week does not occur 5 times). |
6890 during the month if that day of the week does not occur 5 times). |
6897 |
6891 |
6898 If the wYear member is not zero, the transition date is absolute; it will only occur one time. |
6892 If the wYear member is not zero, the transition date is absolute; it will only occur one time. |
6899 Otherwise, it is a relative date that occurs yearly. |
6893 Otherwise, it is a relative date that occurs yearly. |
6900 |
6894 |
6901 DaylightBias |
6895 DaylightBias |
6902 The bias value to be used during local time translations that occur during daylight saving time. |
6896 The bias value to be used during local time translations that occur during daylight saving time. |
6903 This member is ignored if a value for the DaylightDate member is not supplied. |
6897 This member is ignored if a value for the DaylightDate member is not supplied. |
6904 |
6898 |
6905 This value is added to the value of the Bias member to form the bias used during daylight saving time. |
6899 This value is added to the value of the Bias member to form the bias used during daylight saving time. |
6906 In most time zones, the value of this member is -60 |
6900 In most time zones, the value of this member is -60 |
6907 " |
6901 " |
6908 ! ! |
6902 ! ! |
6909 |
6903 |
6910 !AbstractOperatingSystem::TimeZoneInfo methodsFor:'accessing'! |
6904 !AbstractOperatingSystem::TimeZoneInfo methodsFor:'accessing'! |
6915 |
6909 |
6916 bias:something |
6910 bias:something |
6917 bias := something. |
6911 bias := something. |
6918 ! |
6912 ! |
6919 |
6913 |
6920 bias:biasArg name:nameArg standardBias:standardBiasArg daylightName:daylightNameArg daylightBias:daylightBiasArg |
6914 bias:biasArg name:nameArg standardBias:standardBiasArg daylightName:daylightNameArg daylightBias:daylightBiasArg |
6921 bias := biasArg. |
6915 bias := biasArg. |
6922 name := nameArg. |
6916 name := nameArg. |
6923 standardBias := standardBiasArg. |
6917 standardBias := standardBiasArg. |
6924 daylightName := daylightNameArg. |
6918 daylightName := daylightNameArg. |
6925 daylightBias := daylightBiasArg. |
6919 daylightBias := daylightBiasArg. |
6926 ! |
6920 ! |
6927 |
6921 |
6928 bias:biasArg name:nameArg standardDate:standardDateArg standardBias:standardBiasArg daylightName:daylightNameArg daylightDate:daylightDateArg daylightBias:daylightBiasArg |
6922 bias:biasArg name:nameArg standardDate:standardDateArg standardBias:standardBiasArg daylightName:daylightNameArg daylightDate:daylightDateArg daylightBias:daylightBiasArg |
6929 bias := biasArg. |
6923 bias := biasArg. |
6930 name := nameArg. |
6924 name := nameArg. |
6931 standardDate := standardDateArg. |
6925 standardDate := standardDateArg. |
6932 standardBias := standardBiasArg. |
6926 standardBias := standardBiasArg. |
6933 daylightName := daylightNameArg. |
6927 daylightName := daylightNameArg. |
6997 |
6991 |
6998 daylightYear:something |
6992 daylightYear:something |
6999 daylightYear := something. |
6993 daylightYear := something. |
7000 ! |
6994 ! |
7001 |
6995 |
7002 daylightYear:daylightYearArg daylightMonth:daylightMonthArg daylightDay:daylightDayArg daylightWeekDay:daylightWeekDayArg daylightHour:daylightHourArg daylightMinute:daylightMinuteArg |
6996 daylightYear:daylightYearArg daylightMonth:daylightMonthArg daylightDay:daylightDayArg daylightWeekDay:daylightWeekDayArg daylightHour:daylightHourArg daylightMinute:daylightMinuteArg |
7003 daylightYear := daylightYearArg. |
6997 daylightYear := daylightYearArg. |
7004 daylightMonth := daylightMonthArg. |
6998 daylightMonth := daylightMonthArg. |
7005 daylightDay := daylightDayArg. |
6999 daylightDay := daylightDayArg. |
7006 daylightWeekDay := daylightWeekDayArg. |
7000 daylightWeekDay := daylightWeekDayArg. |
7007 daylightHour := daylightHourArg. |
7001 daylightHour := daylightHourArg. |
7070 |
7064 |
7071 standardYear:something |
7065 standardYear:something |
7072 standardYear := something. |
7066 standardYear := something. |
7073 ! |
7067 ! |
7074 |
7068 |
7075 standardYear:standardYearArg standardMonth:standardMonthArg standardDay:standardDayArg standardWeekDay:standardWeekDayArg standardHour:standardHourArg standardMinute:standardMinuteArg |
7069 standardYear:standardYearArg standardMonth:standardMonthArg standardDay:standardDayArg standardWeekDay:standardWeekDayArg standardHour:standardHourArg standardMinute:standardMinuteArg |
7076 standardYear := standardYearArg. |
7070 standardYear := standardYearArg. |
7077 standardMonth := standardMonthArg. |
7071 standardMonth := standardMonthArg. |
7078 standardDay := standardDayArg. |
7072 standardDay := standardDayArg. |
7079 standardWeekDay := standardWeekDayArg. |
7073 standardWeekDay := standardWeekDayArg. |
7080 standardHour := standardHourArg. |
7074 standardHour := standardHourArg. |
7100 ! ! |
7094 ! ! |
7101 |
7095 |
7102 !AbstractOperatingSystem class methodsFor:'documentation'! |
7096 !AbstractOperatingSystem class methodsFor:'documentation'! |
7103 |
7097 |
7104 version |
7098 version |
7105 ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.216 2012/01/05 13:08:45 cg Exp $' |
7099 ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.217 2012/01/05 14:29:48 cg Exp $' |
7106 ! |
7100 ! |
7107 |
7101 |
7108 version_CVS |
7102 version_CVS |
7109 ^ 'Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.216 2012/01/05 13:08:45 cg Exp ' |
7103 ^ 'Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.217 2012/01/05 14:29:48 cg Exp ' |
7110 ! |
7104 ! |
7111 |
7105 |
7112 version_SVN |
7106 version_SVN |
7113 ^ '$Id: AbstractOperatingSystem.st 10754 2012-01-06 08:53:28Z vranyj1 $' |
7107 ^ '$Id: AbstractOperatingSystem.st 10758 2012-01-19 10:06:02Z vranyj1 $' |
7114 ! ! |
7108 ! ! |
7115 |
7109 |
7116 AbstractOperatingSystem initialize! |
7110 AbstractOperatingSystem initialize! |
7117 |
7111 |
7118 |
7112 |
7113 |