#ifndef SEEN_TYPES_H #define SEEN_TYPES_H #include #include #include /* Forward references and typedefs */ #define STRUCT(x) struct x; typedef struct x x STRUCT(ca_t); STRUCT(line_t); STRUCT(history_t); STRUCT(screen_t); STRUCT(config_t); STRUCT(eat_t); STRUCT(term_t); STRUCT(input_t); STRUCT(status_t); STRUCT(win_t); STRUCT(app_t); typedef enum {TERMINAL, INPUT, STATUS} win_type_t; /* Adapted from konsole */ #define DEFAULT_FG_COLOR 0 #define DEFAULT_BG_COLOR 1 #define DEFAULT_RENDITION 0 #define RE_BOLD 1 #define RE_BLINK 2 #define RE_UNDERLINE 4 #define RE_REVERSE 8 /* Character with rendition information */ struct ca_t { unsigned int c : 8; /* Character ordinal */ unsigned int f : 8; /* Foreground */ unsigned int b : 8; /* Background */ unsigned int r : 8; /* Condensed rendition */ }; /* Single line of history */ struct line_t { int size; /* Length of line */ ca_t c[0]; /* Character data */ }; /* History for a particular application terminal window */ struct history_t { int size; /* Number of lines */ line_t** l; /* Pointers to lines */ }; /* Entire display */ struct screen_t { WINDOW* c_win; /* Window mapped to entire screen */ int size; /* Number of contained windows */ win_t** wins; /* List of windows in screen */ }; /* Global configuration */ struct config_t { /* Key bindings */ /* Defaults */ /* Command macros */ }; /* State information for eat */ struct eat_t { screen_t* screen; /* The screen this instance is running on */ config_t* cfg; /* Global configuration */ app_t** apps; /* Null-terminated list of apps managed by eat*/ /* ipc */ }; /* Terminal state */ struct term_t { #if 0 /* Terminal input preprocessing */ int canonical; /* TODO: elaborate */ #endif /* Terminal output */ int x, y; /* Cursor position */ #if 0 ca_t attr; /* Attributes */ int autolf; /* Automatically line feed? */ /* Escape sequence handling */ int esc_state; /* State of the escape sequence decoder */ /* Extra configuration */ int dup_prompt; /* Duplicate prompt in input window? */ int dup_input; /* Duplicate input in terminal window? */ int show_cursor; /* Show insertion point in terminal? */ #endif /* History */ int sb_y; history_t* history; }; /* Input window */ struct input_t { int size; /* Length of current line */ char* line; /* Current line being edited */ }; /* Status window */ struct status_t { /* Status line format */ }; /* Application window */ struct win_t { int l, t, r, b; /* Left, top, right, bottom coordinates */ int w, h; /* Onscreen size (reported to application) */ WINDOW* c_win; /* Corresponding curses window or pad */ win_type_t type; /* Type of window */ void* x; /* Extended information; depends on type */ }; /* Application running within eat */ struct app_t { pid_t pid; /* Application's pid */ int p_desc; /* File descriptor for application's pty */ FILE* p_in; /* Input stream for pty */ FILE* p_out; /* Output stream for pty */ win_t* win; /* Window application is running in */ }; #endif