summaryrefslogtreecommitdiff
path: root/gramscii.h
diff options
context:
space:
mode:
Diffstat (limited to 'gramscii.h')
-rw-r--r--gramscii.h36
1 files changed, 28 insertions, 8 deletions
diff --git a/gramscii.h b/gramscii.h
index b329d89..a08d211 100644
--- a/gramscii.h
+++ b/gramscii.h
@@ -5,13 +5,7 @@
#include <termios.h>
#include <unistd.h>
-/** types **/
-typedef struct{
- int sz;
- int lst;
- char *s;
-} line_t;
/** constants **/
@@ -50,6 +44,20 @@ typedef struct{
#define VIDEO_NRM 0
#define VIDEO_REV 7
+/** types **/
+
+typedef struct{
+ int sz;/* allocated size*/
+ int n;/* line number */
+ int lst;/* last visible char (before the first \0) */
+ char *s;
+} line_t;
+
+typedef struct{
+ int sz;/* allocated size */
+ int num;/* number of lines stored */
+ line_t *l;
+} lineset_t;
/** MACROS **/
@@ -63,8 +71,9 @@ typedef struct{
/** global variables **/
-line_t *screen;
-int num_lines;
+lineset_t screen;
+lineset_t cutbuf;
+
int WIDTH, HEIGHT;
int mode;
@@ -96,6 +105,7 @@ char visual;
char silent;
char autoend;
+
struct termios t1, t2, t3;
/** screen-related functions **/
@@ -129,6 +139,7 @@ void get_box(FILE *fc);
void get_arrow(FILE *fc);
void erase(FILE *fc);
void visual_box(FILE *fc);
+void paste();
/** file-related functions **/
void write_file(FILE *fc);
@@ -136,5 +147,14 @@ 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);
+void ensure_num_lines(lineset_t *ls, int n);
+void yank_region(int x1, int y1, int x2, int y2);
+void paste_region(int x1, int y1);
+
#endif