mark4 changed the topic of #forth to: Forth Programming | do drop >in | logged by clog at http://bit.ly/91toWN backup at http://forthworks.com/forth/irc-logs/ | If you have two (or more) stacks and speak RPN then you're welcome here! | https://github.com/mark4th
TCZ has quit [Ping timeout: 246 seconds]
dave0 has joined #forth
<joe9> veltas, why not flashforth? I have an amd64 port of it. But, it still has some bugs that I need to work through.
<joe9> But, this is native to 9front though.
<veltas> Okay well that's why then :)
<veltas> I'm afraid I don't run 9front
lispmacs has quit [Read error: Connection reset by peer]
dave0 has quit [Quit: dave's not here]
boru` has joined #forth
boru has quit [Disconnected by services]
boru` is now known as boru
Zarutian_HTC has quit [Remote host closed the connection]
sts-q has quit [Ping timeout: 245 seconds]
sts-q has joined #forth
inode has quit [Remote host closed the connection]
gravicappa has joined #forth
dzho has quit [Ping timeout: 260 seconds]
dzho has joined #forth
WojciechK has quit [Ping timeout: 260 seconds]
f-a has joined #forth
hosewiejacke has joined #forth
jedb has quit [Remote host closed the connection]
jedb has joined #forth
jedb_ has joined #forth
jedb has quit [Ping timeout: 265 seconds]
jedb__ has joined #forth
jedb_ has quit [Ping timeout: 256 seconds]
jedb__ has quit [Ping timeout: 276 seconds]
inode has joined #forth
dave0 has joined #forth
f-a has quit [Ping timeout: 245 seconds]
f-a has joined #forth
f-a has quit [Quit: leaving]
f-a has joined #forth
f-a has quit [Quit: leaving]
tech_exorcist has joined #forth
tech_exorcist has quit [Quit: tech_exorcist]
tech_exorcist has joined #forth
hosewiejacke has quit [Ping timeout: 276 seconds]
hosewiejacke has joined #forth
dave0 has quit [Quit: dave's not here]
Zarutian_HTC has joined #forth
shmorgle has quit [Quit: [TalkSoup] via NEXTSPACE]
shmorgle has joined #forth
Zarutian_HTC has quit [Ping timeout: 256 seconds]
Zarutian_HTC has joined #forth
gravicappa has quit [Ping timeout: 265 seconds]
gravicappa has joined #forth
<nihilazo> https://ttm.sh/ut4.fs I'm really unsure about the way I'm handling changed? etc in this, I'm not sure what the better way would be. Currently I'm storing a value and if it's changed as two cells with the change flag after the value, which is fine except I have one value that takes two cells itself and I have to put those in cells 0 and 2 with the change flag being in cell 1, which feels inelegent.
<nihilazo> I could put the change flag in cell 0, but then accessing the value would require using 1 cells + a bunch
hosewiejacke has quit [Ping timeout: 276 seconds]
<inode> one way could be to have the words like CHANGED? accept an additional parameter to indicate how many cells to skip from addr
<inode> ie. : changed? ( addr -- flag ) 1 cells + @ ; -> : changed ( addr skip -- flag ) cells + @ ;
<inode> (also 1 CELLS is the same as saying CELL)
<inode> guessing you might end up wrapping it as : membercost-changed? membercost 1 changed? ;
<nihilazo> the additional parameter idea works
<nihilazo> thanks
<nihilazo> I have another question but it's not directly forth related and rather just rellated to working in a terminal so I'm not sure where is best to ask it
<inode> otherwise have an array of changed-flags where each variable in question is associated with a particular index
<inode> it doesn't hurt to ask off-topic stuff, someone here might be able to help
<nihilazo> is it possible to detect a key being pressed rather than typed, ignoring key repeat etc, in an application that runs in a terminal? Like, the physical key press
<inode> do you want to get the event without any noticable output to the tty?
<inode> at least before you've decided what to do with it frist
<inode> i'm guessing you want to put the tty into raw mode
<nihilazo> raw mode?
<nihilazo> ah ok
<nihilazo> so if the terminal is in raw mode, I get the keystrokes directly rather than them going through the terminal's line stuff, but I think then I still get key repeat? because it's done in the OS before it gets to the terminal I think. don't know
<nihilazo> wait, am I in raw mode already if I can get single keystrokes? I'm already doing that
<nihilazo> or is it not doing single keystrokes and the program is just eating the first character of the cooked input
<inode> i don't see anything in your shared code to change your terminal settings, so i'm guessing you're in cooked mode
<nihilazo> yeah the only terminal setting I'm changing is hiding the cursor
<nihilazo> I'm not sure how to enter raw mode. Everything I can see seems to be making use of a C library
<inode> you'll probably need to make the calls to tcgetattr and tcsetattr through ffi yourself
<inode> i don't think gforth has any bindings for termios stuff
<nihilazo> oh ok
<nihilazo> time to learn how, and if, ffi works
<inode> actually the manual says stdin already should be in raw mode
<inode> key-file ... "Read one character n from wfileid. This word disables buffering for wfileid. If you want to read characters from a terminal in non-canonical (raw) mode, you have to put the terminal in non-canonical mode yourself (using the C interface); the exception is stdin: Gforth automatically puts it into non-canonical mode."
<nihilazo> huh
<nihilazo> that makes sense I guess, given that I can read single keystrokes in from stdin
<nihilazo> so that only leaves the question of key repeat which I might need to filter out manually
<mark4> or just make things large enough for any cell size/
<mark4> nihilazo: yes it is, you would use the poll call
<mark4> and pollfd's
<nihilazo> poll call? (sorry I know nothing about terminals)
<mark4> i have some example code you might like to see in my ucurses
<mark4> hang on
<mark4> poll is a linux system call
<mark4> thats got some stuff in there you might like to study
<nihilazo> thanks
<mark4> key() returns a key, keys() returns how many are available for read i think
<mark4> the call to poll in keys() is non blocking here
<mark4> read_key will read a complete key seauence because some keys return more than one byte
<mark4> like cursor keys and function keys etc
<nihilazo> ok
<nihilazo> I'm not sure if I could call poll from gforth, hmm
<nihilazo> because it uses structs in arguments
<nihilazo> which from the docs doesn't seem to be supported
<nihilazo> I guess maybe I'd have to write C to interface to the C interface in gforth?
<mark4> you can look at how i did it in x4 sources too. src/kernel/io.f i believe at the top
<mark4> i just manually created a flat pollfd structure which is just a few bytes in size
<mark4> and then called the sys poll systemcall
<nihilazo> ok
<nihilazo> and could using poll mean I don't get key repeats?
<nihilazo> this is literally just to stop people cheeseing my game lol
Zarutian_HTC has quit [Ping timeout: 276 seconds]
hosewiejacke has joined #forth
jess has quit [Quit: update innit]
j has joined #forth
j is now known as jess
hosewiejacke has quit [Quit: Leaving]
gravicappa has quit [Ping timeout: 256 seconds]
Guest68981 has quit [Quit: leaving]
rprimus has joined #forth
f-a has joined #forth
Gromboli has quit [Read error: Connection reset by peer]
Gromboli has joined #forth
veltas has quit [Ping timeout: 246 seconds]
veltas has joined #forth
f-a has quit [Ping timeout: 240 seconds]
[1]MrMobius has joined #forth
f-a has joined #forth
MrMobius has quit [Ping timeout: 264 seconds]
[1]MrMobius is now known as MrMobius
Zarutian_HTC has joined #forth
Zarutian_HTC has quit [Ping timeout: 260 seconds]
Zarutian_HTC has joined #forth
dave0 has joined #forth
tech_exorcist has quit [Quit: tech_exorcist]
<veltas> nihilazo: Key repeat is done by the keyboard
<veltas> With P/S2 keyboards at least
<veltas> It's done at a very low level
<veltas> Regardless, your terminal can't distinguish repeat keys, and doesn't get info about key releases