Eliot Miranda uploaded a new version of FileAttributesPlugin to project VM Maker: http://source.squeak.org/VMMaker/FileAttributesPlugin.oscog-eem.56.mcz ==================== Summary ==================== Name: FileAttributesPlugin.oscog-eem.56 Author: eem Time: 6 September 2020, 9:14:39.365605 am UUID: b6bd12ab-9540-4cea-9032-a39fb4fb7308 Ancestors: FileAttributesPlugin.oscog-eem.55 Fix regression in FileAttributesPlugin>>primitiveFileMasks in Pharo images. Only Squeak/Cuis can expect WordArray to be present in the specialObjctsArray. Pharo is missing out on native support for the four widths of non-obhect array, but that's its perogative, and the Vm has to remain backward-compatible. Mea culpa. =============== Diff against FileAttributesPlugin.oscog-eem.55 =============== Item was changed: ----- Method: FileAttributesPlugin>>primitiveFileMasks (in category 'file primitives') ----- primitiveFileMasks + "Answer an array (or word array) of well known file masks" - "Answer an array of well known file masks" + self cppIf: PharoVM + ifTrue: [self primitiveFileMasksAsArray] + ifFalse: [self primitiveFileMasksAsWordArray]! - | masksObj masks | - <export: true> - masksObj := interpreterProxy instantiateClass: interpreterProxy classWordArray indexableSize: 8. - masksObj ifNil: [^interpreterProxy primitiveFailFor: PrimErrNoMemory]. - masks := self cCoerceSimple: (interpreterProxy firstIndexableField: masksObj) to: #'int *'. - masks at: 0 put: (self cCode: [#S_IFMT] inSmalltalk: [16rF000]). - - self cppIf: #S_IFSOCK defined ifTrue: - [masks at: 1 put: (self cCode: [#S_IFSOCK] inSmalltalk: [16rC000])]. - - self cppIf: #S_IFLNK defined ifTrue: - [masks at: 2 put: (self cCode: [#S_IFLNK] inSmalltalk: [16rA000])]. - - masks at: 3 put: (self cCode: [#S_IFREG] inSmalltalk: [16r8000]). - - self cppIf: #S_IFBLK defined ifTrue: - [masks at: 4 put: (self cCode: [#S_IFBLK] inSmalltalk: [16r6000])]. - - masks at: 5 put: (self cCode: [#S_IFDIR] inSmalltalk: [16r4000]). - - masks at: 6 put: (self cCode: [#S_IFCHR] inSmalltalk: [16r2000]). - - self cppIf: #S_IFIFO defined ifTrue: - [masks at: 7 put: (self cCode: [#S_IFIFO] inSmalltalk: [16r1000])]. - - interpreterProxy methodReturnValue: masksObj! Item was added: + ----- Method: FileAttributesPlugin>>primitiveFileMasksAsArray (in category 'file primitives') ----- + primitiveFileMasksAsArray + "Answer an array of well known file masks" + + <notOption: #PharoVM> + <inline: #always> + | masksArray masks nilObj | + masksArray := interpreterProxy instantiateClass: interpreterProxy classArray indexableSize: 8. + masksArray ifNil: [^interpreterProxy primitiveFailFor: PrimErrNoMemory]. + + masks := self cCoerceSimple: (interpreterProxy firstIndexableField: masksArray) to: #'sqInt *'. + nilObj := interpreterProxy nilObject. + + self cppIf: #S_IFSOCK defined + ifTrue: [masks at: 1 put: (interpreterProxy integerObjectOf: (self cCode: [#S_IFSOCK] inSmalltalk: [16rC000]))] + ifFalse: [masks at: 1 put: nilObj]. + + self cppIf: #S_IFLNK defined + ifTrue: [masks at: 2 put: (interpreterProxy integerObjectOf: (self cCode: [#S_IFLNK] inSmalltalk: [16rA000]))] + ifFalse: [masks at: 1 put: nilObj]. + + masks at: 3 put: (interpreterProxy integerObjectOf: (self cCode: [#S_IFREG] inSmalltalk: [16r8000])). + + self cppIf: #S_IFBLK defined + ifTrue: [masks at: 4 put: (interpreterProxy integerObjectOf: (self cCode: [#S_IFBLK] inSmalltalk: [16r6000]))] + ifFalse: [masks at: 1 put: nilObj]. + + masks at: 5 put: (interpreterProxy integerObjectOf: (self cCode: [#S_IFDIR] inSmalltalk: [16r4000])). + + masks at: 6 put: (interpreterProxy integerObjectOf: (self cCode: [#S_IFCHR] inSmalltalk: [16r2000])). + + self cppIf: #S_IFIFO defined + ifTrue: [masks at: 7 put: (interpreterProxy integerObjectOf: (self cCode: [#S_IFIFO] inSmalltalk: [16r1000]))] + ifFalse: [masks at: 1 put: nilObj]. + + interpreterProxy methodReturnValue: masksArray! Item was added: + ----- Method: FileAttributesPlugin>>primitiveFileMasksAsWordArray (in category 'file primitives') ----- + primitiveFileMasksAsWordArray + "Answer an array of well known file masks" + + <notOption: #PharoVM> + <inline: #always> + | masksObj masks | + masksObj := interpreterProxy instantiateClass: interpreterProxy classWordArray indexableSize: 8. + masksObj ifNil: [^interpreterProxy primitiveFailFor: PrimErrNoMemory]. + masks := self cCoerceSimple: (interpreterProxy firstIndexableField: masksObj) to: #'int *'. + masks at: 0 put: (self cCode: [#S_IFMT] inSmalltalk: [16rF000]). + + self cppIf: #S_IFSOCK defined ifTrue: + [masks at: 1 put: (self cCode: [#S_IFSOCK] inSmalltalk: [16rC000])]. + + self cppIf: #S_IFLNK defined ifTrue: + [masks at: 2 put: (self cCode: [#S_IFLNK] inSmalltalk: [16rA000])]. + + masks at: 3 put: (self cCode: [#S_IFREG] inSmalltalk: [16r8000]). + + self cppIf: #S_IFBLK defined ifTrue: + [masks at: 4 put: (self cCode: [#S_IFBLK] inSmalltalk: [16r6000])]. + + masks at: 5 put: (self cCode: [#S_IFDIR] inSmalltalk: [16r4000]). + + masks at: 6 put: (self cCode: [#S_IFCHR] inSmalltalk: [16r2000]). + + self cppIf: #S_IFIFO defined ifTrue: + [masks at: 7 put: (self cCode: [#S_IFIFO] inSmalltalk: [16r1000])]. + + interpreterProxy methodReturnValue: masksObj! |
Free forum by Nabble | Edit this page |