beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
seninha has joined #picolisp
seninha has quit [Quit: Leaving]
seninha has joined #picolisp
seninha has quit [Ping timeout: 255 seconds]
avocadoist has quit [Quit: Konversation terminated!]
avocadoist has joined #picolisp
avocadoist has quit [Read error: Connection reset by peer]
avocadoist has joined #picolisp
avocadoist has quit [Client Quit]
avocadoist has joined #picolisp
avocadoist has quit [Client Quit]
avocadoist has joined #picolisp
beneroth has quit [Ping timeout: 268 seconds]
<aw-> abu[m]: hi
<abu[m]> Hi aw-!
<aw-> i'm having trouble with (native)
<aw-> i'm calling a function which expects a String argument, but I have a list of integers which are from 0-255
<aw-> i tried to do (pack (mapcar char List)) but it doesn't work as expected
<aw-> should I create a struct first, and pass that as the String argument?
<abu[m]> Bytes above 127 are not UTF-8
<abu[m]> The above pack should be fine, if the bytes are only ASCII
<aw-> they are not
<aw-> they are between 0-255
<abu[m]> So it is iso8859 ?
<abu[m]> You need to convert
<aw-> no, i think 0xFF is not iso8859
<abu[m]> depends. In any case it is not utf8
<aw-> i dont care about the encoding
<aw-> i just need to pass the list of integers
<abu[m]> But strings are expected in utf8
<abu[m]> Bytes above 127 are part of a multi-byte char
<abu[m]> So you need to convert
<aw-> sorry
<aw-> wait
<aw-> the C argument is this: const unsigned char *buf;
<abu[m]> ok, so it wants to write something into that buffer
<aw-> yes
<abu[m]> You can use 'buf'
<abu[m]> (buf P Size (native ... P
<abu[m]> Then e.g. extract a result with (struct P 'S)
<aw-> i dont need the result
<abu[m]> But you need to pass a pointer to a buffer of a certain size?
<abu[m]> Or is it just a plain constant string?
<abu[m]> What happens if you call (nattive ... "foo" ...)?
<abu[m]> This passes a buffer of 4 bytes initialized to "foo", and ignores any modifications
<aw-> yes that works
<abu[m]> good
<abu[m]> And the 'pack' with all bytes below 127?
<aw-> no
<aw-> sometimes bytes are 255
<aw-> they are anywhere between 0-255
<aw-> like i said before
<abu[m]> I mean just for this test
<abu[m]> hmm, well, 'char' takes care of this
<abu[m]> So it *is* uth8
<abu[m]> But a 'pack'ed string is equivalent to a constant string in this regard
<abu[m]> Why does "foo" work and 'pack' does not?
<aw-> your question is the reason i'm asking here
<aw-> for help
<aw-> i don't know why (pack) doesnt work
<aw-> and no it's NOT UTF-8
<aw-> there is no encoding specified
<abu[m]> My error, utf8 is not the issue
<aw-> "foo" works but (pack (mapcar char (1 2 3))) does not work
<abu[m]> because of (mapcar char ...)
<aw-> i think maybe (char) is the issue?
<abu[m]> I don't think so
<abu[m]> (char 1) -> "^A"
<abu[m]> only zero bytes will be a problem
<aw-> can cok
<aw-> so (pack (mapcar char (0 0 0))) doesnt work
<aw-> sorry i mistyped
<abu[m]> yes, for several reasons
<aw-> ok let me try some things
<aw-> i'll be back later
<aw-> thanks!
<abu[m]> ☺
beneroth has joined #picolisp
seninha has joined #picolisp
avocadoist has quit [Quit: Konversation terminated!]
avocadoist has joined #picolisp
chexum has quit [Remote host closed the connection]
chexum has joined #picolisp
seninha has quit [Quit: Leaving]
seninha has joined #picolisp
pfd has joined #picolisp
seninha has quit [Quit: Leaving]
pfd has quit [Ping timeout: 260 seconds]
avocadoist has quit [Quit: Konversation terminated!]
avocadoist has joined #picolisp
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp