Creating ByteArrays in C primitives
Brian Rice
water at tunes.org
Wed Oct 20 08:11:58 PDT 2004
On Oct 20, 2004, at 4:05 AM, Paul Dufresne wrote:
> Does the fact that result being declared of type ByteArray pointer,
> will make it throw an error if buffer is not word-aligned? (Slate
> pointers
> being 31 bits, they should not be used with pointers with 1 at bit0).
I don't know. I can tell you that Slate will crash hard if you try to
make an object that is not word-aligned.
> Also, does this have been included in CVS? If so, in which file?
It's in src/mobius/vm/base/object.slate next to the other method for
making byte arrays (one suitable only for pidgin).
> ----Original Message Follows----
> From: "Lendvai Attila" <Attila.Lendvai at netvisor.hu>
> I've got a pidgin function:
>
> oh@(ObjectHeap pointer) newByteArrayFrom: buffer sized: bytes
> "Creates a new slate ByteArray object and initializes from the given
> buffer."
> [| result!(ByteArray pointer) buffer!(Byte pointer) |
> result: (oh newByteArray: ByteArrayProto sized: bytes)!(ByteArray
> pointer) cast.
> buffer copyBytes: bytes into: (result elements)!(Byte pointer).
> result
> ]!(ByteArray pointer) inline export.
>
>
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1290 bytes
Desc: not available
Url : /archives/slate/attachments/20041020/bdea7374/attachment.bin
More information about the Slate
mailing list