Begin re-write of basic display functions in scheme
[texed.git] / buffer.h
blob1656faaa127fa81a84567be515c4ecb8279f0b60
2 #ifndef BUFFER_H
3 #define BUFFER_H
5 #include <string.h>
6 #include <unistd.h>
7 #include <stdlib.h>
8 #include <stdio.h>
10 #define LT 0
11 #define RT 1
12 #define UP 2
13 #define DN 3
15 #define NEXT 0
16 #define PREV 1
18 typedef struct
20 int x;
21 int y;
22 } position_t;
24 typedef struct
26 char* buf;
27 unsigned int size;
28 int gap_start;
29 int gap_end;
30 int* line_indices;
31 int num_lines;
32 char* name;
33 position_t cursor;
34 } buffer_t;
36 buffer_t buffer_init();
38 buffer_t* buffer_init_point();
40 void buffer_free (buffer_t* buffer);
42 void buffer_inspect (buffer_t buffer);
44 void buffer_print (buffer_t buffer);
46 void buffer_grow (buffer_t* buffer, unsigned int add);
48 void buffer_insert_char (buffer_t* buffer, char new);
50 void buffer_backspace (buffer_t* buffer);
52 void buffer_left (buffer_t* buffer);
54 void buffer_right (buffer_t* buffer);
56 void buffer_up (buffer_t* buffer);
58 void buffer_down (buffer_t* buffer);
60 void buffer_set_contents (buffer_t* buffer, char string[]);
62 char* buffer_to_string (buffer_t buffer);
64 void buffer_jump_word (buffer_t* buffer, char delim, int dir);
66 #endif