summaryrefslogtreecommitdiff
path: root/apps/plugins/searchengine/searchengine.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/searchengine/searchengine.c')
-rw-r--r--apps/plugins/searchengine/searchengine.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/apps/plugins/searchengine/searchengine.c b/apps/plugins/searchengine/searchengine.c
index 5065da7e78..0cb090e141 100644
--- a/apps/plugins/searchengine/searchengine.c
+++ b/apps/plugins/searchengine/searchengine.c
@@ -50,19 +50,16 @@ void setmallocpos(void *pointer)
50 audio_buffer_free = audio_bufferpointer - audio_bufferbase; 50 audio_buffer_free = audio_bufferpointer - audio_bufferbase;
51} 51}
52 52
53struct token tokenstream[10];
54
55/* this is the plugin entry point */ 53/* this is the plugin entry point */
56enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 54enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
57{ 55{
58 unsigned char *result,buf[500]; 56 unsigned char *result,buf[500];
57 int parsefd;
59 /* this macro should be called as the first thing you do in the plugin. 58 /* this macro should be called as the first thing you do in the plugin.
60 it test that the api version and model the plugin was compiled for 59 it test that the api version and model the plugin was compiled for
61 matches the machine it is running on */ 60 matches the machine it is running on */
62 TEST_PLUGIN_API(api); 61 TEST_PLUGIN_API(api);
63 62
64 (void)parameter;
65
66 /* if you are using a global api pointer, don't forget to copy it! 63 /* if you are using a global api pointer, don't forget to copy it!
67 otherwise you will get lovely "I04: IllInstr" errors... :-) */ 64 otherwise you will get lovely "I04: IllInstr" errors... :-) */
68 rb = api; 65 rb = api;
@@ -72,21 +69,15 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
72 69
73 /* now go ahead and have fun! */ 70 /* now go ahead and have fun! */
74 PUTS("SearchEngine v0.1"); 71 PUTS("SearchEngine v0.1");
75 tokenstream[0].kind=TOKEN_NUMIDENTIFIER; 72 parsefd=rb->open(parameter,O_RDONLY);
76 tokenstream[0].intvalue=INTVALUE_YEAR; 73 if(parsefd<0) {
77 tokenstream[1].kind=TOKEN_GTE; 74 rb->splash(2*HZ,true,"Unable to open search tokenstream");
78 tokenstream[2].kind=TOKEN_NUM; 75 return PLUGIN_ERROR;
79 tokenstream[2].intvalue=1980; 76 }
80 tokenstream[3].kind=TOKEN_AND; 77 result=parse(parsefd);
81 tokenstream[4].kind=TOKEN_NUMIDENTIFIER;
82 tokenstream[4].intvalue=INTVALUE_YEAR;
83 tokenstream[5].kind=TOKEN_LT;
84 tokenstream[6].kind=TOKEN_NUM;
85 tokenstream[6].intvalue=1990;
86 tokenstream[7].kind=TOKEN_EOF;
87 result=parse(tokenstream);
88 rb->snprintf(buf,250,"Retval: 0x%x",result); 78 rb->snprintf(buf,250,"Retval: 0x%x",result);
89 PUTS(buf); 79 PUTS(buf);
80 rb->close(parsefd);
90 if(result!=0) { 81 if(result!=0) {
91 int fd=rb->open("/search.m3u", O_WRONLY|O_CREAT|O_TRUNC); 82 int fd=rb->open("/search.m3u", O_WRONLY|O_CREAT|O_TRUNC);
92 int i; 83 int i;