#ifndef DATA_H_ #define DATA_H_ #include #include #include #include "lisp.h" /** * \struct erow * \brief Store one editor row * \param * */ typedef struct erow { int size; /**< Size of the line */ int rsize; /**< Size of the render line */ char *chars; /**< Characters of the line */ char *render; /**< The actual line we will print */ } erow; typedef struct theme { char *BACKGROUND_COLOR; char *COLOR_KEYWORD; char *COLOR_TYPE; char *COLOR_STRING; char *COLOR_COMMENT; char *COLOR_NUMBER; char *COLOR_DEFAULT; } theme_t; enum editorStatus_e { IDLE, READ_ONLY, READ_AND_WRITE, }; struct const_t { int TAB_LENGTH; int QUIT_TIMES; char *THEME; }; struct prefix_t { char prefix_name[64]; int prefix_id; }; struct keyBind_t { char *key_sequence; int prefix_id; Lisp command; }; enum buffer_type { FILE_BUFF, TERMINAL_BUFF }; struct buffer_t { enum buffer_type type; int buffer_id; int width, height; int x, y; /**< Position of the buffer*/ char *filename; }; /** * \struct editorConfig * \brief Containing our editor state. */ struct editorConfig { int cursor_x, cursor_y; /**< Cursor position */ int rx; /**< Position in the render*/ int row_offset; /**< Position scroll of lines */ int col_offset; /**< Position scroll of colomns*/ int screenrows; /**< Terminal height*/ int screencols; /**< Terminal width*/ int numrows; /**< Number of rows contained */ erow *row; /**< Store all the rows printed */ int dirty; char *filename; enum editorStatus_e state; int prefix_state; char status_msg[80]; time_t status_msg_time; struct termios orig_termios; /**< Terminal communication interface */ struct const_t constantes; int quit_times_buffer; char *init_file_path; FILE *fd_init_file; Lisp env; LispContext ctx; /** Lisp context */ Lisp ctx_data; /** Lisp data context */ LispError ctx_error; /** Lisp ctx error */ struct keyBind_t *key_binds; int number_of_keybinds; struct prefix_t *prefix; int number_of_prefix; struct buffer_t buffers[64]; struct buffer_t ***screen_layout; /**< Which buffer is the current cell*/ int number_of_buffer; theme_t theme; }; /** * \struct abuf * \brief Contains text to add before writing to screen. * */ struct abuf { char *b; /**< Text that will be printed */ int len; /**< Length of the text */ }; extern struct editorConfig E; #endif