IRC channel logs

2026-06-21.log

back to list of logs

<dariqq>Hi, i am parsing binary data and the file is always using big-endian. I am currently using parse-c-struct but it uses native endianness. is there a way to specify endianness without parsing it myself?
<mwette>dariqq: Doesn't look like it. parse-c-struct uses the '-native-' bytevector calls. Is it from a different machine architecture? I have a parser that handles that.
<mwette> https://github.com/mwette/guile-cdata
<dariqq>annoying. It is a binary file format that uses big-endian for everything including (big endian) c-structs for metadata sections. (right now) these are simple enough to parse manually but maybe this could be a feature request
<mwette>File an issue on codeberg.org/guile/guile.
<old>dariqq: I _think_ you can try with %host-type
<old>From system base target
<old>(with-fluid %target-type "powerpc-unknown-linux-gnu" (lambda () (parse-c-struct ... )))
<old>But that's kind of a hack
<old>feels weird to use powerpc to emulate big endian decoding
<dariqq>i used (with-target "sparc64-unknown-linux-gnu" ...) but now it epects big endian GO files: "In procedure load-thunk-from-memory: ELF file does not have native byte order". Also not sure if that works because the native-endianness and bytevector- set/ref functions are all defined in C.
<dariqq>I found a workaround for now by creating make-c-struct*, parse-c-struct* that take an endianness parameter defaulting to native
<graywolf>Hello :) Is there some documented way do extract argument from exception created via (error)? It seems I can use exception-irritants, but since it is not actually documented, I do not know whether I should.
<mwette>dariqq: Can you tell us the context? It machine based or something else (e.g., packed/unpacked network protocol)?
<dariqq>mwette: Parsing the binary format of property lists
<dariqq>And i guess it is big endian because it originated on powerpc Macs
<identity>graywolf: WDYM by «it is not actually documented»?
<graywolf>Maybe I was looking wrong? But the fact that (error
<graywolf>(error) creates a compound condition, with one member being exception-with-irritants, seems to not be documented
<graywolf>Again, maybe I failed perception saving throw during my search in the manual.
<mwette>dariqq: thanks
<identity>graywolf: it seems the fact that the arguments are the irritants is not mentioned explicitly in the manual, but i would be heavily surprised if that was not silently implied, especially considering that the R⁶RS error *does* call the arguments ‹irritant›s
<ampinga>hi everyone,
<ampinga>I try to write my first GUI program using guile and g-golf. how should I make the #! first line part to be customizable like it point to the guile of user automatically?
<identity>ampinga: see (info "(guile) Guile Scripting")
<ampinga>identity: okay, I think I have a few idea now
<mwette>I like #!/bin/sh\n ... \nexec guile $0 "$@"\n!# if that makes sense.
<daviid>sneel later tell ampinga g-golf comes with quite a few examples, all actually show how to ...
<daviid>sneek later tell ampinga g-golf comes with quite a few examples, all actually show how to ...
<sneek>Got it.
<daviid>sneek later tell ampinga and the manual also has a scripting entry ... I recommend (a) you carefully read "Getting Started with G-Golf", all sections and (b) to use libawaita, only use gtk for what's not provided by libadwaita - also carefully look at the adwaita-1-demo (and run it, explore all its pages ...
<sneek>Okay.