VM Maker: FileAttributesPlugin.oscog-akg.43.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: FileAttributesPlugin.oscog-akg.43.mcz

commits-2
 
Eliot Miranda uploaded a new version of FileAttributesPlugin to project VM Maker:
http://source.squeak.org/VMMaker/FileAttributesPlugin.oscog-akg.43.mcz

==================== Summary ====================

Name: FileAttributesPlugin.oscog-akg.43
Author: akg
Time: 24 October 2018, 7:58:57.494882 am
UUID: 858c0600-cb54-485c-a61f-0f504638709f
Ancestors: FileAttributesPlugin.oscog-akg.42

FileAttributesPlugin 2.0.5

More VM simulator fixes:

- #faCloseDirectory: handles invalid parameters better
- signal errors back to the simulated image rather than raising an error in the simulator

=============== Diff against FileAttributesPlugin.oscog-akg.42 ===============

Item was changed:
  ----- Method: FileAttributesPlugin>>versionString (in category 'version string') -----
  versionString
  "Answer a string containing the version string for this plugin."
  <inline: #always>
+ ^'2.0.5'!
- ^'2.0.4'!

Item was added:
+ ----- Method: FileAttributesPluginSimulator>>byteStringFromOop: (in category 'simulation support') -----
+ byteStringFromOop: anOop
+ "Answer a copy of the supplied ByteString Oop"
+
+ | sz array ptr |
+
+ sz := interpreterProxy stSizeOf: anOop.
+ ptr := interpreterProxy arrayValueOf: anOop.
+ array := ByteString new: sz.
+ self strncpy: array _: ptr _: sz.
+ ^array!

Item was changed:
  ----- Method: FileAttributesPluginSimulator>>classOf: (in category 'simulation support') -----
  classOf: anOop
 
  | clsOop |
 
  anOop = interpreterProxy nilObject ifTrue: [^UndefinedObject].
  clsOop := interpreterProxy fetchClassOf: anOop.
  clsOop = interpreterProxy classArray ifTrue: [^Array].
  clsOop = interpreterProxy classByteArray ifTrue: [^ByteArray].
+ clsOop = interpreterProxy classString ifTrue: [^ByteString].
  self error: 'unknown class'!

Item was changed:
  ----- Method: FileAttributesPluginSimulator>>faCloseDirectory: (in category 'simulation') -----
  faCloseDirectory: faPath
  "Simulate the the call by actually calling the primitive and discarding the stat information (which will be retrieved again later in the simulation)."
 
  | result status |
 
  result := self primClosedir: (self faPathPtr: faPath).
+ result isNumber ifFalse:
+ [faPath at: 3 put: nil.
- result ifNotNil: [
- faPath at: 3 put: nil.
  status := 0 ]
+ ifTrue:
+ [status := result < 0
+ ifTrue: [result]
+ ifFalse: [self unableToCloseDir]].
- ifNil: [status := self unexpectedError].
  ^status
  !

Item was changed:
  ----- Method: FileAttributesPluginSimulator>>fromOop: (in category 'simulation support') -----
  fromOop: anOop
 
  | cls |
 
  cls := self classOf: anOop.
  cls = UndefinedObject ifTrue: [^nil].
  cls = Array ifTrue: [^self arrayFromOop: anOop].
  cls = ByteArray ifTrue: [^self byteArrayFromOop: anOop].
+ cls = ByteString ifTrue: [^self byteStringFromOop: anOop].
  self error: 'Unknown class'.!

Item was changed:
  ----- Method: FileAttributesPluginSimulator>>signalError:for: (in category 'primitives') -----
  signalError: error for: aByteArray
  "In the simulation, just return the error code"
 
+ error ifNil: [ ^interpreterProxy primitiveFail ].
+ error isSymbol ifTrue: [ ^interpreterProxy primitiveFailFor:
+ ((SmalltalkImage current specialObjectsArray at: 52) indexOf: error) ].
- error ifNil: [ ^self primitiveFailed ].
- error isSymbol ifTrue: [ ^self primitiveFailed: error ].
  error isPrimitiveError ifFalse: [
  "We shouldn't ever get here"
  ^self primitiveFailed. ].
 
  ^error errorCode.
  !