[Vm-beginners] Return strings in numeric primitives

David Leonhardt davidleonhardt at gmail.com
Sat Jun 30 16:58:01 UTC 2012


For more details.

With this code, I get a string and return it.

self var: #stringObj declareC: 'int stringObj'.
self var: #stringPtr declareC: 'char *stringPtr'.
self var: #stringSize declareC: 'int stringSize'.
 stringObj := objectMemory stackValue: 0.
stringSize := objectMemory stSizeOf: stringObj.
stringPtr := self cCoerce: (objectMemory arrayValueOf: stringObj) to: 'char
*'.

But I can't replace stringObj := 'Hello World'. Why?



2012/6/30 David Leonhardt <davidleonhardt at gmail.com>

> Hey.
>
> I'm doing my own numeric primitive.
> I could return numeric values, doing something like:
>
>                    self pop: 1 thenPush: ( objectMemory integerObjectOf:
> 21 ).
>
> What I couldn't do is find a way to return a string, for example 'Hello
> World'.
>
>
> Thanks,
> David.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-beginners/attachments/20120630/568d275b/attachment.htm


More information about the VM-beginners mailing list