libera/#commonlisp - IRC Chatlog
Search
14:10:04
Bike
is there a way with CFFI's defbitfield/grovel bitfield to handle multiple-bit fields? a "flag" takes up two bits and has four distinct states in my case.
14:10:19
Bike
obviously i could break it into multiple binary fields, but then it doesn't match the C API
14:22:10
_death
like (:foo #x1100) .. cffi:foreign-bitfield-value may work as expected, though cffi:foreign-bitfield-symbols would not.. basically there's no support for such a thing afaik
14:24:11
Bike
yitzi: more or less. the C is like { LLVMDIFlagPrivate=1, LLVMDIFlagProtected=2, LLVMDIFlagPublic=3, LLVMDIFlagFwdDecl = 1 << 2, LLVMDIFlagAppleBlock = 1 << 3, etc } with the etc being more actual flags
14:33:11
yitzi
Bike: I think you could use defcenum and defbitfield separately then combine with translate-to-foreign/translation-from-foreign
16:47:11
mfiano
Bike: I'm not sure if this helps. Maybe I misinterpretted your question: https://git.mfiano.net/mfiano/freebsd-ffi/src/branch/main/src/ffi-enums.lisp#L5
17:45:12
Bike
apparently i need to brush up on cffi use generally, because for some reason the grovel bitfield is defining every field as -1
17:47:03
Bike
is there a way to look at the temporary c and lisp files the groveler makes? or should i look for a problem elsewhere?
18:35:30
utis
i'm getting an error from charms when i've closed a tmux window and reconnected: (cl-charms::%cehck-status -1 :error-message "Error in curses call from function cl-charms/low-level:mvwaddstr (received err).") does anyone happen to know what the problem is?
18:36:33
utis
(i.e. i've closed the terminal window and expected that that shouldn't affect the tmux pane)
22:46:47
ashln
I'd like to read a constant number of bytes from a stream (or until EOF), like the interface provided by read(2). Is the only interface to binary file reading to do so one byte at a time with read-byte?