Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2458.mcz==================== Summary ====================
Name: VMMaker.oscog-eem.2458
Author: eem
Time: 15 October 2018, 5:46:57.236688 pm
UUID: 48c3dc2d-47b2-4834-aeca-83e4c8cebf3e
Ancestors: VMMaker.oscog-eem.2457
InterpreterPrimitives
Rewrite the getenv: simulation so that the original primitiveGetenv can be used.
=============== Diff against VMMaker.oscog-eem.2457 ===============
Item was changed:
----- Method: InterpreterPrimitives>>getenv: (in category 'simulation support') -----
getenv: aByteStringOrByteArray
<doNotGenerate>
+ "The primitiveGetenv: primitive answers nil for undefined variables.
+ The primitiveGetenv implementation is written to expect getenv: to
+ answer 0, not nil, for undefined variables. Map nil to 0 for simulation."
+ ^(self primitiveGetenv: aByteStringOrByteArray) ifNil: [0]!
- <primitive: 'primitiveGetenv' module: '' error: ec>
- ec == #'bad argument' ifTrue:
- [aByteStringOrByteArray isString ifFalse:
- [^self getenv: aByteStringOrByteArray asString]].
- self primitiveFail!
Item was changed:
----- Method: InterpreterPrimitives>>primitiveGetenv (in category 'other primitives') -----
primitiveGetenv
"Access to environment variables via getenv. No putenv or setenv as yet."
| key var result |
<export: true>
<var: #key type: #'char *'>
<var: #var type: #'char *'>
sHEAFn ~= 0 ifTrue: "secHasEnvironmentAccess"
[self sHEAFn ifFalse: [^self primitiveFailFor: PrimErrInappropriate]].
key := self cStringOrNullFor: self stackTop.
key = 0 ifTrue:
[self successful ifTrue:
[^self primitiveFailFor: PrimErrBadArgument].
^self primitiveFailFor: primFailCode].
+ var := self getenv: (self cCode: [key] inSmalltalk: [key allButLast]).
- var := (self getenv: (self cCode: [key] inSmalltalk: [key allButLast])) ifNil: [0].
self free: key.
var ~= 0 ifTrue:
[result := objectMemory stringForCString: var.
result ifNil:
[^self primitiveFailFor: PrimErrNoMemory]].
self assert: primFailCode = 0.
self pop: 2 thenPush: (var = 0 ifTrue: [objectMemory nilObject] ifFalse: [result])!
Item was added:
+ ----- Method: InterpreterPrimitives>>primitiveGetenv: (in category 'simulation support') -----
+ primitiveGetenv: aByteStringOrByteArray
+ <doNotGenerate>
+ <primitive: 'primitiveGetenv' module: '' error: ec>
+ ec == #'bad argument' ifTrue:
+ [aByteStringOrByteArray isString ifFalse:
+ [^self getenv: aByteStringOrByteArray asString]].
+ self primitiveFail!