Add new ANTLR parser for RSP queries

This parser actually supports way more than is needed for RSP proper,
as mt-daapd was piggybacking on the RSP queries for its smart playlists.

As I don't have (yet?) the RSP specs, better safe than sorry here. This
will be revisited at some point. Or not.
This commit is contained in:
Julien BLACHE
2009-06-04 15:45:22 +02:00
parent 272d8bca04
commit f9d9964914
7 changed files with 931 additions and 2 deletions

View File

@@ -45,6 +45,7 @@
#include "httpd.h"
#include "transcode.h"
#include "httpd_rsp.h"
#include "rsp_query.h"
#define RSP_VERSION "1.0"
@@ -1049,6 +1050,10 @@ rsp_init(void)
int i;
int ret;
ret = rsp_query_init();
if (ret < 0)
return ret;
for (i = 0; rsp_handlers[i].handler; i++)
{
ret = regcomp(&rsp_handlers[i].preg, rsp_handlers[i].regexp, REG_EXTENDED | REG_NOSUB);
@@ -1057,11 +1062,16 @@ rsp_init(void)
regerror(ret, &rsp_handlers[i].preg, buf, sizeof(buf));
DPRINTF(E_FATAL, L_RSP, "RSP init failed; regexp error: %s\n", buf);
return -1;
goto regexp_fail;
}
}
return 0;
regexp_fail:
rsp_query_deinit();
return -1;
}
void
@@ -1069,6 +1079,8 @@ rsp_deinit(void)
{
int i;
rsp_query_deinit();
for (i = 0; rsp_handlers[i].handler; i++)
regfree(&rsp_handlers[i].preg);
}