Skip to content

Commit dffb4ca

Browse files
committed
Avoid rewritings in P12
1 parent d00ba2b commit dffb4ca

10 files changed

+329
-317
lines changed

repository/OSSubprocess/OSSAttachableFileStream.class.st

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ OSSAttachableFileStream represents a stream on an input or output channel provi
44
The most common use is to represent either the read or write end of a Pipe from the Operatying System . This way, it provides a Stream API for both, reading and writing. An OSSPipe contains a 'reader' and a 'writer' which will be two different instances of this class.
55
"
66
Class {
7-
#name : #OSSAttachableFileStream,
8-
#superclass : #OldStandardFileStream,
7+
#name : 'OSSAttachableFileStream',
8+
#superclass : 'OldStandardFileStream',
99
#instVars : [
1010
'autoClose'
1111
],
12-
#category : 'OSSubprocess'
12+
#category : 'OSSubprocess',
13+
#package : 'OSSubprocess'
1314
}
1415

15-
{ #category : #'file creation' }
16+
{ #category : 'file creation' }
1617
OSSAttachableFileStream class >> fileNamed: fileName [
1718
"Since this is an attacheable stream it means the underlying stream in the OS
1819
has already been opened"
@@ -21,7 +22,7 @@ OSSAttachableFileStream class >> fileNamed: fileName [
2122

2223
]
2324

24-
{ #category : #'file creation' }
25+
{ #category : 'file creation' }
2526
OSSAttachableFileStream class >> isAFileNamed: fileName [
2627
"Since this is an attacheable stream it means the underlying stream in the OS
2728
has already been opened"
@@ -30,7 +31,7 @@ OSSAttachableFileStream class >> isAFileNamed: fileName [
3031

3132
]
3233

33-
{ #category : #'instance creation' }
34+
{ #category : 'instance creation' }
3435
OSSAttachableFileStream class >> name: aSymbolOrString attachTo: aFileID writable: readWriteFlag [
3536
"Create a new instance attached to aFileID. For write streams, this represents two
3637
Smalltalk streams which write to the same OS file or output stream,
@@ -44,7 +45,7 @@ OSSAttachableFileStream class >> name: aSymbolOrString attachTo: aFileID writabl
4445
writable: readWriteFlag) initialize
4546
]
4647

47-
{ #category : #'TO USE LATER WITHOUT OSPROCESS' }
48+
{ #category : 'TO USE LATER WITHOUT OSPROCESS' }
4849
OSSAttachableFileStream class >> name: aSymbolOrString attachToCFile: aCFile writable: readWriteFlag [
4950
"Create a new instance attached to aCFile. For write streams, this represents two
5051
Smalltalk streams which write to the same OS file or output stream,
@@ -58,7 +59,7 @@ OSSAttachableFileStream class >> name: aSymbolOrString attachToCFile: aCFile wri
5859
writable: readWriteFlag) initialize
5960
]
6061

61-
{ #category : #'file creation' }
62+
{ #category : 'file creation' }
6263
OSSAttachableFileStream class >> newFileNamed: fileName [
6364
"Since this is an attacheable stream it means the underlying stream in the OS
6465
has already been opened"
@@ -67,7 +68,7 @@ OSSAttachableFileStream class >> newFileNamed: fileName [
6768

6869
]
6970

70-
{ #category : #'file creation' }
71+
{ #category : 'file creation' }
7172
OSSAttachableFileStream class >> oldFileNamed: fileName [
7273
"Since this is an attacheable stream it means the underlying stream in the OS
7374
has already been opened"
@@ -76,7 +77,7 @@ OSSAttachableFileStream class >> oldFileNamed: fileName [
7677

7778
]
7879

79-
{ #category : #'file creation' }
80+
{ #category : 'file creation' }
8081
OSSAttachableFileStream class >> readOnlyFileNamed: fileName [
8182
"Since this is an attacheable stream it means the underlying stream in the OS
8283
has already been opened"
@@ -85,7 +86,7 @@ OSSAttachableFileStream class >> readOnlyFileNamed: fileName [
8586

8687
]
8788

88-
{ #category : #registry }
89+
{ #category : 'registry' }
8990
OSSAttachableFileStream class >> register: anObject [
9091
"An attachable file stream is generally either a second reference to an
9192
existing file stream, or a reference to a transient object such as a pipe
@@ -94,7 +95,7 @@ OSSAttachableFileStream class >> register: anObject [
9495
^ anObject
9596
]
9697

97-
{ #category : #registry }
98+
{ #category : 'registry' }
9899
OSSAttachableFileStream class >> unregister: anObject [
99100
"An attachable file stream is generally either a second reference to an
100101
existing file stream, or a reference to a transient object such as a pipe
@@ -103,14 +104,14 @@ OSSAttachableFileStream class >> unregister: anObject [
103104
^ anObject
104105
]
105106

106-
{ #category : #converting }
107+
{ #category : 'converting' }
107108
OSSAttachableFileStream >> asAttachableFileStream [
108109

109110
^ self
110111

111112
]
112113

113-
{ #category : #finalization }
114+
{ #category : 'finalization' }
114115
OSSAttachableFileStream >> autoClose [
115116
"Private. Answer true if the file should be automatically closed when
116117
this object is finalized."
@@ -119,7 +120,7 @@ OSSAttachableFileStream >> autoClose [
119120
ifNil: [autoClose := true]
120121
]
121122

122-
{ #category : #'open/close' }
123+
{ #category : 'open/close' }
123124
OSSAttachableFileStream >> close [
124125
"Close this file."
125126

@@ -132,7 +133,7 @@ OSSAttachableFileStream >> close [
132133

133134
]
134135

135-
{ #category : #'open/close' }
136+
{ #category : 'open/close' }
136137
OSSAttachableFileStream >> ensureOpen [
137138
"Since this is an attacheable stream it means the underlying stream in the OS
138139
has already been opened"
@@ -141,30 +142,30 @@ OSSAttachableFileStream >> ensureOpen [
141142

142143
]
143144

144-
{ #category : #finalization }
145+
{ #category : 'finalization' }
145146
OSSAttachableFileStream >> finalize [
146147
"If #autoClose is true, then we try to close the stream upon finalization - GC "
147148

148149
self autoClose
149150
ifTrue: [[self primCloseNoError: fileID] on: Error do: []]
150151
]
151152

152-
{ #category : #'read, write, position' }
153+
{ #category : 'read, write, position' }
153154
OSSAttachableFileStream >> flush [
154155
"Flush the external OS stream (the one in the C library)."
155156

156157
self systemAccessor fflush: self getFilePointerAsCFile
157158
]
158159

159-
{ #category : #finalization }
160+
{ #category : 'finalization' }
160161
OSSAttachableFileStream >> keepOpen [
161162
"Do not allow the file to be closed when this object is finalized."
162163

163164
autoClose := false
164165

165166
]
166167

167-
{ #category : #attaching }
168+
{ #category : 'attaching' }
168169
OSSAttachableFileStream >> name: aSymbolOrString attachTo: aFileID writable: readWriteFlag [
169170
"Attach to an existing file handle, assumed to have been previously
170171
opened by the underlying operating system.
@@ -179,7 +180,7 @@ OSSAttachableFileStream >> name: aSymbolOrString attachTo: aFileID writable: rea
179180

180181
]
181182

182-
{ #category : #'TO USE LATER WITHOUT OSPROCESS' }
183+
{ #category : 'TO USE LATER WITHOUT OSPROCESS' }
183184
OSSAttachableFileStream >> name: aSymbolOrString attachToCFile: externalFilePointer writable: readWriteFlag [
184185
"Attach to an existing file handle, assumed to have been previously opened by the underlying operating system.
185186
We assume a 32 bits machine and here we document the SQFile used by the VM:
@@ -223,7 +224,7 @@ typedef struct {
223224

224225
]
225226

226-
{ #category : #'TO USE LATER WITHOUT OSPROCESS' }
227+
{ #category : 'TO USE LATER WITHOUT OSPROCESS' }
227228
OSSAttachableFileStream >> oldname: aSymbolOrString attachTo: externalFilePointer writable: readWriteFlag [
228229
"Attach to an existing file handle, assumed to have been previously opened by the underlying operating system.
229230
We assume a 32 bits machine and here we document the SQFile used by the VM:
@@ -259,7 +260,7 @@ typedef struct {
259260

260261
]
261262

262-
{ #category : #'open/close' }
263+
{ #category : 'open/close' }
263264
OSSAttachableFileStream >> open [
264265
"Since this is an attacheable stream it means the underlying stream in the OS
265266
has already been opened"
@@ -268,7 +269,7 @@ OSSAttachableFileStream >> open [
268269

269270
]
270271

271-
{ #category : #'open/close' }
272+
{ #category : 'open/close' }
272273
OSSAttachableFileStream >> open: fileName forWrite: writeMode [
273274
"Since this is an attacheable stream it means the underlying stream in the OS
274275
has already been opened"
@@ -277,7 +278,7 @@ OSSAttachableFileStream >> open: fileName forWrite: writeMode [
277278

278279
]
279280

280-
{ #category : #'open/close' }
281+
{ #category : 'open/close' }
281282
OSSAttachableFileStream >> openReadOnly [
282283
"Since this is an attacheable stream it means the underlying stream in the OS
283284
has already been opened"
@@ -286,7 +287,7 @@ OSSAttachableFileStream >> openReadOnly [
286287

287288
]
288289

289-
{ #category : #'read, write, position' }
290+
{ #category : 'read, write, position' }
290291
OSSAttachableFileStream >> position [
291292
"Return the receiver's current file position. If the stream is not positionable,
292293
as in the case of a Unix pipe stream, answer 0."
@@ -297,7 +298,7 @@ OSSAttachableFileStream >> position [
297298

298299
]
299300

300-
{ #category : #'open/close' }
301+
{ #category : 'open/close' }
301302
OSSAttachableFileStream >> reopen [
302303
"Since this is an attacheable stream it means the underlying stream in the OS
303304
has already been opened"
@@ -306,28 +307,28 @@ OSSAttachableFileStream >> reopen [
306307

307308
]
308309

309-
{ #category : #'non blocking' }
310+
{ #category : 'non blocking' }
310311
OSSAttachableFileStream >> setNonBlocking [
311312
"Make this stream to be none blocking. In Linux it means
312313
calling fcntl() to set the file non-blocking (O_NONBLOCK)."
313314

314315
self systemAccessor makeFileNoneBocking: fileID
315316
]
316317

317-
{ #category : #'TO USE LATER WITHOUT OSPROCESS' }
318+
{ #category : 'TO USE LATER WITHOUT OSPROCESS' }
318319
OSSAttachableFileStream >> setOSFilePointerFromByteArray: externalFilePointer to: aDestByteArray offset: anOffsetNumber [
319320
1 to: 4 do: [ :index | aDestByteArray at: (index + anOffsetNumber) put: (externalFilePointer at: index) ]
320321

321322
]
322323

323-
{ #category : #'TO USE LATER WITHOUT OSPROCESS' }
324+
{ #category : 'TO USE LATER WITHOUT OSPROCESS' }
324325
OSSAttachableFileStream >> setSessionIDTo: fileIDByteArray [
325326
| currentSession |
326327
currentSession := OSSVMProcess vmProcess sessionID.
327328
1 to: currentSession size do: [ :index | fileIDByteArray at: index put: (currentSession at: index) ]
328329
]
329330

330-
{ #category : #'read, write, position' }
331+
{ #category : 'read, write, position' }
331332
OSSAttachableFileStream >> upToEnd [
332333
"Answer a subcollection from the current access position through the last element
333334
of the receiver. This is slower than the method in StandardFileStream, but it

repository/OSSubprocess/OSSCFile.class.st

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
OSSCFile is a external object which provides a way for mapping C-level FILE* in our FFI calls. We have FFI calls that either answer or receive FILE* and in these cases we use OSSCFile for the FFI signature.
33
"
44
Class {
5-
#name : #OSSCFile,
6-
#superclass : #FFIExternalObject,
7-
#category : 'OSSubprocess'
5+
#name : 'OSSCFile',
6+
#superclass : 'FFIExternalObject',
7+
#category : 'OSSubprocess',
8+
#package : 'OSSubprocess'
89
}

0 commit comments

Comments
 (0)