[squeak-dev] FFI: FFI-Kernel-mt.120.mcz
Jakob Reschke
jakres+squeak at gmail.com
Sat Apr 24 12:23:19 UTC 2021
<commits at source.squeak.org> schrieb am Di., 20. Apr. 2021
>
> Item was changed:
> + ----- Method: ExternalData>>fromCStrings (in category 'converting -
> support') -----
> - ----- Method: ExternalData>>fromCStrings (in category 'converting') -----
> fromCStrings
> "Assume that the receiver represents a set of C strings and is
> teerminated by a empty string and convert it to a Smalltalk ordered
> collection of strings"
>
> | stream index char strings str |
> type isPointerType ifFalse: [self error: 'External object is not a
> pointer type.'].
> + self flag: #bogus. "mt: This format seems to be rather specific to
> some library. There would normally be pointers to pointers for such a
> structure. Or does the C standard mention such a format somehow?
> 'abcd\0efg\0hijklmnopq\0rstuvwxyz\0\0' ??? "
> strings := OrderedCollection new.
> index := 1.
> [
> stream := WriteStream on: String new.
> [(char := handle unsignedCharAt: index) = 0 asCharacter]
> whileFalse: [
> stream nextPut: char.
> index := index + 1
> ].
> str := stream contents.
> strings addLast: str.
> str size = 0
> ] whileFalse.
> ^strings!
>
Seems to be an API specific thing:
https://devblogs.microsoft.com/oldnewthing/20110511-00/?p=10693
https://devblogs.microsoft.com/oldnewthing/20091008-00/?p=16443
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210424/229df395/attachment.html>
More information about the Squeak-dev
mailing list
|