Alistair Grant uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-akg.2341.mcz ==================== Summary ==================== Name: VMMaker.oscog-akg.2341 Author: akg Time: 3 March 2018, 7:17:10.187325 pm UUID: d0fa56c5-cccb-41b4-b28d-4c54c9acdccf Ancestors: VMMaker.oscog-akg.2340 Include FilePlugin>>primitiveFileOpenUseFileDescriptor & primitiveFileOpenUseFile on all platforms (not just PharoVM). =============== Diff against VMMaker.oscog-akg.2340 =============== Item was changed: + ----- Method: FilePlugin>>cfileRecordSize (in category 'private') ----- - ----- Method: FilePlugin>>cfileRecordSize (in category 'pharo primitives') ----- cfileRecordSize "Return the size of a stdio FILE* handle" <inline: #always> ^self sizeof: #'FILE*'! Item was changed: + ----- Method: FilePlugin>>fileOpenFd:write: (in category 'private') ----- - ----- Method: FilePlugin>>fileOpenFd:write: (in category 'private - pharo') ----- fileOpenFd: fd write: writeFlag "Open the fd as file. Answer the file oop." | file fileOop | - <option: #PharoVM> <var: #file type: 'SQFile *'> <var: 'fd' type: 'int'> <export: true> fileOop := interpreterProxy instantiateClass: interpreterProxy classByteArray indexableSize: self fileRecordSize. file := self fileValueOf: fileOop. interpreterProxy failed ifFalse: [self cCode: 'sqFileFdOpen(file, fd, writeFlag)' inSmalltalk: [file]]. ^ fileOop! Item was changed: + ----- Method: FilePlugin>>fileOpenFile:write: (in category 'private') ----- - ----- Method: FilePlugin>>fileOpenFile:write: (in category 'private - pharo') ----- fileOpenFile: cfile write: writeFlag "Open the FILE* as file. Answer the file oop." | file fileOop | - <option: #PharoVM> <var: #file type: 'SQFile *'> <var: 'cfile' type: 'FILE *'> <export: true> fileOop := interpreterProxy instantiateClass: interpreterProxy classByteArray indexableSize: self fileRecordSize. file := self fileValueOf: fileOop. interpreterProxy failed ifFalse: [self cCode: 'sqFileFileOpen(file, cfile, writeFlag)' inSmalltalk: [file]]. ^ fileOop! Item was changed: + ----- Method: FilePlugin>>primitiveFileOpenUseFile (in category 'file primitives') ----- - ----- Method: FilePlugin>>primitiveFileOpenUseFile (in category 'pharo primitives') ----- primitiveFileOpenUseFile + "Open the file with the supplied FILE* and writeFlag. + FILE* must be supplied in a byte object (ByteArray) with the platform address size. + writeFlag must be a boolean." | writeFlag cfileOop cfile filePointer | - <option: #PharoVM> <var: 'cfile' type: 'FILE* '> <export: true> writeFlag := interpreterProxy booleanValueOf: (interpreterProxy stackValue: 0). cfileOop := interpreterProxy stackValue: 1. (((interpreterProxy isBytes: cfileOop) and: [(interpreterProxy byteSizeOf: cfileOop) = self cfileRecordSize])) ifFalse: [^interpreterProxy primitiveFailFor: PrimErrBadArgument]. cfile := interpreterProxy firstIndexableField: cfileOop. interpreterProxy failed ifFalse: [filePointer := self fileOpenFile: cfile write: writeFlag]. interpreterProxy failed ifFalse: [^interpreterProxy pop: 3 "rcvr, name, writeFlag" thenPush: filePointer]. ^interpreterProxy primitiveFail.! Item was changed: + ----- Method: FilePlugin>>primitiveFileOpenUseFileDescriptor (in category 'file primitives') ----- - ----- Method: FilePlugin>>primitiveFileOpenUseFileDescriptor (in category 'pharo primitives') ----- primitiveFileOpenUseFileDescriptor + "Open the file with the supplied file descriptor and writeFlag. + fileDescriptor must be an integer. + writeFlag must be a boolean." | writeFlag fdPointer fd filePointer | - <option: #PharoVM> <var: 'fd' type: 'int'> <export: true> writeFlag := interpreterProxy booleanValueOf: (interpreterProxy stackValue: 0). fdPointer := interpreterProxy stackValue: 1. (interpreterProxy isIntegerObject: fdPointer) ifFalse: [^ interpreterProxy primitiveFailFor: PrimErrBadArgument]. fd := interpreterProxy integerValueOf: fdPointer. filePointer := self fileOpenFd: fd write: writeFlag. interpreterProxy failed ifFalse: [^interpreterProxy pop: 3 "rcvr, name, writeFlag" thenPush: filePointer]. ^interpreterProxy primitiveFail.! |
Free forum by Nabble | Edit this page |