aboutsummaryrefslogtreecommitdiff
path: root/editor.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-08-13 21:38:14 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-08-13 21:38:14 +0200
commit83e4cb0e54a64f2a366e2f312be773afc8e02aa2 (patch)
tree258035d95c01cb971cbb8a84812502cf6780b884 /editor.h
parentef876ce4eaf3ef5f8e406205b2d797efccea293f (diff)
downloadvis-83e4cb0e54a64f2a366e2f312be773afc8e02aa2.tar.gz
vis-83e4cb0e54a64f2a366e2f312be773afc8e02aa2.tar.xz
Add search functionality
Diffstat (limited to 'editor.h')
-rw-r--r--editor.h13
1 files changed, 13 insertions, 0 deletions
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);