32 static bool rtosc_match_number(
const char **pattern,
const char **msg)
35 if(!isdigit(**pattern) || !isdigit(**msg))
39 unsigned max = atoi(*pattern);
40 unsigned val = atoi(*msg);
43 while(isdigit(**pattern))++*pattern;
44 while(isdigit(**msg))++*msg;
49 static const char *rtosc_match_path(
const char *pattern,
const char *msg)
55 else if(*pattern ==
'/' && *msg ==
'/')
57 else if(*pattern ==
'#') {
59 if(!rtosc_match_number(&pattern, &msg))
61 }
else if((*pattern == *msg)) {
72 static bool rtosc_match_args(
const char *pattern,
const char *msg)
79 bool arg_match = *pattern || *pattern == *arg_str;
81 while(*pattern && *pattern !=
':')
82 arg_match &= (*pattern++==*arg_str++);
85 if(arg_match && !*arg_str)
88 return rtosc_match_args(pattern, msg);
104 static bool rtosc_match(
const char *pattern,
const char *msg)
106 const char *arg_pattern = rtosc_match_path(pattern, msg);
109 else if(*arg_pattern ==
':')
110 return rtosc_match_args(arg_pattern, msg);