summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorMichiel Van Der Kolk <not.valid@email.address>2005-04-28 16:39:41 +0000
committerMichiel Van Der Kolk <not.valid@email.address>2005-04-28 16:39:41 +0000
commitc099300c8da48d4f61c6bcb97d1d4e0a0bcf282d (patch)
treec683e6bf66ca796b896eb7f85b0b26d50afe8cd8 /apps/plugins
parent29909a341aa5b829b80472fe4a726120f2a6f514 (diff)
downloadrockbox-c099300c8da48d4f61c6bcb97d1d4e0a0bcf282d.zip
rockbox-c099300c8da48d4f61c6bcb97d1d4e0a0bcf282d.tar.gz
rockbox-c099300c8da48d4f61c6bcb97d1d4e0a0bcf282d.tar.bz2
rockbox-c099300c8da48d4f61c6bcb97d1d4e0a0bcf282d.tar.xz
Count hits... string searches appear to be broken for now, unsure why,
maybe something goes wrong when allocating ram for the strings.. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6373 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/searchengine/parser.c14
-rw-r--r--apps/plugins/searchengine/searchengine.c10
-rw-r--r--apps/plugins/searchengine/token.h2
3 files changed, 20 insertions, 6 deletions
diff --git a/apps/plugins/searchengine/parser.c b/apps/plugins/searchengine/parser.c
index cbedeb3..ad2e4ee 100644
--- a/apps/plugins/searchengine/parser.c
+++ b/apps/plugins/searchengine/parser.c
@@ -148,11 +148,19 @@ unsigned char *parseCompareString() {
rb->snprintf(errormsg,250,"'%d' found where STRING/STRINGID expected\n",currentToken->kind);
return 0;
}
-
- contains=currentToken->kind==TOKEN_CONTAINS;
+
if(currentToken->kind==TOKEN_CONTAINS ||
- currentToken->kind==TOKEN_EQUALS)
+ currentToken->kind==TOKEN_EQUALS) {
+ if(currentToken->kind==TOKEN_CONTAINS) {
+ contains=1;
+ PUTS("Contains");
+ }
+ else {
+ contains=0;
+ PUTS("Equals");
+ }
parser_acceptIt();
+ }
else {
syntaxerror=1;
rb->snprintf(errormsg,250,"'%d' found where CONTAINS/EQUALS expected\n",currentToken->kind);
diff --git a/apps/plugins/searchengine/searchengine.c b/apps/plugins/searchengine/searchengine.c
index 0cb090e..3926b15 100644
--- a/apps/plugins/searchengine/searchengine.c
+++ b/apps/plugins/searchengine/searchengine.c
@@ -54,7 +54,7 @@ void setmallocpos(void *pointer)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
unsigned char *result,buf[500];
- int parsefd;
+ int parsefd,hits;
/* this macro should be called as the first thing you do in the plugin.
it test that the api version and model the plugin was compiled for
matches the machine it is running on */
@@ -78,14 +78,20 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->snprintf(buf,250,"Retval: 0x%x",result);
PUTS(buf);
rb->close(parsefd);
+ hits=0;
if(result!=0) {
int fd=rb->open("/search.m3u", O_WRONLY|O_CREAT|O_TRUNC);
int i;
for(i=0;i<rb->tagdbheader->filecount;i++)
- if(result[i])
+ if(result[i]) {
+ hits++;
rb->fdprintf(fd,"%s\n",getfilename(i));
+ }
/* rb->write(fd,result,rb->tagdbheader->filecount);*/
rb->close(fd);
}
+ rb->snprintf(buf,250,"Hits: %d",hits);
+ PUTS(buf);
+ rb->sleep(HZ*3);
return PLUGIN_OK;
}
diff --git a/apps/plugins/searchengine/token.h b/apps/plugins/searchengine/token.h
index 0ce2716..0df4a6e 100644
--- a/apps/plugins/searchengine/token.h
+++ b/apps/plugins/searchengine/token.h
@@ -51,7 +51,7 @@
struct token {
unsigned char kind;
char spelling[256];
- int intvalue;
+ long intvalue;
};
char *getstring(struct token *token);