Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2789.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.2789 Author: eem Time: 14 August 2020, 2:36:34.720705 pm UUID: 62e4213d-c35b-4aa0-8d16-49d19f53b989 Ancestors: VMMaker.oscog-eem.2788 Provide the InterpreterPlugin>>stackStringValue: convenience. Simplify and ake simulateable the SecurityPlugin using methodReturnString: =============== Diff against VMMaker.oscog-eem.2788 =============== Item was added: + ----- Method: InterpreterPlugin>>stackStringValue: (in category 'API access') ----- + stackStringValue: index + "Convenience to answer a given argument as a C string. + Fails if the argument is not a string or there is no memory." + <returnTypeC: #'char *'> + | obj sz dstPtr | + <var: 'dstPtr' type: #'char *'> + obj := interpreterProxy stackValue: index. + (interpreterProxy isBytes: obj) ifFalse: + [interpreterProxy primitiveFailFor: PrimErrBadArgument. + ^nil]. + sz := interpreterProxy byteSizeOf: obj. + dstPtr := self malloc: sz+1. + dstPtr ifNil: + [interpreterProxy primitiveFailFor: PrimErrNoCMemory. + ^nil]. + self memcpy: dstPtr _: (interpreterProxy firstIndexableField: obj) _: sz. + dstPtr at: sz put: 0. + ^dstPtr! Item was added: + ----- Method: SecurityPlugin>>ioCanWriteImage (in category 'simulation') ----- + ioCanWriteImage + <doNotGenerate> + ^true! Item was added: + ----- Method: SecurityPlugin>>ioDisableImageWrite (in category 'simulation') ----- + ioDisableImageWrite + <doNotGenerate>! Item was added: + ----- Method: SecurityPlugin>>ioGetSecureUserDirectory (in category 'simulation') ----- + ioGetSecureUserDirectory + <doNotGenerate> + ^SecurityManager default primSecureUserDirectory! Item was added: + ----- Method: SecurityPlugin>>ioGetUntrustedUserDirectory (in category 'simulation') ----- + ioGetUntrustedUserDirectory + <doNotGenerate> + ^SecurityManager default primUntrustedUserDirectory! Item was changed: ----- Method: SecurityPlugin>>primitiveCanWriteImage (in category 'primitives') ----- primitiveCanWriteImage <export: true> + interpreterProxy methodReturnBool: self ioCanWriteImage! - interpreterProxy pop: 1. - interpreterProxy pushBool: (self cCode:'ioCanWriteImage()' inSmalltalk:[true])! Item was changed: ----- Method: SecurityPlugin>>primitiveDisableImageWrite (in category 'primitives') ----- primitiveDisableImageWrite <export: true> + self ioDisableImageWrite! - self cCode: 'ioDisableImageWrite()'! Item was changed: ----- Method: SecurityPlugin>>primitiveGetSecureUserDirectory (in category 'primitives') ----- primitiveGetSecureUserDirectory "Primitive. Return the secure directory for the current user." + | dirName | - | dirName dirLen dirOop dirPtr | <export: true> + <var: #dirName type: #'char *'> + dirName := self ioGetSecureUserDirectory. + interpreterProxy failed ifFalse: + [interpreterProxy methodReturnString: dirName]! - <var: #dirName type: 'char *'> - <var: #dirPtr type: 'char *'> - dirName := self cCode: 'ioGetSecureUserDirectory()' inSmalltalk: [nil]. - (dirName == nil or:[interpreterProxy failed]) - ifTrue:[^interpreterProxy primitiveFail]. - dirLen := self strlen: dirName. - dirOop := interpreterProxy instantiateClass: interpreterProxy classString indexableSize: dirLen. - interpreterProxy failed ifTrue:[^nil]. - dirPtr := interpreterProxy firstIndexableField: dirOop. - 0 to: dirLen-1 do:[:i| - dirPtr at: i put: (dirName at: i)]. - interpreterProxy pop: 1 thenPush: dirOop.! Item was changed: ----- Method: SecurityPlugin>>primitiveGetUntrustedUserDirectory (in category 'primitives') ----- primitiveGetUntrustedUserDirectory "Primitive. Return the untrusted user directory name." + | dirName | - | dirName dirLen dirOop dirPtr | <export: true> + <var: #dirName type: #'char *'> + dirName := self ioGetUntrustedUserDirectory. + interpreterProxy failed ifFalse: + [interpreterProxy methodReturnString: dirName]! - <var: #dirName type: 'char *'> - <var: #dirPtr type: 'char *'> - dirName := self cCode:'ioGetUntrustedUserDirectory()' inSmalltalk:[nil]. - (dirName == nil or:[interpreterProxy failed]) - ifTrue:[^interpreterProxy primitiveFail]. - dirLen := self strlen: dirName. - dirOop := interpreterProxy instantiateClass: interpreterProxy classString indexableSize: dirLen. - interpreterProxy failed ifTrue:[^nil]. - dirPtr := interpreterProxy firstIndexableField: dirOop. - 0 to: dirLen-1 do:[:i| - dirPtr at: i put: (dirName at: i)]. - interpreterProxy pop: 1 thenPush: dirOop.! |
Free forum by Nabble | Edit this page |