diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-08-13 21:38:14 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-08-13 21:38:14 +0200 |
| commit | 83e4cb0e54a64f2a366e2f312be773afc8e02aa2 (patch) | |
| tree | 258035d95c01cb971cbb8a84812502cf6780b884 /editor.h | |
| parent | ef876ce4eaf3ef5f8e406205b2d797efccea293f (diff) | |
| download | vis-83e4cb0e54a64f2a366e2f312be773afc8e02aa2.tar.gz vis-83e4cb0e54a64f2a366e2f312be773afc8e02aa2.tar.xz | |
Add search functionality
Diffstat (limited to 'editor.h')
| -rw-r--r-- | editor.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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); |
