1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include <stdbool.h>
typedef struct Editor Editor;
typedef enum {
CONTINUE,
BREAK,
} Iterate;
typedef Iterate (*iterator_callback_t)(void *, size_t pos, const char *content, size_t len);
bool editor_insert(Editor*, size_t pos, char *c);
bool editor_replace(Editor*, size_t pos, char *c);
bool editor_delete(Editor*, size_t pos, size_t len);
bool editor_undo(Editor*);
bool editor_redo(Editor*);
void editor_snapshot(Editor*);
int editor_save(Editor*, const char *file);
Editor *editor_load(const char *file);
char *editor_get(Editor*, size_t pos, size_t len);
void editor_iterate(Editor *ed, void *, size_t pos, iterator_callback_t);
// TMP
void editor_debug(Editor *ed);
|