TODO
+implement vim-esque modes and gdb-like split screen/window for commands and schematics (TUI?)
+ implement new method of input - echoing commands, moving cursor and more
+ implement "split screen" - one for commands, one for schematics (gdb like)
+ commands screen should work just similarly to normal terminal usage
+ schematics should use vim like controls
+ each is controllable from a "mode" (at least 2 modes necessary, more may be usefull later on)
+make it possible to save schematics and use them again
+ use blocks to "condense" the schematics - similar to integrated parts
+ make blocks' schematics openable in another split screen (vim like split command?)
+ a block opened in another screen should show current simulation state as a part of the whole simulation (or maybe a switch between free mode and bound mode?)
make build_graph not output
rewrite command parsing (what I've created is just ugly)
come up with better file structure
pass 42 norminette
DONE
+implement vim-esque modes and gdb-like split screen/window for commands and schematics (TUI?)
+ implement new method of input - echoing commands, moving cursor and more
+ use alternate screen
+ implement non-canonical mode
rewrite t_fet and t_node to store indexes insted of pointers to connected parts
- goal shifted a bit, nodes store their ID and FETs have no use for havind ID so far
foundations of logic
#include "FET_sim.h"
#include "libft.h"
+#include <termios.h>
+#include <unistd.h> // for STDIN_FILENO
+#include <stdlib.h>
static const char alt_term_on[] = "\033[?1049h";
static const char alt_term_off[] = "\033[?1049l";
+static struct termios init_termios_set;
+
+static void termios_settings(void)
+{
+ struct termios termios_set;
+
+ tcgetattr(STDIN_FILENO, &termios_set);
+ tcgetattr(STDIN_FILENO, &init_termios_set);
+ termios_set.c_lflag &= !ICANON;
+ termios_set.c_cc[VMIN] = 1;
+ termios_set.c_cc[VTIME] = 0;
+ tcsetattr(STDIN_FILENO, TCSANOW, &termios_set);
+ return ;
+}
+
void setup_terminal(void)
{
ft_printf("%s", alt_term_on);
ft_printf("\033[H");
+ termios_settings();
return ;
}
void clean_terminal(void)
{
ft_printf("%s", alt_term_off);
+ tcsetattr(STDIN_FILENO, TCSANOW, &init_termios_set);
return ;
}