IRC channel logs

2021-07-04.log

back to list of logs

<rlb>wingo: nevermind - the #nil handling is still broken in main, I had unwittingly left my patch applied to the working tree. The make-struct/no-tail issue appears to be new (after 3.0.7).
***Noisytoot is now known as N7t
***N7t is now known as Noisytoot
<dsmith>sneek: botsnack
<sneek>:)
<dsmith>!uptime
<sneek>I've been running for 2 days
<sneek>This system has been up 2 days, 15 hours, 48 minutes
***zap1 is now known as zap
<leoprikler>given a SCM UTF-8 string, is there an "easy" way to determine the byte offset (and possibly count) of the char at a given (char) offset?
<rlb>On the C side or scheme side?
<leoprikler>I'll take either
<leoprikler>For context, I plan to (indirectly) use a library, that uses C-style strings and byte offsets, whereas any Scheme API would use char offsets to be useful
<rlb>On the C side If you're OK with null termination, then perhaps u8_strlen or u8_strnlen: https://www.gnu.org/software/libunistring/manual/libunistring.html#Elementary-string-functions-on-NUL-terminated-strings. Otherwise (not as "easy", fsvo "easy"), you can loop via u8_mblen, etc.: https://www.gnu.org/software/libunistring/manual/libunistring.html#Elementary-string-functions
<rlb>Though iirc I think I discovered that u8_next() (also in the null terminated section), might not actually care about nulls, and is a bit easier to use than the corresponding non-null-term function. Might not be something you'd want to rely on, though.
<rlb>But if you're writing this as an extension (outside guile), I suppose you might or might not want to depend on libunicode.
<leoprikler>perhaps not, but within the context of a guile extension it might still make sense to use libunicode
<leoprikler>do I understand this correctly, that I'd basically loop over u8_next() and then subtract new_ptr - old_ptr?
<leoprikler>it'd still be nice if I could instead determine the width by… say code point
<leoprikler>e.g. code point < 128 → 1 byte and so on
<rlb>Right, or you could keep two counts, or... i.e. you just use the iterators to skip ahead the right amount for each char, assuming it's valid. Though iirc u8_next may not have comparable error handling...
***iskarian is now known as Guest7348
<rlb>wingo: tracked down the commit introducing the "Unbound variable: make-struct/no-tail" lokke compilation failure and filed a bug: https://debbugs.gnu.org/49404 I don't understand the situation well enough to pursue it further myself atm, but happy to assist if I can.