ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.20.5 | Fund Crystal's development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
bjz has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 255 seconds]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 245 seconds]
<crystal-gh> [crystal] mjago closed pull request #3962: Make links of hyperlinks (documentation) (master...master) https://git.io/vDLCf
<DeBot> https://github.com/crystal-lang/crystal/pull/3962 (Make links of hyperlinks (documentation))
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 240 seconds]
Raimondi has quit [Ping timeout: 260 seconds]
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang
Raimondi has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
greengriminal has joined #crystal-lang
_whitelogger has joined #crystal-lang
_whitelogger has joined #crystal-lang
bungoman has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 245 seconds]
A124 has quit [Ping timeout: 255 seconds]
bjz has quit [Ping timeout: 240 seconds]
bjz has joined #crystal-lang
bjz has quit [Ping timeout: 256 seconds]
bjz_ has joined #crystal-lang
triangles has joined #crystal-lang
greengriminal has quit [Quit: This computer has gone to sleep]
A124 has joined #crystal-lang
A124 has quit [Client Quit]
A124 has joined #crystal-lang
soveran has joined #crystal-lang
bjz_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 260 seconds]
Raimondii is now known as Raimondi
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 240 seconds]
triangles has quit [Quit: Leaving]
A124 has quit [Ping timeout: 240 seconds]
bjz_ has quit [Ping timeout: 255 seconds]
A124 has joined #crystal-lang
bjz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
soveran has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
A124 has quit [Ping timeout: 248 seconds]
A124 has joined #crystal-lang
danielpclark has quit [Remote host closed the connection]
<jokke> hey
<jokke> i'm trying to write c bindings for gpgme but i'm struggling with mapping structs...
<jokke> for some reason the struct seems to be filled with rubbish
<jokke> as seen in the screenshot
<jokke> any ideas what i might be doing wrong?
greengriminal has joined #crystal-lang
<jokke> ah
<jokke> i think i'm missing the default values
<jokke> not sure how to implement that in crystal though
<jokke> on the other hand revoked, expired etc should be 0
<jokke> the default seems to be 1
<jokke> so the c lib should've set them to 1
<jokke> s/1/0/
<BlaXpirit> jokke, do you see those ": 1" everywhere?
<jokke> yeah
<BlaXpirit> i think it means the variable takes 1 bit
<jokke> waat
<jokke> never seen that before!
<jokke> how on earth am i supposed to map that in crystal?
<BlaXpirit> jokke, maybe map all of those as uint32 and work with bit masks manually
<jokke> yeah... :/
<BlaXpirit> i mean as ONE uint32, together with _unused it adds up to 32
<jokke> how?
<BlaXpirit> how what
<jokke> i only count 11
<BlaXpirit> there is also this but i think it's different https://crystal-lang.org/docs/syntax_and_semantics/attributes.html#packed
<BlaXpirit> jokke, 1*11 + 21
<jokke> where does the 21 come from?
<jokke> ah
<BlaXpirit> unsigned int _unused : 21
<jokke> ok
<jokke> yeah
<jokke> this is gonna get interesting :D
<BlaXpirit> jokke, something like this: `macro get_bit(i); (@bits >> (31 - {{i}})) & 1; end`
<BlaXpirit> might need something different for big endian, i dont know at this point..
<jokke> BlaXpirit: do you think revoked is the msb or lsb?
<BlaXpirit> i think it depends on endianness but the code i wrote is meant to get revoked as get_bit(0)
<jokke> yeah i was just thinking if i could map it to an enum
<BlaXpirit> my guess is the bit order is the opposite of what enum uses
<jokke> yeah mine too
<jokke> C99 §6.7.2.1, paragraph 10 says: "The order of allocation of bit-fields within a unit (high-order to low-order or low-order to high-order) is implementation-defined."
<jokke> great...
<jokke> so i'll need to write some c code to access the fields
<RX14> BlaXpirit, there's already a .bit call on Number
<jokke> RX14: but since i can't know in what order the fields are i need to write accessors in c...
<RX14> i'm pretty sure thats just a spec detail you can ignore
<jokke> RX14: hm?
<RX14> treat it as if they're in order and it'll work
<jokke> hmm
<RX14> it'll be ABI-specific
<jokke> ok
<RX14> so anything thyat works on x86 linux will work on x86 linux
<RX14> at least
<RX14> so you don't really have to think about it
<jokke> so if i were to map the bits to an enum with @[Flags] how would i do that?
<RX14> it's an optimization opportunity in the spec which I don't think compilers take advantage of
<RX14> @[Flags] enum Foo : Int32
<RX14> list the fields with the correct names in order
<RX14> then write a test for it
<RX14> well test it at least
<RX14> because I could be wrong, although i'm 99% sure
<jokke> kk
<jokke> isn't enum Int32 by default?
<RX14> best to specify
<jokke> k
<RX14> just in case
vikaton has joined #crystal-lang
<jokke> works!
DeBot has quit [Remote host closed the connection]
DeBot has joined #crystal-lang
soveran has quit [Remote host closed the connection]
sz0 has joined #crystal-lang
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
dannyAAM has quit [Quit: znc.saru.moe : ZNC 1.6.2 - http://znc.in]
dannyAAM has joined #crystal-lang
danielpclark has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has quit [Ping timeout: 240 seconds]
Yxhuvud has quit [Remote host closed the connection]
Yxhuvud has joined #crystal-lang
vikaton has quit [Quit: Connection closed for inactivity]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cosepinyari has joined #crystal-lang
sz0 has quit [Quit: Connection closed for inactivity]
cosepinyari has quit [Quit: -a- IRC for Android 2.1.22]
bjz has joined #crystal-lang
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
poikon has quit [Ping timeout: 252 seconds]
FromGitter has quit [Ping timeout: 256 seconds]
poikon has joined #crystal-lang
FromGitter has joined #crystal-lang
matp has quit [Remote host closed the connection]
matp has joined #crystal-lang