[Vm-dev] VM Maker: VMMaker.oscog-akg.2466.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Oct 19 09:23:33 UTC 2018
Alistair Grant uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-akg.2466.mcz
==================== Summary ====================
Name: VMMaker.oscog-akg.2466
Author: akg
Time: 19 October 2018, 11:22:03.527998 am
UUID: 5b9d1c96-2ed0-4621-809b-8d0d954099c1
Ancestors: VMMaker.oscog-AlistairGrant.2465
VMMaker Unicode strings
Add VMClass>>asByteArray:size:.
Modify:
- FilePluginSimulator>>fileOpenName:size:write:secure:
- FilePluginSimulator>>fileOpenNewName:size:secure:
to utf8Decode the paths supplied by the in-simulation image. This is required otherwise the simulation, which uses the same code, will attempt to reencode the string with utf8, corrupting the file name.
=============== Diff against VMMaker.oscog-AlistairGrant.2465 ===============
Item was changed:
----- Method: FilePluginSimulator>>fileOpenName:size:write:secure: (in category 'file primitives') -----
fileOpenName: nameIndex size: nameSize write: writeFlag secure: secureFlag
"Open the named file, possibly checking security. Answer the file oop."
| path f index |
openFiles size >= maxOpenFiles ifTrue:
[^interpreterProxy primitiveFailFor: PrimErrLimitExceeded].
+ path := (interpreterProxy asByteArray: nameIndex size: nameSize) utf8Decoded.
- path := interpreterProxy asString: nameIndex size: nameSize.
f := writeFlag
ifTrue: [FileStream fileNamed: path]
ifFalse:
[(StandardFileStream isAFileNamed: path) ifTrue:
[FileStream readOnlyFileNamed: path]].
f ifNil: [^interpreterProxy primitiveFail].
f binary.
index := (3 to: openFiles size + 1) detect: [:n| (openFiles includesKey: n) not].
openFiles at: index put: f.
^interpreterProxy integerObjectOf: index!
Item was changed:
----- Method: FilePluginSimulator>>fileOpenNewName:size:secure: (in category 'file primitives') -----
fileOpenNewName: nameIndex size: nameSize secure: secureFlag
"Open the new named file, possibly checking security. Answer the file oop."
| path f index |
openFiles size >= maxOpenFiles ifTrue:
[^interpreterProxy primitiveFailFor: PrimErrLimitExceeded].
+ path := (interpreterProxy interpreter asByteArray: nameIndex size: nameSize) utf8Decoded.
- path := interpreterProxy interpreter asString: nameIndex size: nameSize.
"the #defaultAction for FileExistsException creates a dialog,
so it is caught and resignaled as a generic Error"
[f := FileStream newFileNamed: nameIndex]
on: FileExistsException
do: [:error | ^ interpreterProxy primitiveFailFor: PrimErrInappropriate].
f ifNil: [^interpreterProxy primitiveFail].
f binary.
index := (3 to: openFiles size + 1) detect: [:n| (openFiles includesKey: n) not].
openFiles at: index put: f.
^interpreterProxy integerObjectOf: index!
Item was added:
+ ----- Method: VMClass>>asByteArray:size: (in category 'C library extensions') -----
+ asByteArray: baIndex size: baSize
+ "baIndex is an address in the heap. Create a ByteArray of the requested length
+ form the bytes in the heap starting at baIndex."
+ <doNotGenerate>
+ ^self strncpy: (ByteArray new: baSize) _: baIndex _: baSize!
More information about the Vm-dev
mailing list