From 83e4cb0e54a64f2a366e2f312be773afc8e02aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 13 Aug 2014 21:38:14 +0200 Subject: Add search functionality --- editor.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'editor.h') diff --git a/editor.h b/editor.h index c10577d..114cc0b 100644 --- a/editor.h +++ b/editor.h @@ -55,5 +55,18 @@ bool editor_modified(Editor*); int editor_save(Editor*, const char *file); void editor_free(Editor *ed); +typedef struct Regex Regex; + +typedef struct { + size_t start; /* start of match in bytes from start of file or -1 if unused */ + 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); + // TMP void editor_debug(Editor *ed); -- cgit v1.2.3