/* * Copyright (c) 2021 joshua stein * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef __CONSOLE_H__ #define __CONSOLE_H__ #include "session.h" struct console { short state; WindowPtr win; ControlHandle scroller; short nlines; short ncolumns; char chars[DEFAULT_TERMINAL_COLUMNS * DEFAULT_TERMINAL_LINES]; unsigned char attrs[DEFAULT_TERMINAL_COLUMNS * DEFAULT_TERMINAL_LINES]; unsigned char cur_attr; #define ATTR_BOLD (1 << 0) #define ATTR_REVERSE (1 << 1) #define ATTR_UNDERLINE (1 << 2) #define ATTR_CURSOR (1 << 6) #define ATTR_DIRTY (1 << 7) short cursor_line; short cursor_column; short saved_cursor_line; short saved_cursor_column; short in_csi; short csilen; char csi[32]; struct session *session; struct focusable *focusable; }; struct console *console_init(void); void console_close_from_session(struct session *session); short console_output(struct session *session); short console_input(struct session *session); short console_read(struct session *session); #endif /* __CONSOLE_H__ */