forked from FauxFaux/PuTTYTray
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregex_lib.cpp
More file actions
38 lines (31 loc) · 742 Bytes
/
Copy pathregex_lib.cpp
File metadata and controls
38 lines (31 loc) · 742 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "regex_lib.h"
#include <regex>
#include <assert.h>
static void (*rtfm_func)(const char *error);
struct regexp {
std::regex *inner;
};
struct regexp *regcomp(const char *expr)
{
try {
auto reg = new std::regex(
expr, std::regex_constants::ECMAScript | std::regex_constants::icase);
regexp *ret = (regexp *)calloc(1, sizeof(regexp));
ret->inner = reg;
return ret;
} catch (std::regex_error &error) {
rtfm_func(error.what());
}
}
int regexec(struct regexp *regex, char *text)
{
assert(!"not implemented");
}
void set_regerror_func(void (*rtfm)(const char *error))
{
rtfm_func = rtfm;
}
void reg_get_range(struct regexp *regex, char **start, char **end)
{
assert(!"not implemented");
}