00:10
jmdaemon has joined #crystal-lang
00:20
greenbigfrog has quit [Ping timeout: 246 seconds]
01:06
greenbigfrog has joined #crystal-lang
01:36
hightower2 has joined #crystal-lang
01:38
greenbigfrog has quit [Ping timeout: 252 seconds]
01:51
greenbigfrog has joined #crystal-lang
02:23
jmdaemon has quit [Ping timeout: 252 seconds]
02:27
jmdaemon has joined #crystal-lang
02:44
quazimodo has quit [Ping timeout: 252 seconds]
02:45
jmdaemon has quit [Ping timeout: 252 seconds]
02:46
quazimodo has joined #crystal-lang
02:59
hightower3 has joined #crystal-lang
03:02
hightower2 has quit [Ping timeout: 268 seconds]
04:26
jmdaemon has joined #crystal-lang
04:36
ur5us has quit [Ping timeout: 248 seconds]
06:47
<
SamantazFox >
Blacksmoke16 Cool, thanks :D
06:48
<
SamantazFox >
I'm wondering: what does `{{@type}}` does in all those macros?
08:06
ur5us has joined #crystal-lang
09:14
_ht has joined #crystal-lang
09:20
ur5us has quit [Ping timeout: 248 seconds]
09:43
_ht has quit [Quit: _ht]
10:03
_ht has joined #crystal-lang
10:05
_ht has quit [Remote host closed the connection]
10:06
_ht has joined #crystal-lang
10:43
ht_ has joined #crystal-lang
10:44
_ht has quit [Ping timeout: 256 seconds]
10:44
ht_ is now known as _ht
11:06
Sankalp has quit [Ping timeout: 252 seconds]
11:13
Sankalp has joined #crystal-lang
11:22
_ht has quit [Quit: _ht]
11:33
_ht has joined #crystal-lang
12:36
jmdaemon has quit [Ping timeout: 252 seconds]
12:39
Sankalp has quit [Ping timeout: 252 seconds]
12:47
Sankalp has joined #crystal-lang
13:18
<
FromGitter >
<Blacksmoke16> It's a workaround for a compiler bug
14:46
quazimodo has quit [Ping timeout: 252 seconds]
15:35
jmdaemon has joined #crystal-lang
16:05
jmdaemon has quit [Ping timeout: 260 seconds]
17:04
<
SamantazFox >
Blacksmoke16: Ok, thanks :)
17:04
jmdaemon has joined #crystal-lang
17:11
hightower3 has quit [Ping timeout: 268 seconds]
17:31
jmdaemon has quit [Ping timeout: 248 seconds]
17:32
hightower2 has joined #crystal-lang
19:13
<
FromGitter >
<jrei:matrix.org> Hi, what's the recommended way to convert a given `name : String` to `char name[80]`, which is defined in a lib C struct?
19:16
<
FromGitter >
<jrei:matrix.org> Also can `char name[80]` be translated to `name : Char[80]`? This means, I can allocate a `StaticArray(Char, 80)`, then iterate on the string with each_char to assign each char to the static array
19:17
<
FromGitter >
<Blacksmoke16> iirc isnt `char` actually `UInt8`?
19:21
<
mps >
CHAR_MIN CHAR_MAX
19:37
_ht has quit [Quit: _ht]
19:37
__ht has joined #crystal-lang
19:39
__ht is now known as _ht
19:54
<
FromGitter >
<jrei:matrix.org> Yes in C, I can check if the Char is ascii I suppose
19:54
jmdaemon has joined #crystal-lang
20:15
<
SamantazFox >
I'm confused
20:15
<
SamantazFox >
why is `type` not recognized as a variable here?
20:16
<
SamantazFox >
(I tried other names, same result)
20:16
<
FromGitter >
<Blacksmoke16> i think you want `@type <= type` and not `is_a?`
20:18
<
SamantazFox >
If `Foo` includes `Bar`, that makes `Bar` and ancestor of `Foo`?
20:18
<
FromGitter >
<Blacksmoke16> i think so yea
20:19
<
FromGitter >
<Blacksmoke16> other way around
20:20
<
FromGitter >
<Blacksmoke16> `Bar <= Foo` would be like "Is Foo included in Bar?"
20:20
<
SamantazFox >
ah, right!
20:21
<
SamantazFox >
but then, why `.is_a?` doesn't work?
20:22
<
SamantazFox >
it should always return false, no?
20:22
<
FromGitter >
<Blacksmoke16> prob same reason you cant pass a local var is `is_a?` in normal code
20:24
<
FromGitter >
<jrei:matrix.org> in my case maybe I could just check the size before passing it to the C struct...
20:24
<
FromGitter >
<Blacksmoke16> that would prob work, since `.to_slice` would have each codepoint in it
20:25
<
FromGitter >
<Blacksmoke16> then could use that slice to create the static array?
20:27
ur5us has joined #crystal-lang
20:50
<
FromGitter >
<jrei:matrix.org> I'm looking to an easy way, maybe we can cast
20:54
<
FromGitter >
<Blacksmoke16> does it have to be a static array?
20:56
<
FromGitter >
<Blacksmoke16> question then is what to do with the rest of the uninitialized static array if the string is less than 80 bytes?
20:57
<
FromGitter >
<Blacksmoke16> if that matters...
20:58
<
FromGitter >
<Blacksmoke16> actually checking `String#bytesize` and just using `String#each_byte` would prob be enough versus going to a slice in between
21:15
<
FromGitter >
<jrei:matrix.org> now I have to deal with ioctl errors, no idea how to debug that
21:16
<
FromGitter >
<jrei:matrix.org> and know what's wrong...
21:21
<
FromGitter >
<jrei:matrix.org> Also I think it may be `LibC::Char[80]`
21:22
<
FromGitter >
<Blacksmoke16> using those aliases is a good idea yea, but thats basically just `UInt8[80]` fwiw
21:23
<
FromGitter >
<jrei:matrix.org> Yep, `char.ord.to_u8` did it
21:23
<
FromGitter >
<Blacksmoke16> for multi-byte strings
21:24
<
FromGitter >
<jrei:matrix.org> hum no got "Bad address" :/
21:24
<
FromGitter >
<jrei:matrix.org> Ha good to know
21:24
<
FromGitter >
<Blacksmoke16> `Char#each_byte`
21:27
<
FromGitter >
<jrei:matrix.org> I added a pointerof(some_struct), well I got it working I think :). ⏎ UTF8 and C may be not a good idea
21:27
<
FromGitter >
<jrei:matrix.org> I'll keep it ascii
21:29
_ht has quit [Quit: _ht]
21:33
hightower2 has quit [Ping timeout: 252 seconds]
22:06
hightower2 has joined #crystal-lang
22:16
quazimodo has joined #crystal-lang
23:17
<
SamantazFox >
Thanks a lot for your help (again lol)
23:27
<
FromGitter >
<Blacksmoke16> 👍 np
23:29
quazimodo has quit [Ping timeout: 268 seconds]
23:31
quazimodo has joined #crystal-lang
23:35
ua_ has quit [Excess Flood]
23:36
ua_ has joined #crystal-lang