napperley
11/17/2021, 12:21 AMNewSettings.c_lflag &= ~( ICANON | ECHO );
(C language) to Kotlin, and have hit a brick wall 🧱 with the bit manipulation since there appears to be some bit manipulation operations that can't be done in Kotlin, unless there are some workarounds available. Below is the full C code I am trying to translate into Kotlin:
#include <termios.h>
static struct termios OriginalSettings, NewSettings;
void terminal_setup()
{
tcgetattr(STDIN_FILENO, &OriginalSettings);
NewSettings = OriginalSettings;
NewSettings.c_lflag &= ~( ICANON | ECHO );
tcsetattr(STDIN_FILENO, TCSANOW, &NewSettings);
printf("\e[?25l");
}
void terminal_reset()
{
tcsetattr (STDIN_FILENO, TCSAFLUSH, &OriginalSettings);
}
mbonnin
11/17/2021, 7:37 AMval settings = alloc<termios>()
settings.c_cflag = settings.c_cflag.and(ICANON.or(ECHO).inv().toULong())
mbonnin
11/17/2021, 7:38 AMtoULong()
not overflowing or so but it should work?