ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Picolisp latest found at http://www.software-lab.de/down.html | check also http://www.picolisp.com for more information
reed has joined #picolisp
orivej has quit [Ping timeout: 248 seconds]
reed has quit [Quit: Page closed]
rob_w has joined #picolisp
mtsd has joined #picolisp
<Regenaxer> Fixed the wiki article about namespaces
<tankf33der> next task
<yunfan> Regenaxer: the ref should be fix too
<yunfan> i found my latest pil hasnt support `pil -vi`
<Regenaxer> Hi tankf33der, yunfan
<Regenaxer> Which ref do you mean?
<yunfan> hold on
<yunfan> check the chapter `Invocation`
<Regenaxer> yes?
<Regenaxer> What should `pil -vi` do? Invoke 'vi' without args?
<Regenaxer> You need at least '+' to get debug mode
<Regenaxer> Without it vi is not defined
<Regenaxer> pil -vi +
<Regenaxer> but (vi) without args does nothing
<yunfan> aha
<yunfan> got it
<yunfan> sorry for my mistake
<Regenaxer> np
<Regenaxer> Ah, (vi) *does* something: "without arguments permanently switches the REPL line editor"
<Regenaxer> So it creates a file .pil/editor
<Regenaxer> I did not notice because I switched the editor to vip
<Regenaxer> i.e. I have lib/vip.l on the command line in my startup scripts
orivej has joined #picolisp
aw- has joined #picolisp
<aw-> hi all
<Regenaxer> Hi aw-!
<aw-> Regenaxer: if I use (call 'script.sh) <-- calling a bash script, if I type in the screen, nothing appears
<aw-> it's probably something minor
<Regenaxer> What should appear?
<aw-> text?
<aw-> the bash script is doing something like: read
<aw-> to read input
<Regenaxer> Then you need a pipe
<Regenaxer> (out '(script) (prinl "...
<aw-> (prinl what?
<aw-> what do i prinl ?
<Regenaxer> 'call' has stdio to the terminal
<Regenaxer> How should I know what input your script needs?
<aw-> i don't think I understand..
<Regenaxer> hmm
<Regenaxer> It depends whether pil is in raw mode
<aw-> if I do (call) from a pil script, i can't interact with the program being called?
<Regenaxer> eg 'vi' calls Vim in default mode
<Regenaxer> you can, but it may depend on the terminal settings
<aw-> err sorry.. i **can** interact with it, it's just that whatever i type doesn't appear on screen
<Regenaxer> Try (call "vim" "a") in both 'pil' and 'pil +'
<Regenaxer> So you are in raw mode
<aw-> yes i'm in raw mode, i just checked with (raw)
<aw-> in my program
<Regenaxer> ok
<Regenaxer> then do (raw NIL) before the call
<Regenaxer> and perhaps (raw T) after
<aw-> i tried that, script goes crazy
<Regenaxer> yeah, this is a nasty issue
<Regenaxer> What script is that?
<Regenaxer> Does it itself set terminal parameters like Vim?
<Regenaxer> or does it just read standard input as it is?
<Regenaxer> Does it use readline? If so it also modifies stty
<Regenaxer> I think you are fine if you start pil without debug mode
<Regenaxer> Then it does not modify the tty
<aw-> yes it's not running under debug
<aw-> it's just a 1 line bash script
<aw-> using 'read' builtin
<Regenaxer> No, I'm wrong
<Regenaxer> vim does work only in debug mode
<Regenaxer> which is fine in this case ;)
<Regenaxer> Ah, we were talking about the REPL here
<Regenaxer> if it is a script, you need (in NIL (call ...
<Regenaxer> hmm, no, sorry
<Regenaxer> But vim is special anyway, as it uses curses
<Regenaxer> I think if your script does not change the tty, it would work
<Regenaxer> Try a simple 'cat'
<Regenaxer> Bash uses readline and thus modifies tty too
<aw-> wait let me give you an example
<aw-> script.sh contents
<aw-> #!/bin/bash
<aw-> read -t 30 -r -e check_str
<aw-> echo "GOT: $check_str"
<aw-> call that script.sh from pil, and it doesn't echo output when typing
<Regenaxer> Bash uses readline and thus modifies tty too
<aw-> ohhh wait
<aw-> -r is raw disable
<Regenaxer> Not sure what this implies ...
<aw-> ah same thing
<Regenaxer> I would not rely on 'call' I/O settings here
<Regenaxer> (out '(script) (while (line) (prinl @]
<aw-> why not?
<Regenaxer> We had lots of discussions
<Regenaxer> about the right tcsetpgrp() calls
<Regenaxer> setpgid()
<Regenaxer> Terminal settings are a mess in Unix
<aw-> i recall discussing this issue with you.. or something similar
<Regenaxer> I don't know the right way
<Regenaxer> yeah, I asked several people
<Regenaxer> Vim or Vip work fine however
<Regenaxer> when pil is in raw mode
<aw-> 'passwd works as well
<Regenaxer> hmm
<aw-> well... passwd doesn't echo the pass anyways haha
<Regenaxer> what about 'cat' in the script?
<aw-> cat works
<Regenaxer> stdin -> stoout
<aw-> i've used that in the past
<Regenaxer> mom, tel
<aw-> ok this is a waste of time, it will be faster for me to just re-write the bash script in picolisp
<Regenaxer> Sorry, yeah, I'm still on the phone
rob_w has quit [Remote host closed the connection]
mtsd has quit [Quit: Leaving]
sriram_ has joined #picolisp
sriram has quit [Quit: Page closed]
aw- has quit [Quit: Leaving.]
reed has joined #picolisp
<reed> Hi all, I'm reading the documentation on the C foreign function interface, trying to write some wrapper functions for api in "linux/joystick.h". The joystick event wraps a few varieties of integers. Would a type declaration in an FFI call need to be different for a struct containing a signed 32 bit integer, compared to an unsigned 16 bit integer?
<tankf33der> reed: start with something simpler
<reed> tankf33der: Good advice. But even with a toy example, just a function that randomly returns an unsigned 32 bit integer and a different function that randomly returns a signed 16 bit integer, would the interface be different?
<tankf33der> show function prototype from h file
<tankf33der> i'm still feel timidly with (native) function
<reed> for intstance "usigned long f1();" vs "signed int f2();"
<tankf33der> it will be (native "joy.so" "f1" 'N ...)
<tankf33der> interface will be different for every function because you need native for "f1" and "f2"
<reed> So the 'N because its a "long"? and (native "joy.so" "f2" 'I) because it's an int?
<tankf33der> lets say yes.
<reed> Thanks. I'll give it a shot
<tankf33der> clone my repo and find all strings with native
<tankf33der> as start point
<tankf33der> next
<tankf33der> take this md5 example and convert to sha256 and sha512 and check with python or something else.
<tankf33der> good homework.
<Regenaxer> reed, just to be sure, you use pil64? To be able to use 'native'
<reed> Regenaxer: Yes, I'm using pil64
<reed> I'm just trying to figure out how the 'I 'B 'S, in the FFI etc map to the C types. Particularly when there's unsigned and signed stuff happening
<Regenaxer> I is a signed 32 bit int
<Regenaxer> N is a 64bit or pointer
<Regenaxer> If the C function returns only a 32 bit value, negative results need to be converted
<Regenaxer> Can you show a prototype of the C function here?
<tankf33der> reed> for intstance "usigned long f1();" vs "signed int f2();"
<reed> So the same would apply to short ints? I would need to convert them to an int or a long first?
<Regenaxer> yes, so (native "lib.so" "f1" 'N)
<Regenaxer> vs (native "lib.so" "f1" 'I)
<tankf33der> vs (native "lib.so" "f2" 'I)
<Regenaxer> I signed int is just 'I'
<Regenaxer> 'N' is also signed
<Regenaxer> Have you tried it?
<Regenaxer> Just experiment on the REPL
<reed> I'm in the process. Thank you!
<Regenaxer> :)
<beneroth> hi all
<Regenaxer> Hi beneroth
<beneroth> brb
beneroth has quit [Quit: Verlassend]
alexshendi has joined #picolisp
alexshendi has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
alexshendi has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
sriram_ has quit [Ping timeout: 260 seconds]
reed has quit [Quit: Page closed]
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]