From 27500a9c688029d1cd3b563e8d19df245545a05a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 14 Aug 2014 09:14:49 +0200 Subject: Change 'namespace' Editor -> Text --- editor.h | 82 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'editor.h') diff --git a/editor.h b/editor.h index 114cc0b..cd69557 100644 --- a/editor.h +++ b/editor.h @@ -1,6 +1,6 @@ #include -typedef struct Editor Editor; +typedef struct Text Text; typedef struct Piece Piece; typedef struct { @@ -11,49 +11,49 @@ typedef struct { size_t pos; /* global position in bytes from start of file */ } Iterator; -#define editor_iterate(ed, it, pos) \ - for (Iterator it = editor_iterator_get((ed), (pos)); \ - editor_iterator_valid(&it); \ - editor_iterator_next(&it)) +#define text_iterate(ed, it, pos) \ + for (Iterator it = text_iterator_get((ed), (pos)); \ + text_iterator_valid(&it); \ + text_iterator_next(&it)) -Editor *editor_load(const char *file); -const char *editor_filename(Editor*); -bool editor_insert(Editor*, size_t pos, const char *data); -bool editor_insert_raw(Editor*, size_t pos, const char *data, size_t len); -bool editor_delete(Editor*, size_t pos, size_t len); -bool editor_replace(Editor*, size_t pos, const char *data); -bool editor_replace_raw(Editor*, size_t pos, const char *data, size_t len); -void editor_snapshot(Editor*); -bool editor_undo(Editor*); -bool editor_redo(Editor*); +Text *text_load(const char *file); +const char *text_filename(Text*); +bool text_insert(Text*, size_t pos, const char *data); +bool text_insert_raw(Text*, size_t pos, const char *data, size_t len); +bool text_delete(Text*, size_t pos, size_t len); +bool text_replace(Text*, size_t pos, const char *data); +bool text_replace_raw(Text*, size_t pos, const char *data, size_t len); +void text_snapshot(Text*); +bool text_undo(Text*); +bool text_redo(Text*); -size_t editor_pos_by_lineno(Editor*, size_t lineno); -size_t editor_lineno_by_pos(Editor*, size_t pos); +size_t text_pos_by_lineno(Text*, size_t lineno); +size_t text_lineno_by_pos(Text*, size_t pos); -size_t editor_bytes_get(Editor*, size_t pos, size_t len, char *buf); +size_t text_bytes_get(Text*, size_t pos, size_t len, char *buf); -Iterator editor_iterator_get(Editor*, size_t pos); -bool editor_iterator_valid(const Iterator*); -bool editor_iterator_next(Iterator*); -bool editor_iterator_prev(Iterator*); +Iterator text_iterator_get(Text*, size_t pos); +bool text_iterator_valid(const Iterator*); +bool text_iterator_next(Iterator*); +bool text_iterator_prev(Iterator*); -bool editor_iterator_byte_get(Iterator *it, char *b); -bool editor_iterator_byte_next(Iterator*, char *b); -bool editor_iterator_byte_prev(Iterator*, char *b); +bool text_iterator_byte_get(Iterator *it, char *b); +bool text_iterator_byte_next(Iterator*, char *b); +bool text_iterator_byte_prev(Iterator*, char *b); -bool editor_iterator_char_next(Iterator *it, char *c); -bool editor_iterator_char_prev(Iterator *it, char *c); +bool text_iterator_char_next(Iterator *it, char *c); +bool text_iterator_char_prev(Iterator *it, char *c); typedef int Mark; -void editor_mark_set(Editor*, Mark, size_t pos); -size_t editor_mark_get(Editor*, Mark); -void editor_mark_clear(Editor*, Mark); -void editor_mark_clear_all(Editor*); +void text_mark_set(Text*, Mark, size_t pos); +size_t text_mark_get(Text*, Mark); +void text_mark_clear(Text*, Mark); +void text_mark_clear_all(Text*); -size_t editor_size(Editor*); -bool editor_modified(Editor*); -int editor_save(Editor*, const char *file); -void editor_free(Editor *ed); +size_t text_size(Text*); +bool text_modified(Text*); +int text_save(Text*, const char *file); +void text_free(Text*); typedef struct Regex Regex; @@ -62,11 +62,11 @@ typedef struct { size_t end; /* end of match in bytes from start of file or -1 if unused */ } RegexMatch; -Regex *editor_regex_new(void); -int editor_regex_compile(Regex *r, const char *regex, int cflags); -void editor_regex_free(Regex *r); -int editor_search_forward(Editor*, size_t pos, size_t len, Regex *r, size_t nmatch, RegexMatch pmatch[], int eflags); -int editor_search_backward(Editor*, size_t pos, size_t len, Regex *r, size_t nmatch, RegexMatch pmatch[], int eflags); +Regex *text_regex_new(void); +int text_regex_compile(Regex *r, const char *regex, int cflags); +void text_regex_free(Regex *r); +int text_search_forward(Text*, size_t pos, size_t len, Regex *r, size_t nmatch, RegexMatch pmatch[], int eflags); +int text_search_backward(Text*, size_t pos, size_t len, Regex *r, size_t nmatch, RegexMatch pmatch[], int eflags); // TMP -void editor_debug(Editor *ed); +void text_debug(Text *ed); -- cgit v1.2.3