[squeak-dev] FFI: FFI-Kernel-mt.120.mcz
Marcel Taeumel
marcel.taeumel at hpi.de
Mon Apr 26 06:31:41 UTC 2021
Hi Jakob,
aha! Thanks for the "pointer." :-) *scnr*
Best,
Marcel
Am 24.04.2021 14:23:42 schrieb Jakob Reschke <jakres+squeak at gmail.com>:
<commits at source.squeak.org [mailto: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/20110511-00/?p=10693]
https://devblogs.microsoft.com/oldnewthing/20091008-00/?p=16443 [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/20210426/79c1f61e/attachment.html>
More information about the Squeak-dev
mailing list
|