diff options
Diffstat (limited to 'gramscii.h')
-rw-r--r-- | gramscii.h | 57 |
1 files changed, 39 insertions, 18 deletions
@@ -9,13 +9,16 @@ /** constants **/ +/* modes */ #define MOVE 0x00 #define BOX 0x01 #define ARROW 0x02 #define TEXT 0x04 #define DEL 0x08 #define VIS 0x10 +/**/ +/* directions */ #define DIR_N 0x00 #define DIR_R 0x01 #define DIR_U 0x02 @@ -24,11 +27,12 @@ #define DIR_HOR (DIR_R | DIR_L) #define DIR_VER (DIR_D | DIR_U) - +/**/ #define NOFIX 0x0 #define FIX 0x1 +/* markers */ #define BG ' ' #define PTR '+' #define UND '_' @@ -36,21 +40,28 @@ #define ARR_R '>' #define ARR_U '^' #define ARR_D 'v' +/**/ +/* global positions */ #define HOME 0x01 #define END 0x02 #define MIDDLE 0x04 +/**/ +/* video modes */ #define VIDEO_NRM 0 #define VIDEO_REV 7 +/**/ +/* undo buffer elem types */ #define PRV_STATE 0x01 #define NEW_STATE 0x02 +/**/ /** types **/ typedef struct{ - int sz;/* allocated size*/ + int sz;/* allocated size */ int n;/* line number */ int lst;/* last visible char (before the first \0) */ char *s; @@ -75,45 +86,52 @@ typedef struct{ /** global variables **/ -lineset_t screen; -lineset_t cutbuf; -lineset_t *undo; +lineset_t screen; /* what is visualised */ +lineset_t cutbuf; /* cut/paste buffer */ +lineset_t *undo; /* undo list */ -int undo_sz; -int undo_cur; -int undo_lst; +int undo_sz;/* allocated size of undo list*/ +int undo_cur;/* undo position */ +int undo_lst;/* last valid undo position */ int WIDTH, HEIGHT; -int mode; -int dir; +int mode;/* mode */ +int dir;/* line direction */ int x; int y; -int step; -int mult; +int step;/* current step */ +int mult;/* current multiplier */ int force_new; -char cursor; char corner; +/* number of available markers for each type */ int hlines_sz; int vlines_sz; int corners_sz; int stmarks_sz; int endmarks_sz; +/**/ +/* line and arrow markers */ int cur_hl, cur_vl, cur_corn, cur_start, cur_end; char line_h; char line_v; char mark_st; char mark_end; +/**/ -char modified; +char modified; /* set to 1 if screen modified since last save */ char fname[256]; -char visual; -char silent; -char autoend; +char silent; /* set to 1 in script-mode */ +char autoend; /* set to 1 in auto-arrow mode */ + +/* Used by draw_arrow to identify the bounding box */ +int a_miny; +int a_maxy; +/**/ struct termios t1, t2, t3; @@ -141,6 +159,7 @@ void go_to(int where); void crop_to_nonblank(); void crop_to_rect(); void erase_blank_lines(int y1, int y2); +/**/ /** drawing-related functions **/ int change_style(char c); @@ -152,15 +171,16 @@ void visual_box(FILE *fc); void paste(); void undo_change(); void redo_change(); +/**/ /** file-related functions **/ void write_file(FILE *fc); void check_modified(FILE *fc); void load_file(FILE *fc); void new_file(FILE *fc); +/**/ /** line-related functions **/ - void dump_lines(lineset_t ls, FILE *f); void alloc_line(line_t *l); void ensure_line_length(line_t *l, int len); @@ -169,5 +189,6 @@ void yank_region(int x1, int y1, int x2, int y2); void paste_region(int x1, int y1); void copy_lines_to_ring(int y1, int y2, int which); void invalidate_undo(); +/**/ #endif |