[Vm-dev] VM Maker: VMMaker.oscog-eem.2347.mcz
Levente Uzonyi
leves at caesar.elte.hu
Wed Mar 7 23:44:45 UTC 2018
On Wed, 7 Mar 2018, commits at source.squeak.org wrote:
>
> Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2347.mcz
>
snip
> Item was changed:
> ----- Method: FilePlugin>>primitiveConnectToFile (in category 'file primitives') -----
> primitiveConnectToFile
> "Connect to 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 and compatible with the existing file access."
> | writeFlag cfileOop cfile filePointer |
> + <var: 'cfile' type: #'void *'>
> - <var: 'cfile' type: 'void* '>
> <export: true>
> + writeFlag := interpreterProxy booleanValueOf: (interpreterProxy stackValue: 0).
> - writeFlag := interpreterProxy
> - booleanValueOf: (interpreterProxy stackValue: 0).
It should be checked here if the primitive has failed or not, shouldn't
it?
> cfileOop := interpreterProxy stackValue: 1.
> cfile := self pointerFrom: cfileOop.
> cfile ifNil:
> [^interpreterProxy primitiveFailFor: PrimErrBadArgument].
> filePointer := self connectToFile: cfile write: writeFlag.
> interpreterProxy failed ifFalse:
> + [interpreterProxy pop: 3 "rcvr, name, writeFlag"
> + thenPush: filePointer]!
> - [^interpreterProxy pop: 3 "rcvr, name, writeFlag"
> - thenPush: filePointer].
> - ^interpreterProxy primitiveFail.!
>
> Item was changed:
> ----- Method: FilePlugin>>primitiveConnectToFileDescriptor (in category 'file primitives') -----
> primitiveConnectToFileDescriptor
> "Connect to the existing file identified by fileDescriptor.
> fileDescriptor must be an integer.
> writeFlag is aboolean indicating whether to open in read or write mode and must be compatible with the existing file access."
> | writeFlag fdPointer fd filePointer |
> + <var: 'fd' type: #int>
> - <var: 'fd' type: 'int'>
> <export: true>
> writeFlag := interpreterProxy
> booleanValueOf: (interpreterProxy stackValue: 0).
Same as above.
Levente
> fdPointer := interpreterProxy stackValue: 1.
> (interpreterProxy isIntegerObject: fdPointer)
> ifFalse: [^ interpreterProxy primitiveFailFor: PrimErrBadArgument].
> fd := interpreterProxy integerValueOf: fdPointer.
> filePointer := self connectToFd: fd write: writeFlag.
> + interpreterProxy failed ifFalse:
> + [interpreterProxy pop: 3 "rcvr, name, writeFlag"
> + thenPush: filePointer]!
> - interpreterProxy failed
> - ifFalse: [^interpreterProxy pop: 3 "rcvr, name, writeFlag"
> - thenPush: filePointer].
> - ^interpreterProxy primitiveFail.!
More information about the Vm-dev
mailing list