[Vm-beginners] Return strings in numeric primitives

David Leonhardt davidleonhardt at gmail.com
Tue Jul 3 03:04:40 UTC 2012


Thank you all !!


This is de code I made. It seems to work:

primitiveHelloWorld
| stringOop stringPtr size |
 <var: 'stringPtr' type: 'char*'>
 size := 11.
stringOop := self instantiateClass: self classString indexableSize: size.
stringPtr := self firstIndexableField: stringOop.
 0 to: size-1 do:[ :i | stringPtr at: i put: ('Hello World' at: i) ].
 self pop:1 thenPush: stringOop.

I had to use push, ^ not work at the same way.

Best regards,
David.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-beginners/attachments/20120703/9ae14aa2/attachment.htm


More information about the VM-beginners mailing list