diff options
author | Nils Wallménius <nils@rockbox.org> | 2006-12-11 20:21:36 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2006-12-11 20:21:36 +0000 |
commit | ed15e2994d66ce917abfe3ca9996e26b5f5b0e42 (patch) | |
tree | 33041bb92c3544277e9c5e8b8e1646d8ce046a13 /apps | |
parent | e22649929f693ce9257043885a7bb3d7ad6fd06c (diff) | |
download | rockbox-ed15e2994d66ce917abfe3ca9996e26b5f5b0e42.tar.gz rockbox-ed15e2994d66ce917abfe3ca9996e26b5f5b0e42.zip |
1) Delete unused files from old database and old gui files 2) Remove unneccesary includes of the old database header 3) Delete the deprecated databox plugin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11715 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs.c | 1 | ||||
-rw-r--r-- | apps/database.c | 530 | ||||
-rw-r--r-- | apps/database.h | 89 | ||||
-rw-r--r-- | apps/gui/select.c | 109 | ||||
-rw-r--r-- | apps/gui/select.h | 87 | ||||
-rw-r--r-- | apps/main.c | 1 | ||||
-rw-r--r-- | apps/onplay.c | 1 | ||||
-rw-r--r-- | apps/plugins/SUBDIRS | 1 | ||||
-rw-r--r-- | apps/plugins/databox/Makefile | 105 | ||||
-rw-r--r-- | apps/plugins/databox/databox.c | 395 | ||||
-rw-r--r-- | apps/plugins/databox/databox.h | 60 | ||||
-rw-r--r-- | apps/plugins/databox/editparser.c | 205 | ||||
-rw-r--r-- | apps/plugins/databox/editparser.h | 34 | ||||
-rw-r--r-- | apps/plugins/databox/edittoken.c | 204 | ||||
-rw-r--r-- | apps/plugins/databox/edittoken.h | 97 | ||||
-rw-r--r-- | apps/settings_menu.c | 1 |
16 files changed, 0 insertions, 1920 deletions
diff --git a/apps/codecs.c b/apps/codecs.c index dd3dddfccc..a093c2b601 100644 --- a/apps/codecs.c +++ b/apps/codecs.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include "powermgmt.h" | 48 | #include "powermgmt.h" |
49 | #include "system.h" | 49 | #include "system.h" |
50 | #include "sound.h" | 50 | #include "sound.h" |
51 | #include "database.h" | ||
52 | #include "splash.h" | 51 | #include "splash.h" |
53 | #include "general.h" | 52 | #include "general.h" |
54 | 53 | ||
diff --git a/apps/database.c b/apps/database.c deleted file mode 100644 index df069538a2..0000000000 --- a/apps/database.c +++ /dev/null | |||
@@ -1,530 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Michiel van der Kolk | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #define _GNU_SOURCE | ||
20 | #include <stdio.h> | ||
21 | #include <string.h> | ||
22 | #include "file.h" | ||
23 | #include "screens.h" | ||
24 | #include "kernel.h" | ||
25 | #include "tree.h" | ||
26 | #include "lcd.h" | ||
27 | #include "font.h" | ||
28 | #include "settings.h" | ||
29 | #include "icons.h" | ||
30 | #include "status.h" | ||
31 | #include "debug.h" | ||
32 | #include "button.h" | ||
33 | #include "menu.h" | ||
34 | #include "main_menu.h" | ||
35 | #include "mpeg.h" | ||
36 | #include "misc.h" | ||
37 | #include "ata.h" | ||
38 | #include "filetypes.h" | ||
39 | #include "applimits.h" | ||
40 | #include "icons.h" | ||
41 | #include "lang.h" | ||
42 | #include "keyboard.h" | ||
43 | #include "database.h" | ||
44 | #include "autoconf.h" | ||
45 | #include "splash.h" | ||
46 | |||
47 | #if CONFIG_CODEC == SWCODEC | ||
48 | #include "playback.h" | ||
49 | #else | ||
50 | #include "mpeg.h" | ||
51 | #endif | ||
52 | |||
53 | #include "logf.h" | ||
54 | |||
55 | /* internal functions */ | ||
56 | void writetagdbheader(void); | ||
57 | void writefentry(struct mp3entry *id); | ||
58 | void getfentrybyoffset(struct mp3entry *id,int offset); | ||
59 | void update_fentryoffsets(int start, int end); | ||
60 | void writerundbheader(void); | ||
61 | void getrundbentrybyoffset(struct mp3entry *id,int offset); | ||
62 | void writerundbentry(struct mp3entry *id); | ||
63 | int getfentrybyfilename(struct mp3entry *id); | ||
64 | void clearfileentryinfo(struct mp3entry *id); | ||
65 | void clearruntimeinfo(struct mp3entry *id); | ||
66 | int findrundbentry(struct mp3entry *id); | ||
67 | |||
68 | int getfentrybyhash(int hash); | ||
69 | int deletefentry(char *fname); | ||
70 | int tagdb_shiftdown(int targetoffset, int startingoffset, int bytes); | ||
71 | int tagdb_shiftup(int targetoffset, int startingoffset, int bytes); | ||
72 | |||
73 | static char sbuf[MAX_PATH]; | ||
74 | |||
75 | int tagdb_fd = -1; | ||
76 | int tagdb_initialized = 0; | ||
77 | struct tagdb_header tagdbheader; | ||
78 | |||
79 | int tagdb_init(void) | ||
80 | { | ||
81 | unsigned char* ptr = (unsigned char*)&tagdbheader.version; | ||
82 | #ifdef ROCKBOX_LITTLE_ENDIAN | ||
83 | int i, *p; | ||
84 | #endif | ||
85 | |||
86 | tagdb_fd = open(ROCKBOX_DIR "/rockbox.tagdb", O_RDWR); | ||
87 | if (tagdb_fd < 0) { | ||
88 | DEBUGF("Failed opening database\n"); | ||
89 | return -1; | ||
90 | } | ||
91 | read(tagdb_fd, &tagdbheader, 68); | ||
92 | |||
93 | if (ptr[0] != 'R' || | ||
94 | ptr[1] != 'D' || | ||
95 | ptr[2] != 'B') | ||
96 | { | ||
97 | gui_syncsplash(HZ, true, | ||
98 | (unsigned char *)"Not a rockbox ID3 database!"); | ||
99 | return -1; | ||
100 | } | ||
101 | #ifdef ROCKBOX_LITTLE_ENDIAN | ||
102 | p=(int *)&tagdbheader; | ||
103 | for(i=0;i<17;i++) { | ||
104 | *p=BE32(*p); | ||
105 | p++; | ||
106 | } | ||
107 | #endif | ||
108 | if ( (tagdbheader.version&0xFF) != TAGDB_VERSION) | ||
109 | { | ||
110 | gui_syncsplash(HZ, true, | ||
111 | (unsigned char *)"Unsupported database version %d!", | ||
112 | tagdbheader.version&0xFF); | ||
113 | return -1; | ||
114 | } | ||
115 | |||
116 | if (tagdbheader.songstart > tagdbheader.filestart || | ||
117 | tagdbheader.albumstart > tagdbheader.songstart || | ||
118 | tagdbheader.artiststart > tagdbheader.albumstart) | ||
119 | { | ||
120 | gui_syncsplash(HZ, true, (unsigned char *)"Corrupt ID3 database!"); | ||
121 | return -1; | ||
122 | } | ||
123 | |||
124 | tagdb_initialized = 1; | ||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | void tagdb_shutdown(void) | ||
129 | { | ||
130 | if (tagdb_fd >= 0) | ||
131 | close(tagdb_fd); | ||
132 | tagdb_initialized = 0; | ||
133 | } | ||
134 | |||
135 | /* NOTE: All these functions below are yet untested. */ | ||
136 | |||
137 | /*** TagDatabase code ***/ | ||
138 | |||
139 | void writetagdbheader(void) | ||
140 | { | ||
141 | lseek(tagdb_fd,0,SEEK_SET); | ||
142 | write(tagdb_fd, &tagdbheader, 68); | ||
143 | fsync(tagdb_fd); | ||
144 | } | ||
145 | |||
146 | void writefentry(struct mp3entry *id) | ||
147 | { long temp; | ||
148 | if(!id->fileentryoffset) | ||
149 | return; | ||
150 | lseek(tagdb_fd,id->fileentryoffset,SEEK_SET); | ||
151 | write(tagdb_fd,id->path,tagdbheader.filelen); | ||
152 | temp=id->filehash; | ||
153 | write(tagdb_fd,&temp,4); | ||
154 | temp=id->songentryoffset; | ||
155 | write(tagdb_fd,&temp,4); | ||
156 | temp=id->rundbentryoffset; | ||
157 | write(tagdb_fd,&temp,4); | ||
158 | } | ||
159 | |||
160 | void getfentrybyoffset(struct mp3entry *id,int offset) | ||
161 | { | ||
162 | clearfileentryinfo(id); | ||
163 | lseek(tagdb_fd,offset,SEEK_SET); | ||
164 | read(tagdb_fd,sbuf,tagdbheader.filelen); | ||
165 | id->fileentryoffset=offset; | ||
166 | read(tagdb_fd,&id->filehash,4); | ||
167 | read(tagdb_fd,&id->songentryoffset,4); | ||
168 | read(tagdb_fd,&id->rundbentryoffset,4); | ||
169 | } | ||
170 | |||
171 | #define getfentrybyrecord(_y_,_x_) getfentrybyoffset(_y_,FILERECORD2OFFSET(_x_)) | ||
172 | |||
173 | int getfentrybyfilename(struct mp3entry *id) | ||
174 | { | ||
175 | int min=0; | ||
176 | int max=tagdbheader.filecount; | ||
177 | while(min<max) { | ||
178 | int mid=(min+max)/2; | ||
179 | int compare; | ||
180 | getfentrybyrecord(id,mid); | ||
181 | compare=strcasecmp(id->path,sbuf); | ||
182 | if(compare==0) | ||
183 | return 1; | ||
184 | else if(compare<0) | ||
185 | max=mid; | ||
186 | else | ||
187 | min=mid+1; | ||
188 | } | ||
189 | clearfileentryinfo(id); | ||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | #if 0 | ||
194 | int getfentrybyhash(int hash) | ||
195 | { | ||
196 | int min=0; | ||
197 | for(min=0;min<tagdbheader.filecount;min++) { | ||
198 | getfentrybyrecord(min); | ||
199 | if(hash==fe.hash) | ||
200 | return 1; | ||
201 | } | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | int deletefentry(char *fname) | ||
206 | { | ||
207 | if(!getfentrybyfilename(fname)) | ||
208 | return 0; | ||
209 | int restrecord = currentferecord+1; | ||
210 | if(currentferecord!=tagdbheader.filecount) /* file is not last entry */ | ||
211 | tagdb_shiftdown(FILERECORD2OFFSET(currentferecord), | ||
212 | FILERECORD2OFFSET(restrecord), | ||
213 | (tagdbheader.filecount-restrecord)*FILEENTRY_SIZE); | ||
214 | ftruncate(tagdb_fd,lseek(tagdb_fd,0,SEEK_END)-FILEENTRY_SIZE); | ||
215 | tagdbheader.filecount--; | ||
216 | update_fentryoffsets(restrecord,tagdbheader.filecount); | ||
217 | writetagdbheader(); | ||
218 | return 1; | ||
219 | } | ||
220 | |||
221 | void update_fentryoffsets(int start, int end) | ||
222 | { | ||
223 | int i; | ||
224 | for(i=start;i<end;i++) { | ||
225 | getfentrybyrecord(i); | ||
226 | if(fe.songentry!=-1) { | ||
227 | int p; | ||
228 | lseek(tagdb_fd,fe.songentry+tagdbheader.songlen+8,SEEK_SET); | ||
229 | read(tagdb_fd,&p,sizeof(int)); | ||
230 | if(p!=currentfeoffset) { | ||
231 | p=currentfeoffset; | ||
232 | lseek(tagdb_fd,fe.songentry+tagdbheader.songlen+8,SEEK_SET); | ||
233 | write(tagdb_fd,&p,sizeof(int)); | ||
234 | } | ||
235 | } | ||
236 | if(fe.rundbentry!=-1) { | ||
237 | gui_syncsplash(HZ*2,true, "o.o.. found a rundbentry? o.o; didn't update " | ||
238 | "it, update the code o.o;"); | ||
239 | } | ||
240 | } | ||
241 | } | ||
242 | |||
243 | int tagdb_shiftdown(int targetoffset, int startingoffset, int bytes) | ||
244 | { | ||
245 | int amount; | ||
246 | if(targetoffset>=startingoffset) { | ||
247 | gui_syncsplash(HZ*2,true,"Woah. no beeping way. (tagdb_shiftdown)"); | ||
248 | return 0; | ||
249 | } | ||
250 | lseek(tagdb_fd,startingoffset,SEEK_SET); | ||
251 | while((amount=read(tagdb_fd,sbuf,(bytes > 1024) ? 1024 : bytes))) { | ||
252 | int written; | ||
253 | startingoffset+=amount; | ||
254 | lseek(tagdb_fd,targetoffset,SEEK_SET); | ||
255 | written=write(tagdb_fd,sbuf,amount); | ||
256 | targetoffset+=written; | ||
257 | if(amount!=written) { | ||
258 | gui_syncsplash(HZ*2,true,"Something went very wrong. expect database " | ||
259 | "corruption. (tagdb_shiftdown)"); | ||
260 | return 0; | ||
261 | } | ||
262 | lseek(tagdb_fd,startingoffset,SEEK_SET); | ||
263 | bytes-=amount; | ||
264 | } | ||
265 | return 1; | ||
266 | } | ||
267 | |||
268 | int tagdb_shiftup(int targetoffset, int startingoffset, int bytes) | ||
269 | { | ||
270 | int amount,amount2; | ||
271 | int readpos,writepos,filelen; | ||
272 | if(targetoffset<=startingoffset) { | ||
273 | gui_syncsplash(HZ*2,true,"Um. no. (tagdb_shiftup)"); | ||
274 | return 0; | ||
275 | } | ||
276 | filelen=lseek(tagdb_fd,0,SEEK_END); | ||
277 | readpos=startingoffset+bytes; | ||
278 | do { | ||
279 | amount=bytes>1024 ? 1024 : bytes; | ||
280 | readpos-=amount; | ||
281 | writepos=readpos+targetoffset-startingoffset; | ||
282 | lseek(tagdb_fd,readpos,SEEK_SET); | ||
283 | amount2=read(tagdb_fd,sbuf,amount); | ||
284 | if(amount2!=amount) { | ||
285 | gui_syncsplash(HZ*2,true,"Something went very wrong. expect database " | ||
286 | "corruption. (tagdb_shiftup)"); | ||
287 | return 0; | ||
288 | } | ||
289 | lseek(tagdb_fd,writepos,SEEK_SET); | ||
290 | amount=write(tagdb_fd,sbuf,amount2); | ||
291 | if(amount2!=amount) { | ||
292 | gui_syncsplash(HZ*2,true,"Something went very wrong. expect database " | ||
293 | "corruption. (tagdb_shiftup)"); | ||
294 | return 0; | ||
295 | } | ||
296 | bytes-=amount; | ||
297 | } while (amount>0); | ||
298 | if(bytes==0) | ||
299 | return 1; | ||
300 | else { | ||
301 | gui_syncsplash(HZ*2,true,"Something went wrong, >.>;; (tagdb_shiftup)"); | ||
302 | return 0; | ||
303 | } | ||
304 | } | ||
305 | #endif | ||
306 | |||
307 | /*** end TagDatabase code ***/ | ||
308 | |||
309 | int rundb_fd = -1; | ||
310 | int rundb_initialized = 0; | ||
311 | struct rundb_header rundbheader; | ||
312 | |||
313 | static long rundbsize; | ||
314 | |||
315 | /*** RuntimeDatabase code ***/ | ||
316 | |||
317 | void rundb_unbuffer_track(struct mp3entry *id, bool last_track) { | ||
318 | writeruntimeinfo(id); | ||
319 | if(last_track) { | ||
320 | fsync(rundb_fd); | ||
321 | fsync(tagdb_fd); | ||
322 | } | ||
323 | } | ||
324 | |||
325 | void rundb_track_change(struct mp3entry *id) { | ||
326 | id->playcount++; | ||
327 | } | ||
328 | |||
329 | void rundb_buffer_track(struct mp3entry *id, bool last_track) { | ||
330 | loadruntimeinfo(id); | ||
331 | if(last_track) { | ||
332 | fsync(rundb_fd); | ||
333 | fsync(tagdb_fd); | ||
334 | } | ||
335 | } | ||
336 | |||
337 | int rundb_init(void) | ||
338 | { | ||
339 | unsigned char* ptr = (unsigned char*)&rundbheader.version; | ||
340 | #ifdef ROCKBOX_LITTLE_ENDIAN | ||
341 | int i, *p; | ||
342 | #endif | ||
343 | if(!tagdb_initialized) /* forget it.*/ | ||
344 | return -1; | ||
345 | |||
346 | if(!global_settings.runtimedb) /* user doesn't care */ | ||
347 | return -1; | ||
348 | |||
349 | rundb_fd = open(ROCKBOX_DIR "/rockbox.rundb", O_CREAT|O_RDWR); | ||
350 | if (rundb_fd < 0) { | ||
351 | DEBUGF("Failed opening database\n"); | ||
352 | return -1; | ||
353 | } | ||
354 | if(read(rundb_fd, &rundbheader, 8)!=8) { | ||
355 | ptr[0]=ptr[1]='R'; | ||
356 | ptr[2]='D'; | ||
357 | ptr[3]=0x1; | ||
358 | rundbheader.entrycount=0; | ||
359 | writerundbheader(); | ||
360 | } | ||
361 | |||
362 | if (ptr[0] != 'R' || | ||
363 | ptr[1] != 'R' || | ||
364 | ptr[2] != 'D') | ||
365 | { | ||
366 | gui_syncsplash(HZ, true, | ||
367 | (unsigned char *)"Not a rockbox runtime database!"); | ||
368 | return -1; | ||
369 | } | ||
370 | #ifdef ROCKBOX_LITTLE_ENDIAN | ||
371 | p=(int *)&rundbheader; | ||
372 | for(i=0;i<2;i++) { | ||
373 | *p=BE32(*p); | ||
374 | p++; | ||
375 | } | ||
376 | #endif | ||
377 | if ( (rundbheader.version&0xFF) != RUNDB_VERSION) | ||
378 | { | ||
379 | gui_syncsplash(HZ, true, (unsigned char *) | ||
380 | "Unsupported runtime database version %d!", | ||
381 | rundbheader.version&0xFF); | ||
382 | return -1; | ||
383 | } | ||
384 | |||
385 | rundb_initialized = 1; | ||
386 | audio_set_track_buffer_event(&rundb_buffer_track); | ||
387 | audio_set_track_changed_event(&rundb_track_change); | ||
388 | audio_set_track_unbuffer_event(&rundb_unbuffer_track); | ||
389 | logf("rundb inited."); | ||
390 | |||
391 | rundbsize=lseek(rundb_fd,0,SEEK_END); | ||
392 | return 0; | ||
393 | } | ||
394 | |||
395 | void rundb_shutdown(void) | ||
396 | { | ||
397 | if (rundb_fd >= 0) | ||
398 | close(rundb_fd); | ||
399 | rundb_initialized = 0; | ||
400 | audio_set_track_buffer_event(NULL); | ||
401 | audio_set_track_unbuffer_event(NULL); | ||
402 | audio_set_track_changed_event(NULL); | ||
403 | } | ||
404 | |||
405 | void writerundbheader(void) | ||
406 | { | ||
407 | lseek(rundb_fd,0,SEEK_SET); | ||
408 | write(rundb_fd, &rundbheader, 8); | ||
409 | } | ||
410 | |||
411 | #define getrundbentrybyrecord(_y_,_x_) getrundbentrybyoffset(_y_,8+_x_*20) | ||
412 | |||
413 | void getrundbentrybyoffset(struct mp3entry *id,int offset) { | ||
414 | lseek(rundb_fd,offset+4,SEEK_SET); // skip fileentry offset | ||
415 | id->rundbentryoffset=offset; | ||
416 | read(rundb_fd,&id->rundbhash,4); | ||
417 | read(rundb_fd,&id->rating,2); | ||
418 | read(rundb_fd,&id->voladjust,2); | ||
419 | read(rundb_fd,&id->playcount,4); | ||
420 | read(rundb_fd,&id->lastplayed,4); | ||
421 | #ifdef ROCKBOX_LITTLE_ENDIAN | ||
422 | id->rundbhash=BE32(id->rundbhash); | ||
423 | id->rating=BE16(id->rating); | ||
424 | id->voladjust=BE16(id->voladjust); | ||
425 | id->playcount=BE32(id->playcount); | ||
426 | id->lastplayed=BE32(id->lastplayed); | ||
427 | #endif | ||
428 | } | ||
429 | |||
430 | int getrundbentrybyhash(struct mp3entry *id) | ||
431 | { | ||
432 | int min=0; | ||
433 | for(min=0;min<rundbheader.entrycount;min++) { | ||
434 | getrundbentrybyrecord(id,min); | ||
435 | if(id->filehash==id->rundbhash) | ||
436 | return 1; | ||
437 | } | ||
438 | clearruntimeinfo(id); | ||
439 | return 0; | ||
440 | } | ||
441 | |||
442 | void writerundbentry(struct mp3entry *id) | ||
443 | { | ||
444 | if(id->rundbhash==0) /* 0 = invalid rundb info. */ | ||
445 | return; | ||
446 | lseek(rundb_fd,id->rundbentryoffset,SEEK_SET); | ||
447 | write(rundb_fd,&id->fileentryoffset,4); | ||
448 | write(rundb_fd,&id->rundbhash,4); | ||
449 | write(rundb_fd,&id->rating,2); | ||
450 | write(rundb_fd,&id->voladjust,2); | ||
451 | write(rundb_fd,&id->playcount,4); | ||
452 | write(rundb_fd,&id->lastplayed,4); | ||
453 | } | ||
454 | |||
455 | void writeruntimeinfo(struct mp3entry *id) { | ||
456 | logf("rundb write"); | ||
457 | if(!id->rundbhash) | ||
458 | addrundbentry(id); | ||
459 | else | ||
460 | writerundbentry(id); | ||
461 | } | ||
462 | |||
463 | void clearfileentryinfo(struct mp3entry *id) { | ||
464 | id->fileentryoffset=0; | ||
465 | id->filehash=0; | ||
466 | id->songentryoffset=0; | ||
467 | id->rundbentryoffset=0; | ||
468 | } | ||
469 | |||
470 | void clearruntimeinfo(struct mp3entry *id) { | ||
471 | id->rundbhash=0; | ||
472 | id->rating=0; | ||
473 | id->voladjust=0; | ||
474 | id->playcount=0; | ||
475 | id->lastplayed=0; | ||
476 | } | ||
477 | |||
478 | void loadruntimeinfo(struct mp3entry *id) | ||
479 | { | ||
480 | logf("rundb load"); | ||
481 | clearruntimeinfo(id); | ||
482 | clearfileentryinfo(id); | ||
483 | if(!getfentrybyfilename(id)) { | ||
484 | logf("tagdb fail: %s",id->path); | ||
485 | return; /* file is not in tagdatabase, could not load. */ | ||
486 | } | ||
487 | if(id->rundbentryoffset!=-1 && id->rundbentryoffset<rundbsize) { | ||
488 | logf("load rundbentry: 0x%x", id->rundbentryoffset); | ||
489 | getrundbentrybyoffset(id, id->rundbentryoffset); | ||
490 | if(id->filehash != id->rundbhash) { | ||
491 | logf("Rundb: Hash mismatch. trying to repair entry.", | ||
492 | id->filehash, id->rundbhash); | ||
493 | findrundbentry(id); | ||
494 | } | ||
495 | } | ||
496 | else | ||
497 | #ifdef ROCKBOX_HAS_LOGF | ||
498 | if(!findrundbentry(id)) | ||
499 | logf("rundb:no entry and not found."); | ||
500 | #else | ||
501 | findrundbentry(id); | ||
502 | #endif | ||
503 | } | ||
504 | |||
505 | int findrundbentry(struct mp3entry *id) { | ||
506 | if(getrundbentrybyhash(id)) { | ||
507 | logf("Found existing rundb entry: 0x%x",id->rundbentryoffset); | ||
508 | writefentry(id); | ||
509 | return 1; | ||
510 | } | ||
511 | clearruntimeinfo(id); | ||
512 | return 0; | ||
513 | } | ||
514 | |||
515 | void addrundbentry(struct mp3entry *id) | ||
516 | { | ||
517 | /* first search for an entry with an equal hash. */ | ||
518 | /* if(findrundbentry(id)) | ||
519 | return; disabled cause this SHOULD have been checked at the buffer event.. */ | ||
520 | rundbheader.entrycount++; | ||
521 | writerundbheader(); | ||
522 | id->rundbentryoffset=lseek(rundb_fd,0,SEEK_END); | ||
523 | logf("Add rundb entry: 0x%x hash: 0x%x",id->rundbentryoffset,id->filehash); | ||
524 | id->rundbhash=id->filehash; | ||
525 | writefentry(id); | ||
526 | writerundbentry(id); | ||
527 | rundbsize=lseek(rundb_fd,0,SEEK_END); | ||
528 | } | ||
529 | |||
530 | /*** end RuntimeDatabase code ***/ | ||
diff --git a/apps/database.h b/apps/database.h deleted file mode 100644 index 3c9bef516c..0000000000 --- a/apps/database.h +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Michiel van der Kolk | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef DATABASE_H | ||
20 | #define DATABASE_H | ||
21 | |||
22 | #ifdef ROCKBOX_LITTLE_ENDIAN | ||
23 | #define BE32(_x_) (((_x_ & 0xff000000) >> 24) | \ | ||
24 | ((_x_ & 0x00ff0000) >> 8) | \ | ||
25 | ((_x_ & 0x0000ff00) << 8) | \ | ||
26 | ((_x_ & 0x000000ff) << 24)) | ||
27 | #define BE16(_x_) ( ((_x_&0xFF00) >> 8)|((_x_&0xFF)<<8)) | ||
28 | #else | ||
29 | #define BE32(_x_) _x_ | ||
30 | #define BE16(_x_) _x_ | ||
31 | #endif | ||
32 | |||
33 | #define SONGENTRY_SIZE (tagdbheader.songlen+12+tagdbheader.genrelen+12) | ||
34 | #define FILEENTRY_SIZE (tagdbheader.filelen+12) | ||
35 | #define ALBUMENTRY_SIZE (tagdbheader.albumlen+4+tagdbheader.songarraylen*4) | ||
36 | #define ARTISTENTRY_SIZE (tagdbheader.artistlen+tagdbheader.albumarraylen*4) | ||
37 | |||
38 | #define FILERECORD2OFFSET(_x_) (tagdbheader.filestart + _x_ * FILEENTRY_SIZE) | ||
39 | |||
40 | extern int tagdb_initialized; | ||
41 | |||
42 | struct tagdb_header { | ||
43 | int version; | ||
44 | int artiststart; | ||
45 | int albumstart; | ||
46 | int songstart; | ||
47 | int filestart; | ||
48 | int artistcount; | ||
49 | int albumcount; | ||
50 | int songcount; | ||
51 | int filecount; | ||
52 | int artistlen; | ||
53 | int albumlen; | ||
54 | int songlen; | ||
55 | int genrelen; | ||
56 | int filelen; | ||
57 | int songarraylen; | ||
58 | int albumarraylen; | ||
59 | int rundbdirty; | ||
60 | }; | ||
61 | |||
62 | extern struct tagdb_header tagdbheader; | ||
63 | extern int tagdb_fd; | ||
64 | |||
65 | int tagdb_init(void); | ||
66 | void tagdb_shutdown(void); | ||
67 | |||
68 | #define TAGDB_VERSION 3 | ||
69 | |||
70 | extern int rundb_fd, rundb_initialized; | ||
71 | extern struct rundb_header rundbheader; | ||
72 | |||
73 | struct rundb_header { | ||
74 | int version; | ||
75 | int entrycount; | ||
76 | }; | ||
77 | |||
78 | |||
79 | extern struct rundb_header rundbheader; | ||
80 | |||
81 | #define RUNDB_VERSION 1 | ||
82 | |||
83 | void tagdb_shutdown(void); | ||
84 | void addrundbentry(struct mp3entry *id); | ||
85 | void loadruntimeinfo(struct mp3entry *id); | ||
86 | void writeruntimeinfo(struct mp3entry *id); | ||
87 | int rundb_init(void); | ||
88 | void rundb_shutdown(void); | ||
89 | #endif | ||
diff --git a/apps/gui/select.c b/apps/gui/select.c deleted file mode 100644 index 12a93fcbcd..0000000000 --- a/apps/gui/select.c +++ /dev/null | |||
@@ -1,109 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Kevin Ferrare | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "select.h" | ||
21 | |||
22 | #include "lang.h" | ||
23 | #include "textarea.h" | ||
24 | #include "screen_access.h" | ||
25 | #include "kernel.h" | ||
26 | #include "action.h" | ||
27 | |||
28 | |||
29 | void gui_select_init_numeric(struct gui_select * select, | ||
30 | const char * title, | ||
31 | int init_value, | ||
32 | int min_value, | ||
33 | int max_value, | ||
34 | int step, | ||
35 | const char * unit, | ||
36 | option_formatter *formatter) | ||
37 | { | ||
38 | select->canceled=false; | ||
39 | select->validated=false; | ||
40 | option_select_init_numeric(&select->options, title, init_value, | ||
41 | min_value, max_value, step, unit, formatter); | ||
42 | } | ||
43 | |||
44 | void gui_select_init_items(struct gui_select * select, | ||
45 | const char * title, | ||
46 | int selected, | ||
47 | const struct opt_items * items, | ||
48 | int nb_items) | ||
49 | { | ||
50 | select->canceled=false; | ||
51 | select->validated=false; | ||
52 | option_select_init_items(&select->options, title, selected, items, nb_items); | ||
53 | } | ||
54 | |||
55 | void gui_select_draw(struct gui_select * select, struct screen * display) | ||
56 | { | ||
57 | char buffer[30]; | ||
58 | const char * selected=option_select_get_text(&(select->options), buffer, | ||
59 | sizeof buffer); | ||
60 | #ifdef HAVE_LCD_BITMAP | ||
61 | screen_set_xmargin(display, 0); | ||
62 | #endif | ||
63 | gui_textarea_clear(display); | ||
64 | display->puts_scroll(0, 0, (unsigned char *)select->options.title); | ||
65 | |||
66 | if(select->canceled) | ||
67 | display->puts_scroll(0, 0, str(LANG_MENU_SETTING_CANCEL)); | ||
68 | display->puts_scroll(0, 1, (unsigned char *)selected); | ||
69 | gui_textarea_update(display); | ||
70 | } | ||
71 | |||
72 | void gui_syncselect_draw(struct gui_select * select) | ||
73 | { | ||
74 | int i; | ||
75 | FOR_NB_SCREENS(i) | ||
76 | gui_select_draw(select, &(screens[i])); | ||
77 | } | ||
78 | |||
79 | bool gui_syncselect_do_button(struct gui_select * select, int button) | ||
80 | { | ||
81 | switch(button) | ||
82 | { | ||
83 | case ACTION_SETTINGS_INCREPEAT: | ||
84 | select->options.limit_loop = true; | ||
85 | case ACTION_SETTINGS_INC: | ||
86 | option_select_next(&select->options); | ||
87 | return(true); | ||
88 | |||
89 | case ACTION_SETTINGS_DECREPEAT: | ||
90 | select->options.limit_loop = true; | ||
91 | case ACTION_SETTINGS_DEC: | ||
92 | option_select_prev(&select->options); | ||
93 | return(true); | ||
94 | |||
95 | case ACTION_STD_OK: | ||
96 | case ACTION_STD_PREV: /*NOTE: this is in CONTEXT_SETTINGS ! */ | ||
97 | select->validated=true; | ||
98 | return(false); | ||
99 | |||
100 | case ACTION_STD_CANCEL: | ||
101 | select->canceled = true; | ||
102 | gui_syncselect_draw(select); | ||
103 | sleep(HZ/2); | ||
104 | action_signalscreenchange(); | ||
105 | return(false); | ||
106 | } | ||
107 | return(false); | ||
108 | } | ||
109 | |||
diff --git a/apps/gui/select.h b/apps/gui/select.h deleted file mode 100644 index 2556a683c8..0000000000 --- a/apps/gui/select.h +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Kevin Ferrare | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef _GUI_SELECT_H_ | ||
21 | #define _GUI_SELECT_H_ | ||
22 | #include "screen_access.h" | ||
23 | #include "settings.h" | ||
24 | #include "option_select.h" | ||
25 | |||
26 | struct gui_select | ||
27 | { | ||
28 | bool canceled; | ||
29 | bool validated; | ||
30 | struct option_select options; | ||
31 | }; | ||
32 | |||
33 | /* | ||
34 | * Initializes a select that let's you choose between several numeric values | ||
35 | * - title : the title of the select | ||
36 | * - init_value : the initial value the number will be | ||
37 | * - min_value, max_value : bounds to the value | ||
38 | * - step : the ammount you want to add / withdraw to the initial number | ||
39 | * each time a key is pressed | ||
40 | * - unit : the unit in which the value is (ex "s", "bytes", ...) | ||
41 | * - formatter : a callback function that generates a string | ||
42 | * from the number it gets | ||
43 | */ | ||
44 | extern void gui_select_init_numeric(struct gui_select * select, | ||
45 | const char * title, | ||
46 | int init_value, | ||
47 | int min_value, | ||
48 | int max_value, | ||
49 | int step, | ||
50 | const char * unit, | ||
51 | option_formatter *formatter); | ||
52 | |||
53 | |||
54 | /* | ||
55 | * Initializes a select that let's you choose between options in a list | ||
56 | * - title : the title of the select | ||
57 | * - selected : the initially selected item | ||
58 | * - items : the list of items, defined in settings.h | ||
59 | * - nb_items : the number of items in the 'items' list | ||
60 | */ | ||
61 | extern void gui_select_init_items(struct gui_select * select, | ||
62 | const char * title, | ||
63 | int selected, | ||
64 | const struct opt_items * items, | ||
65 | int nb_items | ||
66 | ); | ||
67 | |||
68 | /* | ||
69 | * Draws the select on the given screen | ||
70 | * - select : the select struct | ||
71 | * - display : the display on which you want to output | ||
72 | */ | ||
73 | extern void gui_select_draw(struct gui_select * select, struct screen * display); | ||
74 | |||
75 | /* | ||
76 | * Draws the select on all the screens | ||
77 | * - select : the select struct | ||
78 | */ | ||
79 | extern void gui_syncselect_draw(struct gui_select * select); | ||
80 | |||
81 | /* | ||
82 | * Handles key events for a synced (drawn on all screens) select | ||
83 | * - select : the select struct | ||
84 | */ | ||
85 | extern bool gui_syncselect_do_button(struct gui_select * select, int button); | ||
86 | |||
87 | #endif /* _GUI_SELECT_H_ */ | ||
diff --git a/apps/main.c b/apps/main.c index bfc331dc88..1d590286e2 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -59,7 +59,6 @@ | |||
59 | #include "talk.h" | 59 | #include "talk.h" |
60 | #include "plugin.h" | 60 | #include "plugin.h" |
61 | #include "misc.h" | 61 | #include "misc.h" |
62 | #include "database.h" | ||
63 | #include "dircache.h" | 62 | #include "dircache.h" |
64 | #ifdef HAVE_TAGCACHE | 63 | #ifdef HAVE_TAGCACHE |
65 | #include "tagcache.h" | 64 | #include "tagcache.h" |
diff --git a/apps/onplay.c b/apps/onplay.c index 90117eaa19..12573dae64 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -58,7 +58,6 @@ | |||
58 | #endif | 58 | #endif |
59 | #include "main_menu.h" | 59 | #include "main_menu.h" |
60 | #include "sound_menu.h" | 60 | #include "sound_menu.h" |
61 | #include "database.h" | ||
62 | #if CONFIG_CODEC == SWCODEC | 61 | #if CONFIG_CODEC == SWCODEC |
63 | #include "eq_menu.h" | 62 | #include "eq_menu.h" |
64 | #endif | 63 | #endif |
diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS index 74e7fe36d8..c285a9e2d6 100644 --- a/apps/plugins/SUBDIRS +++ b/apps/plugins/SUBDIRS | |||
@@ -1,7 +1,6 @@ | |||
1 | #ifndef IRIVER_IFP7XX_SERIES | 1 | #ifndef IRIVER_IFP7XX_SERIES |
2 | 2 | ||
3 | /* For all targets */ | 3 | /* For all targets */ |
4 | databox | ||
5 | 4 | ||
6 | /* For various targets... */ | 5 | /* For various targets... */ |
7 | #if (CONFIG_KEYPAD == RECORDER_PAD) || \ | 6 | #if (CONFIG_KEYPAD == RECORDER_PAD) || \ |
diff --git a/apps/plugins/databox/Makefile b/apps/plugins/databox/Makefile deleted file mode 100644 index 3e026757c4..0000000000 --- a/apps/plugins/databox/Makefile +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | # __________ __ ___. | ||
2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
6 | # \/ \/ \/ \/ \/ | ||
7 | # $Id$ | ||
8 | # | ||
9 | |||
10 | INCLUDES = -I$(APPSDIR) -I.. -I. $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ | ||
11 | -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR) | ||
12 | CFLAGS = $(INCLUDES) $(GCCOPTS) -O3 $(TARGET) $(EXTRA_DEFINES) \ | ||
13 | -DTARGET_ID=$(TARGET_ID) -DMEM=${MEMORYSIZE} -DPLUGIN | ||
14 | |||
15 | ifdef APPEXTRA | ||
16 | INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) | ||
17 | endif | ||
18 | |||
19 | LINKFILE := $(OBJDIR)/link.lds | ||
20 | DEPFILE = $(OBJDIR)/dep-databox | ||
21 | SRC = databox.c editparser.c edittoken.c | ||
22 | |||
23 | SOURCES = $(SRC) | ||
24 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) | ||
25 | DIRS = . | ||
26 | |||
27 | LDS := ../plugin.lds | ||
28 | OUTPUT = $(OUTDIR)/databox.rock | ||
29 | |||
30 | all: $(OUTPUT) | ||
31 | |||
32 | ifndef SIMVER | ||
33 | $(OBJDIR)/databox.elf: $(OBJS) $(LINKFILE) | ||
34 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -O -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -lplugin -lgcc \ | ||
35 | -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/databox.map | ||
36 | |||
37 | $(OUTPUT): $(OBJDIR)/databox.elf | ||
38 | $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@ | ||
39 | else | ||
40 | |||
41 | ifeq ($(SIMVER), x11) | ||
42 | ################################################### | ||
43 | # This is the X11 simulator version | ||
44 | |||
45 | $(OUTPUT): $(OBJS) | ||
46 | $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@ | ||
47 | ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN) | ||
48 | # 'x' must be kept or you'll have "Win32 error 5" | ||
49 | # $ fgrep 5 /usr/include/w32api/winerror.h | head -1 | ||
50 | # #define ERROR_ACCESS_DENIED 5L | ||
51 | else | ||
52 | @chmod -x $@ | ||
53 | endif | ||
54 | |||
55 | else # end of x11-simulator | ||
56 | ifeq ($(SIMVER), sdl) | ||
57 | ################################################### | ||
58 | # This is the SDL simulator version | ||
59 | |||
60 | $(OUTPUT): $(OBJS) | ||
61 | $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@ | ||
62 | ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN) | ||
63 | # 'x' must be kept or you'll have "Win32 error 5" | ||
64 | # $ fgrep 5 /usr/include/w32api/winerror.h | head -1 | ||
65 | # #define ERROR_ACCESS_DENIED 5L | ||
66 | else | ||
67 | @chmod -x $@ | ||
68 | endif | ||
69 | |||
70 | else # end of sdl-simulator | ||
71 | ################################################### | ||
72 | # This is the win32 simulator version | ||
73 | DLLTOOLFLAGS = --export-all | ||
74 | DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin | ||
75 | |||
76 | $(OUTPUT): $(OBJS) | ||
77 | $(call PRINTS,DLL $(@F))$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $(OBJS) | ||
78 | $(SILENT)$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $(OBJS) \ | ||
79 | $(BUILDDIR)/libplugin.a -o $@ | ||
80 | ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN) | ||
81 | # 'x' must be kept or you'll have "Win32 error 5" | ||
82 | # $ fgrep 5 /usr/include/w32api/winerror.h | head -1 | ||
83 | # #define ERROR_ACCESS_DENIED 5L | ||
84 | else | ||
85 | @chmod -x $@ | ||
86 | endif | ||
87 | endif # end of win32-simulator | ||
88 | endif | ||
89 | endif # end of simulator section | ||
90 | |||
91 | |||
92 | include $(TOOLSDIR)/make.inc | ||
93 | |||
94 | # MEMORYSIZE should be passed on to this makefile with the chosen memory size | ||
95 | # given in number of MB | ||
96 | $(LINKFILE): $(LDS) | ||
97 | $(call PRINTS,build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) \ | ||
98 | $(DEFINES) -E -P - >$@ | ||
99 | |||
100 | clean: | ||
101 | $(call PRINTS,cleaning databox)rm -rf $(OBJDIR)/databox | ||
102 | $(SILENT)rm -f $(OBJDIR)/databox.* $(DEPFILE) | ||
103 | |||
104 | -include $(DEPFILE) | ||
105 | |||
diff --git a/apps/plugins/databox/databox.c b/apps/plugins/databox/databox.c deleted file mode 100644 index 25836a7f07..0000000000 --- a/apps/plugins/databox/databox.c +++ /dev/null | |||
@@ -1,395 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Björn Stenberg | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "databox.h" | ||
20 | |||
21 | PLUGIN_HEADER | ||
22 | |||
23 | /* variable button definitions */ | ||
24 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | ||
25 | (CONFIG_KEYPAD == IRIVER_H300_PAD) | ||
26 | #define DBX_SELECT BUTTON_SELECT | ||
27 | #define DBX_STOP BUTTON_OFF | ||
28 | #elif CONFIG_KEYPAD == RECORDER_PAD | ||
29 | #define DBX_SELECT BUTTON_PLAY | ||
30 | #define DBX_STOP BUTTON_OFF | ||
31 | #elif CONFIG_KEYPAD == ONDIO_PAD | ||
32 | #define DBX_SELECT BUTTON_MENU | ||
33 | #define DBX_STOP BUTTON_OFF | ||
34 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | ||
35 | (CONFIG_KEYPAD == IPOD_3G_PAD) | ||
36 | #define DBX_SELECT BUTTON_SELECT | ||
37 | #define DBX_STOP BUTTON_MENU | ||
38 | #elif CONFIG_KEYPAD == PLAYER_PAD | ||
39 | #define DBX_SELECT BUTTON_PLAY | ||
40 | #define DBX_STOP BUTTON_STOP | ||
41 | #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD | ||
42 | #define DBX_SELECT BUTTON_SELECT | ||
43 | #define DBX_STOP BUTTON_PLAY | ||
44 | #elif CONFIG_KEYPAD == IAUDIO_X5_PAD | ||
45 | #define DBX_SELECT BUTTON_SELECT | ||
46 | #define DBX_STOP BUTTON_PLAY | ||
47 | #elif CONFIG_KEYPAD == GIGABEAT_PAD | ||
48 | #define DBX_SELECT BUTTON_SELECT | ||
49 | #define DBX_STOP BUTTON_A | ||
50 | #elif CONFIG_KEYPAD == IRIVER_H10_PAD | ||
51 | #define DBX_SELECT BUTTON_REW | ||
52 | #define DBX_STOP BUTTON_PLAY | ||
53 | #elif CONFIG_KEYPAD == SANSA_E200_PAD | ||
54 | #define DBX_SELECT BUTTON_SELECT | ||
55 | #define DBX_STOP BUTTON_POWER | ||
56 | #endif | ||
57 | |||
58 | #define MAX_TOKENS 70 | ||
59 | |||
60 | /* here is a global api struct pointer. while not strictly necessary, | ||
61 | it's nice not to have to pass the api pointer in all function calls | ||
62 | in the plugin */ | ||
63 | struct plugin_api* rb; | ||
64 | struct token tokenbuf[MAX_TOKENS]; | ||
65 | |||
66 | struct print printing; | ||
67 | struct editor editor; | ||
68 | struct editing editing; | ||
69 | |||
70 | extern int acceptedmask; | ||
71 | |||
72 | void databox_init(void) { | ||
73 | #ifdef HAVE_LCD_BITMAP | ||
74 | printing.fontfixed = rb->font_get(FONT_SYSFIXED); | ||
75 | rb->lcd_setfont(FONT_SYSFIXED); | ||
76 | printing.font_w = printing.fontfixed->maxwidth; | ||
77 | printing.font_h = printing.fontfixed->height; | ||
78 | #endif | ||
79 | printing.line=0; | ||
80 | printing.position=0; | ||
81 | editor.editingmode = INVALID_MARK; | ||
82 | editor.token = tokenbuf; | ||
83 | } | ||
84 | |||
85 | #ifdef HAVE_LCD_BITMAP | ||
86 | void print(char *word, int invert) { | ||
87 | int strlen=rb->strlen(word), newpos=printing.position+strlen+1; | ||
88 | if(newpos*printing.font_w>LCD_WIDTH) { | ||
89 | printing.line++; | ||
90 | printing.position=0; | ||
91 | newpos=printing.position+strlen+1; | ||
92 | } | ||
93 | /* Fixme: the display code needs to keep the current item visible instead of | ||
94 | * just displaying the first items. */ | ||
95 | if (printing.font_h*printing.line >= LCD_HEIGHT) | ||
96 | return; | ||
97 | rb->lcd_putsxy(printing.font_w*printing.position,printing.font_h*printing.line,word); | ||
98 | if(invert) { | ||
99 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | ||
100 | rb->lcd_fillrect(printing.font_w*printing.position,printing.font_h*printing.line,printing.font_w*strlen,printing.font_h); | ||
101 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
102 | } | ||
103 | rb->lcd_update_rect(printing.font_w*printing.position,printing.font_h*printing.line,printing.font_w*strlen,printing.font_h); | ||
104 | printing.position=newpos; | ||
105 | } | ||
106 | #else /* HAVE_LCD_CHARCELLS */ | ||
107 | #define MARKER_LEFT 0x81 | ||
108 | #define MARKER_RIGHT 0x82 | ||
109 | void print(char *word, int invert) { | ||
110 | int strlen = rb->strlen(word); | ||
111 | int newpos = printing.position + strlen + (invert ? 3 : 1); | ||
112 | if (newpos > 11) { | ||
113 | printing.line++; | ||
114 | printing.position = 0; | ||
115 | newpos = printing.position + strlen + (invert ? 3 : 1); | ||
116 | } | ||
117 | /* Fixme: the display code needs to keep the current item visible instead of | ||
118 | * just displaying the first items. */ | ||
119 | if (printing.line >= 2) | ||
120 | return; | ||
121 | if (invert) { | ||
122 | rb->lcd_putc(printing.position, printing.line, MARKER_LEFT); | ||
123 | rb->lcd_puts(printing.position + 1, printing.line, word); | ||
124 | rb->lcd_putc(printing.position + strlen + 1, printing.line, MARKER_RIGHT); | ||
125 | } | ||
126 | else | ||
127 | rb->lcd_puts(printing.position, printing.line, word); | ||
128 | printing.position = newpos; | ||
129 | } | ||
130 | #endif | ||
131 | |||
132 | void displaytstream(struct token *token) { | ||
133 | int index=0; | ||
134 | while(token[index].kind!=TOKEN_EOF||index==editor.currentindex) { | ||
135 | if(editing.selecting&&index==editor.currentindex) { | ||
136 | print(tokentypetostring(editing.selection_candidates[editing.currentselection]),1); | ||
137 | } | ||
138 | else | ||
139 | print(tokentostring(&token[index]),index==editor.currentindex ? 1 : 0); | ||
140 | index++; | ||
141 | } | ||
142 | } | ||
143 | |||
144 | void buildchoices(int mask) { | ||
145 | int i; | ||
146 | for(i=0;i<20;i++) | ||
147 | editing.selection_candidates[i]=-1; | ||
148 | i=0; | ||
149 | if(editing.selecting&& | ||
150 | editing.old_token.kind!=TOKEN_EOF && | ||
151 | editing.old_token.kind!=TOKEN_INVALID) { | ||
152 | editing.selection_candidates[i++]=TOKEN_EDIT; | ||
153 | } | ||
154 | if((mask&ACCEPT_EOF)&&editor.valid) | ||
155 | editing.selection_candidates[i++]=TOKEN_EOF; | ||
156 | if(mask&ACCEPT_NOT) | ||
157 | editing.selection_candidates[i++]=TOKEN_NOT; | ||
158 | if(mask&ACCEPT_BOOLOP) { | ||
159 | editing.selection_candidates[i++]=TOKEN_AND; | ||
160 | editing.selection_candidates[i++]=TOKEN_OR; | ||
161 | } | ||
162 | if(mask&ACCEPT_NUMOP) { | ||
163 | editing.selection_candidates[i++]=TOKEN_GT; | ||
164 | editing.selection_candidates[i++]=TOKEN_GTE; | ||
165 | editing.selection_candidates[i++]=TOKEN_LT; | ||
166 | editing.selection_candidates[i++]=TOKEN_LTE; | ||
167 | editing.selection_candidates[i++]=TOKEN_NE; | ||
168 | editing.selection_candidates[i++]=TOKEN_EQ; | ||
169 | } | ||
170 | if(mask&ACCEPT_STROP) { | ||
171 | editing.selection_candidates[i++]=TOKEN_CONTAINS; | ||
172 | editing.selection_candidates[i++]=TOKEN_EQUALS; | ||
173 | editing.selection_candidates[i++]=TOKEN_STARTSWITH; | ||
174 | editing.selection_candidates[i++]=TOKEN_ENDSWITH; | ||
175 | } | ||
176 | if(mask&ACCEPT_LPAREN) { | ||
177 | editing.selection_candidates[i++]=TOKEN_LPAREN; | ||
178 | } | ||
179 | if(mask&ACCEPT_RPAREN) { | ||
180 | editing.selection_candidates[i++]=TOKEN_RPAREN; | ||
181 | } | ||
182 | if(mask&ACCEPT_NUMARG) { | ||
183 | editing.selection_candidates[i++]=TOKEN_NUM; | ||
184 | editing.selection_candidates[i++]=TOKEN_YEAR; | ||
185 | editing.selection_candidates[i++]=TOKEN_RATING; | ||
186 | editing.selection_candidates[i++]=TOKEN_PLAYCOUNT; | ||
187 | editing.selection_candidates[i++]=TOKEN_AUTORATING; | ||
188 | editing.selection_candidates[i++]=TOKEN_TRACKNUM; | ||
189 | editing.selection_candidates[i++]=TOKEN_PLAYTIME; | ||
190 | editing.selection_candidates[i++]=TOKEN_SAMPLERATE; | ||
191 | editing.selection_candidates[i++]=TOKEN_BITRATE; | ||
192 | } | ||
193 | if(mask&ACCEPT_STRARG) { | ||
194 | editing.selection_candidates[i++]=TOKEN_STRING; | ||
195 | editing.selection_candidates[i++]=TOKEN_TITLE; | ||
196 | editing.selection_candidates[i++]=TOKEN_ARTIST; | ||
197 | editing.selection_candidates[i++]=TOKEN_ALBUM; | ||
198 | editing.selection_candidates[i++]=TOKEN_GENRE; | ||
199 | editing.selection_candidates[i++]=TOKEN_FILENAME; | ||
200 | } | ||
201 | editing.selectionmax=i; | ||
202 | } | ||
203 | |||
204 | /* returns tokencount or 0 if error */ | ||
205 | int readtstream(char *filename,struct token *token,int max) { | ||
206 | int tokencount=0; | ||
207 | int filelen,i; | ||
208 | int fd; | ||
209 | rb->memset(token,0,max*sizeof(struct token)); | ||
210 | fd=rb->open(filename,O_RDONLY); | ||
211 | if(fd>=0) { | ||
212 | filelen=rb->filesize(fd); | ||
213 | if(filelen>0) { | ||
214 | if(filelen % sizeof(struct token)) { | ||
215 | rb->splash(HZ*2,true,"Filesize not a multiple of sizeof(struct token)"); | ||
216 | rb->close(fd); | ||
217 | return 0; | ||
218 | } | ||
219 | tokencount=(filelen/sizeof(struct token))-1; | ||
220 | for(i=0;i<tokencount&&i<max;i++) { | ||
221 | rb->read(fd,&token[i],sizeof(struct token)); | ||
222 | token[i].intvalue=BE32(token[i].intvalue); | ||
223 | } | ||
224 | } | ||
225 | rb->close(fd); | ||
226 | } | ||
227 | return tokencount; | ||
228 | } | ||
229 | |||
230 | int writetstream(char *filename,struct token *token) { | ||
231 | int fd,i; | ||
232 | fd=rb->open(filename,O_WRONLY|O_CREAT|O_TRUNC); | ||
233 | if(fd<0) | ||
234 | return 0; | ||
235 | i=0; | ||
236 | while(token[i].kind!=TOKEN_EOF) { | ||
237 | token[i].intvalue=BE32(token[i].intvalue); | ||
238 | rb->write(fd,&token[i++],sizeof(struct token)); | ||
239 | } | ||
240 | token[i].intvalue=BE32(token[i].intvalue); | ||
241 | rb->write(fd,&token[i++],sizeof(struct token)); | ||
242 | rb->close(fd); | ||
243 | return i; | ||
244 | } | ||
245 | |||
246 | /* this is the plugin entry point */ | ||
247 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
248 | { | ||
249 | int button,done=0,abort=0; | ||
250 | char filename[100],buf[100]; | ||
251 | /* if you don't use the parameter, you can do like | ||
252 | this to avoid the compiler warning about it */ | ||
253 | (void)parameter; | ||
254 | |||
255 | /* if you are using a global api pointer, don't forget to copy it! | ||
256 | otherwise you will get lovely "I04: IllInstr" errors... :-) */ | ||
257 | rb = api; | ||
258 | |||
259 | /* now go ahead and have fun! */ | ||
260 | rb->splash(HZ*2, true, "Databox! Enter filename ^.^"); | ||
261 | databox_init(); | ||
262 | filename[0] = '\0'; | ||
263 | if(rb->kbd_input(filename, sizeof filename)) { | ||
264 | rb->splash(HZ*2, true, "Cancelled..."); | ||
265 | return PLUGIN_OK; | ||
266 | } | ||
267 | /* add / in front if omitted */ | ||
268 | if(filename[0]!='/') { | ||
269 | rb->strncpy(buf+1,filename,sizeof(filename)-1); | ||
270 | buf[0]='/'; | ||
271 | rb->strcpy(filename,buf); | ||
272 | } | ||
273 | /* add extension if omitted */ | ||
274 | if(rb->strncasecmp(filename+rb->strlen(filename)-4,".rsp",4)) { | ||
275 | rb->strcat(filename,".rsp"); | ||
276 | } | ||
277 | editor.currentindex=editor.tokencount | ||
278 | =readtstream(filename,editor.token,MAX_TOKENS); | ||
279 | editing.currentselection=0; | ||
280 | editing.selecting=0; | ||
281 | if(editor.currentindex==0) { | ||
282 | editor.valid=check_tokenstream(editor.token,editor.editingmode); | ||
283 | check_accepted(editor.token,editor.currentindex); | ||
284 | editing.selecting=1; | ||
285 | buildchoices(acceptedmask); | ||
286 | rb->memset(&editing.old_token,0,sizeof(struct token)); | ||
287 | } | ||
288 | do { | ||
289 | #ifdef HAVE_LCD_BITMAP | ||
290 | rb->lcd_setfont(FONT_SYSFIXED); | ||
291 | #endif | ||
292 | rb->lcd_clear_display(); | ||
293 | printing.line=0; | ||
294 | printing.position=0; | ||
295 | displaytstream(editor.token); | ||
296 | editor.valid=check_tokenstream(editor.token,editor.editingmode); | ||
297 | check_accepted(editor.token,editor.currentindex); | ||
298 | #ifdef HAVE_LCD_BITMAP | ||
299 | rb->lcd_update(); | ||
300 | #endif | ||
301 | button = rb->button_get(true); | ||
302 | switch (button) { | ||
303 | case BUTTON_LEFT: | ||
304 | #ifdef BUTTON_DOWN | ||
305 | case BUTTON_DOWN: | ||
306 | #endif | ||
307 | if (editing.selecting) | ||
308 | editing.currentselection = (editing.currentselection + | ||
309 | editing.selectionmax-1) % editing.selectionmax; | ||
310 | else | ||
311 | editor.currentindex = (editor.currentindex + editor.tokencount) | ||
312 | % (editor.tokencount+1); | ||
313 | break; | ||
314 | |||
315 | case BUTTON_RIGHT: | ||
316 | #ifdef BUTTON_UP | ||
317 | case BUTTON_UP: | ||
318 | #endif | ||
319 | if (editing.selecting) | ||
320 | editing.currentselection = (editing.currentselection+1) | ||
321 | % editing.selectionmax; | ||
322 | else | ||
323 | editor.currentindex = (editor.currentindex+1) | ||
324 | % (editor.tokencount+1); | ||
325 | break; | ||
326 | |||
327 | case DBX_SELECT: | ||
328 | if(editing.selecting) { | ||
329 | buildtoken(editing.selection_candidates[editing.currentselection], | ||
330 | &editor.token[editor.currentindex]); | ||
331 | editing.selecting=0; | ||
332 | if(editor.token[editor.currentindex].kind==TOKEN_EOF) | ||
333 | done=1; | ||
334 | else if(editor.currentindex==editor.tokencount) { | ||
335 | editor.tokencount++; | ||
336 | editor.currentindex++; | ||
337 | editor.valid=check_tokenstream(editor.token,editor.editingmode); | ||
338 | check_accepted(editor.token,editor.currentindex); | ||
339 | editing.selecting=1; | ||
340 | editing.currentselection=0; | ||
341 | buildchoices(acceptedmask); | ||
342 | rb->memcpy(&editing.old_token,&editor.token[editor.currentindex], | ||
343 | sizeof(struct token)); | ||
344 | } | ||
345 | } | ||
346 | else { | ||
347 | editing.selecting=1; | ||
348 | editing.currentselection=0; | ||
349 | buildchoices(acceptedmask); | ||
350 | rb->memcpy(&editing.old_token,&editor.token[editor.currentindex], | ||
351 | sizeof(struct token)); | ||
352 | } | ||
353 | break; | ||
354 | |||
355 | case DBX_STOP: | ||
356 | if(editing.selecting) { | ||
357 | rb->memcpy(&editor.token[editor.currentindex],&editing.old_token, | ||
358 | sizeof(struct token)); | ||
359 | editing.selecting=0; | ||
360 | } | ||
361 | else | ||
362 | abort=1; | ||
363 | break; | ||
364 | |||
365 | default: | ||
366 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { | ||
367 | #ifdef HAVE_LCD_BITMAP | ||
368 | rb->lcd_setfont(FONT_UI); | ||
369 | #endif | ||
370 | return PLUGIN_USB_CONNECTED; | ||
371 | } | ||
372 | break; | ||
373 | } | ||
374 | } while (!done&&!abort); | ||
375 | #ifdef HAVE_LCD_BITMAP | ||
376 | rb->lcd_setfont(FONT_UI); | ||
377 | #endif | ||
378 | if(abort) | ||
379 | return PLUGIN_OK; | ||
380 | |||
381 | if(editor.valid&&editor.tokencount>0) { | ||
382 | if(writetstream(filename,editor.token)) { | ||
383 | rb->splash(HZ*2,true,"Wrote file succesfully ^.^"); | ||
384 | return PLUGIN_OK; | ||
385 | } | ||
386 | else { | ||
387 | rb->splash(HZ*2,true,"Error while writing file :("); | ||
388 | return PLUGIN_ERROR; | ||
389 | } | ||
390 | } | ||
391 | else { | ||
392 | rb->splash(HZ*2,true,"Search query invalid, not saving."); | ||
393 | return PLUGIN_OK; | ||
394 | } | ||
395 | } | ||
diff --git a/apps/plugins/databox/databox.h b/apps/plugins/databox/databox.h deleted file mode 100644 index 49f5891fb9..0000000000 --- a/apps/plugins/databox/databox.h +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Michiel van der Kolk | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef DATABOX_H | ||
20 | #define DATABOX_H | ||
21 | #include <stdio.h> | ||
22 | #include <stdlib.h> | ||
23 | #include <plugin.h> | ||
24 | #include <database.h> | ||
25 | |||
26 | #include "edittoken.h" | ||
27 | #include "editparser.h" | ||
28 | |||
29 | extern struct plugin_api* rb; | ||
30 | |||
31 | struct print { | ||
32 | #ifdef HAVE_LCD_BITMAP | ||
33 | struct font *fontfixed; | ||
34 | int font_w,font_h; | ||
35 | #endif | ||
36 | int line; | ||
37 | int position; | ||
38 | }; | ||
39 | |||
40 | struct editor { | ||
41 | struct token *token; /* tokenstream */ | ||
42 | int currentindex; /* index of the token to change.(+1, 1=0 2=1 3=2 etc.) */ | ||
43 | int tokencount; /* total amount of tokens */ | ||
44 | int editingmode; /* defined in databox.h */ | ||
45 | int valid; /* is the current tokenstream valid ? */ | ||
46 | }; | ||
47 | |||
48 | struct editing { | ||
49 | int selection_candidates[30]; /* possible options for this selecting */ | ||
50 | struct token old_token; /* only set when selecting, stores old token */ | ||
51 | int currentselection; /* current selection index */ | ||
52 | int selectionmax; | ||
53 | int selecting; /* boolean */ | ||
54 | }; | ||
55 | |||
56 | extern struct print printing; | ||
57 | extern struct editor editor; | ||
58 | extern struct editing editing; | ||
59 | |||
60 | #endif | ||
diff --git a/apps/plugins/databox/editparser.c b/apps/plugins/databox/editparser.c deleted file mode 100644 index 5ee9ffbd56..0000000000 --- a/apps/plugins/databox/editparser.c +++ /dev/null | |||
@@ -1,205 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Michiel van der Kolk | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "databox.h" | ||
20 | #include "edittoken.h" | ||
21 | #include "editparser.h" | ||
22 | |||
23 | struct token *currenttoken,*lasttoken,*tokenstream; | ||
24 | int currentindex; | ||
25 | int lparencount,acceptedmask; | ||
26 | int tokensleft; | ||
27 | int invalid; | ||
28 | int invalid_mode; | ||
29 | |||
30 | void check_accepted(struct token *tstream, int count) { | ||
31 | parse_stream(tstream,count+1,INVALID_EXPERT); | ||
32 | } | ||
33 | |||
34 | void parse_stream(struct token *tstream, int count, int inv_mode) { | ||
35 | invalid_mode=inv_mode; | ||
36 | acceptedmask=0; | ||
37 | lparencount=0; | ||
38 | tokensleft=count; | ||
39 | currentindex=0; | ||
40 | invalid=0; | ||
41 | tokenstream=tstream; | ||
42 | currenttoken=&tokenstream[currentindex]; | ||
43 | parseMExpr(); | ||
44 | } | ||
45 | |||
46 | int check_tokenstream(struct token *tstream, int inv_mode) { | ||
47 | int inval=0; | ||
48 | int i; | ||
49 | parse_stream(tstream,-1,inv_mode); | ||
50 | inval=invalid; | ||
51 | while( (inv_mode==INVALID_STRIP||inv_mode==INVALID_MARK) && invalid) | ||
52 | parse_stream(tstream,-1,inv_mode); | ||
53 | i=0; | ||
54 | while(tstream[i].kind!=TOKEN_EOF) | ||
55 | if(tstream[i++].kind==TOKEN_INVALID) { | ||
56 | inval=1; | ||
57 | break; | ||
58 | } | ||
59 | return inval==0; | ||
60 | } | ||
61 | |||
62 | |||
63 | void parse_accept_rparen(void) { | ||
64 | if(!tokensleft) return; | ||
65 | if(lparencount) { | ||
66 | acceptedmask|=ACCEPT_RPAREN; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | void parse_accept(int bitmask) { | ||
71 | if(!tokensleft) return; | ||
72 | acceptedmask|=bitmask; | ||
73 | if(lparencount) { | ||
74 | acceptedmask&=~ACCEPT_EOF; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | void parse_checktoken() { | ||
79 | int ok=0; | ||
80 | if(!tokensleft) return; | ||
81 | lasttoken=currenttoken; | ||
82 | switch(lasttoken->kind) { | ||
83 | case TOKEN_EOF: | ||
84 | ok=acceptedmask&ACCEPT_EOF; | ||
85 | break; | ||
86 | case TOKEN_NOT: | ||
87 | ok=acceptedmask&ACCEPT_NOT; | ||
88 | break; | ||
89 | case TOKEN_AND: | ||
90 | case TOKEN_OR: | ||
91 | ok=acceptedmask&ACCEPT_BOOLOP; | ||
92 | break; | ||
93 | case TOKEN_GT: | ||
94 | case TOKEN_GTE: | ||
95 | case TOKEN_LT: | ||
96 | case TOKEN_LTE: | ||
97 | case TOKEN_NE: | ||
98 | case TOKEN_EQ: | ||
99 | ok=acceptedmask&ACCEPT_NUMOP; | ||
100 | break; | ||
101 | case TOKEN_EQUALS: | ||
102 | case TOKEN_CONTAINS: | ||
103 | case TOKEN_STARTSWITH: | ||
104 | case TOKEN_ENDSWITH: | ||
105 | ok=acceptedmask&ACCEPT_STROP; | ||
106 | break; | ||
107 | case TOKEN_STRING: | ||
108 | case TOKEN_STRINGIDENTIFIER: | ||
109 | ok=acceptedmask&ACCEPT_STRARG; | ||
110 | break; | ||
111 | case TOKEN_NUM: | ||
112 | case TOKEN_NUMIDENTIFIER: | ||
113 | ok=acceptedmask&ACCEPT_NUMARG; | ||
114 | break; | ||
115 | case TOKEN_LPAREN: | ||
116 | ok=acceptedmask&ACCEPT_LPAREN; | ||
117 | if(ok) lparencount++; | ||
118 | break; | ||
119 | case TOKEN_RPAREN: | ||
120 | ok=acceptedmask&ACCEPT_RPAREN; | ||
121 | if(ok) lparencount--; | ||
122 | break; | ||
123 | case TOKEN_INVALID: | ||
124 | if(invalid_mode!=INVALID_STRIP) | ||
125 | ok=1; | ||
126 | break; | ||
127 | } | ||
128 | tokensleft--; | ||
129 | if(lasttoken->kind==TOKEN_EOF) | ||
130 | tokensleft=0; | ||
131 | if(!ok&&tokensleft) { | ||
132 | // delete token | ||
133 | int i=currentindex; | ||
134 | //printf("Syntax error. accepted: 0x%x index:%d token: %d %s\n",acceptedmask,currentindex,currenttoken->kind,tokentostring(currenttoken)); | ||
135 | switch (invalid_mode) { | ||
136 | case INVALID_STRIP: | ||
137 | do { | ||
138 | rb->memcpy(currenttoken,&tokenstream[++i],sizeof(struct token));; | ||
139 | currenttoken=&tokenstream[i]; | ||
140 | } while (currenttoken->kind!=TOKEN_EOF); | ||
141 | currenttoken=&tokenstream[currentindex]; | ||
142 | break; | ||
143 | case INVALID_MARK: | ||
144 | currenttoken->kind=TOKEN_INVALID; | ||
145 | break; | ||
146 | } | ||
147 | tokensleft=0; | ||
148 | invalid=1; | ||
149 | } | ||
150 | if(tokensleft) { | ||
151 | currenttoken=&tokenstream[++currentindex]; | ||
152 | acceptedmask=0; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | void parseCompareNum() { | ||
157 | parse_accept(ACCEPT_NUMOP); | ||
158 | parse_checktoken(); | ||
159 | parse_accept(ACCEPT_NUMARG); | ||
160 | parse_checktoken(); | ||
161 | } | ||
162 | |||
163 | void parseCompareString() { | ||
164 | parse_accept(ACCEPT_STROP); | ||
165 | parse_checktoken(); | ||
166 | parse_accept(ACCEPT_STRARG); | ||
167 | parse_checktoken(); | ||
168 | } | ||
169 | |||
170 | void parseExpr() { | ||
171 | if(!tokensleft) return; | ||
172 | parse_accept(ACCEPT_NOT|ACCEPT_LPAREN|ACCEPT_NUMARG|ACCEPT_STRARG); | ||
173 | parse_checktoken(); | ||
174 | switch(lasttoken->kind) { | ||
175 | case TOKEN_NOT: | ||
176 | parseExpr(); | ||
177 | break; | ||
178 | case TOKEN_LPAREN: | ||
179 | parseMExpr(); | ||
180 | break; | ||
181 | case TOKEN_NUM: | ||
182 | case TOKEN_NUMIDENTIFIER: | ||
183 | parseCompareNum(); | ||
184 | break; | ||
185 | case TOKEN_STRING: | ||
186 | case TOKEN_STRINGIDENTIFIER: | ||
187 | parseCompareString(); | ||
188 | break; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | void parseMExpr() { | ||
193 | parseExpr(); | ||
194 | parse_accept_rparen(); | ||
195 | parse_accept(ACCEPT_BOOLOP|ACCEPT_EOF); | ||
196 | parse_checktoken(); | ||
197 | while(lasttoken->kind==TOKEN_OR || lasttoken->kind == TOKEN_AND) { | ||
198 | parseExpr(); | ||
199 | parse_accept_rparen(); | ||
200 | parse_accept(ACCEPT_BOOLOP|ACCEPT_EOF); | ||
201 | parse_checktoken(); | ||
202 | if(!tokensleft) | ||
203 | return; | ||
204 | } | ||
205 | } | ||
diff --git a/apps/plugins/databox/editparser.h b/apps/plugins/databox/editparser.h deleted file mode 100644 index 3a26cbca70..0000000000 --- a/apps/plugins/databox/editparser.h +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Michiel van der Kolk | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | extern int acceptedmask; | ||
20 | |||
21 | #define INVALID_STRIP 1 | ||
22 | #define INVALID_MARK 2 | ||
23 | #define INVALID_EXPERT 3 | ||
24 | |||
25 | void check_accepted(struct token *tstream, int count); | ||
26 | void parse_stream(struct token *tstream, int count, int inv_mode); | ||
27 | int check_tokenstream(struct token *tstream, int inv_mode); | ||
28 | void parser_accept_rparen(void); | ||
29 | void parser_accept(int bitmask); | ||
30 | void parse_checktoken(void); | ||
31 | void parseCompareNum(void); | ||
32 | void parseCompareString(void); | ||
33 | void parseExpr(void); | ||
34 | void parseMExpr(void); | ||
diff --git a/apps/plugins/databox/edittoken.c b/apps/plugins/databox/edittoken.c deleted file mode 100644 index e2e1c91818..0000000000 --- a/apps/plugins/databox/edittoken.c +++ /dev/null | |||
@@ -1,204 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Michiel van der Kolk | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "databox.h" | ||
20 | #include "edittoken.h" | ||
21 | |||
22 | char *tokentypetostring(int tokentype) { | ||
23 | switch(tokentype) { | ||
24 | case TOKEN_EOF: return "<END>"; | ||
25 | case TOKEN_NOT: return "not"; | ||
26 | case TOKEN_AND: return "and"; | ||
27 | case TOKEN_OR: return "or"; | ||
28 | case TOKEN_GT: return ">"; | ||
29 | case TOKEN_GTE: return ">="; | ||
30 | case TOKEN_LT: return "<"; | ||
31 | case TOKEN_LTE: return "<="; | ||
32 | case TOKEN_EQ: return "=="; | ||
33 | case TOKEN_NE: return "!="; | ||
34 | case TOKEN_LPAREN: return "("; | ||
35 | case TOKEN_RPAREN: return ")"; | ||
36 | case TOKEN_CONTAINS: return "contains"; | ||
37 | case TOKEN_EQUALS: return "equals"; | ||
38 | case TOKEN_STARTSWITH: return "starts with"; | ||
39 | case TOKEN_ENDSWITH: return "ends with"; | ||
40 | case TOKEN_NUM: return "<number>"; | ||
41 | case TOKEN_NUMIDENTIFIER: return "<numberproperty>"; | ||
42 | case TOKEN_STRING: return "<string>"; | ||
43 | case TOKEN_STRINGIDENTIFIER: return "<stringproperty>"; | ||
44 | case TOKEN_INVALID: return "<INVALID>"; | ||
45 | case TOKEN_EDIT: return tokentostring(&editing.old_token); | ||
46 | case TOKEN_YEAR: return "year"; | ||
47 | case TOKEN_RATING: return "rating"; | ||
48 | case TOKEN_PLAYCOUNT: return "playcount"; | ||
49 | case TOKEN_AUTORATING: return "autorating"; | ||
50 | case TOKEN_TITLE: return "title"; | ||
51 | case TOKEN_ARTIST: return "artist"; | ||
52 | case TOKEN_ALBUM: return "album"; | ||
53 | case TOKEN_GENRE: return "genre"; | ||
54 | case TOKEN_FILENAME: return "filename"; | ||
55 | case TOKEN_PLAYTIME: return "playtime"; | ||
56 | case TOKEN_TRACKNUM: return "track number"; | ||
57 | case TOKEN_SAMPLERATE: return "sample rate"; | ||
58 | case TOKEN_BITRATE: return "bitrate"; | ||
59 | } | ||
60 | return "tokentypeerror"; | ||
61 | } | ||
62 | |||
63 | char *numidtostring(int numid) { | ||
64 | switch(numid) { | ||
65 | case INTVALUE_YEAR: return "<year>"; | ||
66 | case INTVALUE_RATING: return "<rating>"; | ||
67 | case INTVALUE_PLAYCOUNT: return "<playcount>"; | ||
68 | case INTVALUE_AUTORATING: return "<autorating>"; | ||
69 | case INTVALUE_PLAYTIME: return "<playtime>"; | ||
70 | case INTVALUE_TRACKNUM: return "<track number>"; | ||
71 | case INTVALUE_SAMPLERATE: return "<sample rate>"; | ||
72 | case INTVALUE_BITRATE: return "<bitrate>"; | ||
73 | } | ||
74 | return "numiderror"; | ||
75 | } | ||
76 | |||
77 | char *stridtostring(int strid) { | ||
78 | switch(strid) { | ||
79 | case INTVALUE_TITLE: return "<title>"; | ||
80 | case INTVALUE_ARTIST: return "<artist>"; | ||
81 | case INTVALUE_ALBUM: return "<album>"; | ||
82 | case INTVALUE_GENRE: return "<genre>"; | ||
83 | case INTVALUE_FILENAME: return "<filename>"; | ||
84 | } | ||
85 | return "striderror"; | ||
86 | } | ||
87 | |||
88 | char bufbla[40]; | ||
89 | |||
90 | void buildtoken(int tokentype,struct token *token) { | ||
91 | // TODO | ||
92 | char buf[200]; | ||
93 | rb->memset(token,0,sizeof(struct token)); | ||
94 | rb->memset(buf,0,200); | ||
95 | token->kind=tokentype; | ||
96 | token->intvalue=0; | ||
97 | switch(token->kind) { | ||
98 | case TOKEN_STRING: | ||
99 | do { | ||
100 | rb->splash(HZ*2,true,"Enter String."); | ||
101 | } while(rb->kbd_input(token->spelling, SPELLING_LENGTH)); | ||
102 | break; | ||
103 | case TOKEN_YEAR: | ||
104 | token->kind=TOKEN_NUMIDENTIFIER; | ||
105 | token->intvalue=INTVALUE_YEAR; | ||
106 | break; | ||
107 | case TOKEN_RATING: | ||
108 | token->kind=TOKEN_NUMIDENTIFIER; | ||
109 | token->intvalue=INTVALUE_RATING; | ||
110 | break; | ||
111 | case TOKEN_PLAYCOUNT: | ||
112 | token->kind=TOKEN_NUMIDENTIFIER; | ||
113 | token->intvalue=INTVALUE_PLAYCOUNT; | ||
114 | break; | ||
115 | case TOKEN_AUTORATING: | ||
116 | token->kind=TOKEN_NUMIDENTIFIER; | ||
117 | token->intvalue=INTVALUE_AUTORATING; | ||
118 | break; | ||
119 | case TOKEN_TITLE: | ||
120 | token->kind=TOKEN_STRINGIDENTIFIER; | ||
121 | token->intvalue=INTVALUE_TITLE; | ||
122 | break; | ||
123 | case TOKEN_ARTIST: | ||
124 | token->kind=TOKEN_STRINGIDENTIFIER; | ||
125 | token->intvalue=INTVALUE_ARTIST; | ||
126 | break; | ||
127 | case TOKEN_ALBUM: | ||
128 | token->kind=TOKEN_STRINGIDENTIFIER; | ||
129 | token->intvalue=INTVALUE_ALBUM; | ||
130 | break; | ||
131 | case TOKEN_GENRE: | ||
132 | token->kind=TOKEN_STRINGIDENTIFIER; | ||
133 | token->intvalue=INTVALUE_GENRE; | ||
134 | break; | ||
135 | case TOKEN_FILENAME: | ||
136 | token->kind=TOKEN_STRINGIDENTIFIER; | ||
137 | token->intvalue=INTVALUE_TITLE; | ||
138 | break; | ||
139 | case TOKEN_NUM: | ||
140 | do { | ||
141 | rb->splash(HZ*2,true,"Enter Number."); | ||
142 | } while(rb->kbd_input(buf, 199)); | ||
143 | token->intvalue=rb->atoi(buf); | ||
144 | break; | ||
145 | case TOKEN_EDIT: | ||
146 | rb->memcpy(token,&editing.old_token,sizeof(struct token)); | ||
147 | break; | ||
148 | } | ||
149 | } | ||
150 | |||
151 | void removetoken(struct token *token,int index) { | ||
152 | struct token *currenttoken; | ||
153 | currenttoken=&token[index]; | ||
154 | do { | ||
155 | rb->memcpy(currenttoken,&token[++index],sizeof(struct token)); | ||
156 | currenttoken=&token[index]; | ||
157 | } while (currenttoken->kind!=TOKEN_EOF); | ||
158 | } | ||
159 | |||
160 | void inserttoken(struct token *token,int index,int tokentype) { | ||
161 | struct token *currenttoken; | ||
162 | int max,i; | ||
163 | currenttoken=&token[0]; | ||
164 | for(i=1;currenttoken->kind!=TOKEN_EOF;i++) | ||
165 | currenttoken=&token[i]; | ||
166 | max=i; | ||
167 | for(i=max;i>=index;i--) { | ||
168 | rb->memcpy(&token[i+1],&token[i],sizeof(struct token)); | ||
169 | } | ||
170 | buildtoken(tokentype,&token[index]); | ||
171 | } | ||
172 | |||
173 | |||
174 | char *tokentostring(struct token *token) { | ||
175 | switch(token->kind) { | ||
176 | case TOKEN_INVALID: | ||
177 | case TOKEN_EOF: | ||
178 | case TOKEN_NOT: | ||
179 | case TOKEN_AND: | ||
180 | case TOKEN_OR: | ||
181 | case TOKEN_GT: | ||
182 | case TOKEN_GTE: | ||
183 | case TOKEN_LT: | ||
184 | case TOKEN_LTE: | ||
185 | case TOKEN_EQ: | ||
186 | case TOKEN_NE: | ||
187 | case TOKEN_LPAREN: | ||
188 | case TOKEN_RPAREN: | ||
189 | case TOKEN_CONTAINS: | ||
190 | case TOKEN_EQUALS: | ||
191 | case TOKEN_STARTSWITH: | ||
192 | case TOKEN_ENDSWITH: | ||
193 | return tokentypetostring(token->kind); | ||
194 | case TOKEN_NUM: rb->snprintf(bufbla,40,"%d",token->intvalue); | ||
195 | return bufbla; | ||
196 | case TOKEN_NUMIDENTIFIER: | ||
197 | return numidtostring(token->intvalue); | ||
198 | case TOKEN_STRING: return token->spelling; | ||
199 | case TOKEN_STRINGIDENTIFIER: | ||
200 | return stridtostring(token->intvalue); | ||
201 | case TOKEN_EDIT: return tokentostring(&editing.old_token); | ||
202 | default: return "unknown token"; | ||
203 | } | ||
204 | } | ||
diff --git a/apps/plugins/databox/edittoken.h b/apps/plugins/databox/edittoken.h deleted file mode 100644 index c1a33355a8..0000000000 --- a/apps/plugins/databox/edittoken.h +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Michiel van der Kolk | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef EDITTOKEN_H | ||
20 | #define EDITTOKEN_H | ||
21 | |||
22 | #define TOKEN_INVALID -1 | ||
23 | #define TOKEN_EOF 0 // EOF | ||
24 | #define TOKEN_NOT 1 // "not" | ||
25 | #define TOKEN_AND 2 // "and" | ||
26 | #define TOKEN_OR 3 // "or" | ||
27 | #define TOKEN_GT 4 // '>' | ||
28 | #define TOKEN_GTE 5 // '>=' | ||
29 | #define TOKEN_LT 6 // '<' | ||
30 | #define TOKEN_LTE 7 // '<=' | ||
31 | #define TOKEN_EQ 8 // '==' | ||
32 | #define TOKEN_NE 9 // '!=' | ||
33 | #define TOKEN_CONTAINS 10 // "contains" | ||
34 | #define TOKEN_EQUALS 11 // "equals" | ||
35 | #define TOKEN_STARTSWITH 12 | ||
36 | #define TOKEN_ENDSWITH 13 | ||
37 | #define TOKEN_LPAREN 14 // '(' | ||
38 | #define TOKEN_RPAREN 15 // ')' | ||
39 | #define TOKEN_NUM 16 // (0..9)+ | ||
40 | #define TOKEN_NUMIDENTIFIER 17 // year, trackid, bpm, etc. | ||
41 | #define TOKEN_STRING 18 // (?)+ | ||
42 | #define TOKEN_STRINGIDENTIFIER 19 // album, artist, title, genre ... | ||
43 | #define TOKEN_SHUFFLE 20 | ||
44 | #define TOKEN_PLAYTIMELIMIT 21 | ||
45 | |||
46 | // pseudotokens.. | ||
47 | #define TOKEN_YEAR 118 | ||
48 | #define TOKEN_RATING 119 | ||
49 | #define TOKEN_PLAYCOUNT 120 | ||
50 | #define TOKEN_TITLE 121 | ||
51 | #define TOKEN_ARTIST 122 | ||
52 | #define TOKEN_ALBUM 123 | ||
53 | #define TOKEN_GENRE 124 | ||
54 | #define TOKEN_FILENAME 125 | ||
55 | #define TOKEN_EDIT 126 | ||
56 | #define TOKEN_AUTORATING 127 | ||
57 | #define TOKEN_PLAYTIME 128 | ||
58 | #define TOKEN_TRACKNUM 129 | ||
59 | #define TOKEN_SAMPLERATE 130 | ||
60 | #define TOKEN_BITRATE 131 | ||
61 | |||
62 | #define ACCEPT_EOF 0x1 | ||
63 | #define ACCEPT_BOOLOP 0x2 | ||
64 | #define ACCEPT_NUMOP 0x4 | ||
65 | #define ACCEPT_STROP 0x8 | ||
66 | #define ACCEPT_LPAREN 0x10 | ||
67 | #define ACCEPT_RPAREN 0x20 | ||
68 | #define ACCEPT_NUMARG 0x40 | ||
69 | #define ACCEPT_STRARG 0x80 | ||
70 | #define ACCEPT_NOT 0x100 | ||
71 | #define ACCEPT_DELETE 0x200 | ||
72 | |||
73 | #define INTVALUE_YEAR 1 | ||
74 | #define INTVALUE_RATING 2 | ||
75 | #define INTVALUE_PLAYCOUNT 3 | ||
76 | #define INTVALUE_AUTORATING 4 | ||
77 | #define INTVALUE_PLAYTIME 5 | ||
78 | #define INTVALUE_TRACKNUM 6 | ||
79 | #define INTVALUE_SAMPLERATE 7 | ||
80 | #define INTVALUE_BITRATE 8 | ||
81 | #define INTVALUE_TITLE 14 | ||
82 | #define INTVALUE_ARTIST 15 | ||
83 | #define INTVALUE_ALBUM 16 | ||
84 | #define INTVALUE_GENRE 17 | ||
85 | #define INTVALUE_FILENAME 18 | ||
86 | |||
87 | #define SPELLING_LENGTH 100 | ||
88 | |||
89 | struct token { | ||
90 | signed char kind; | ||
91 | char spelling[SPELLING_LENGTH + 3]; | ||
92 | long intvalue; | ||
93 | }; | ||
94 | char *tokentypetostring(int tokentype); | ||
95 | char *tokentostring(struct token *token); | ||
96 | void buildtoken(int tokentype,struct token *token); | ||
97 | #endif | ||
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 83f2452613..892d9d2b2c 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include "misc.h" | 46 | #include "misc.h" |
47 | #include "abrepeat.h" | 47 | #include "abrepeat.h" |
48 | #include "power.h" | 48 | #include "power.h" |
49 | #include "database.h" | ||
50 | #include "dir.h" | 49 | #include "dir.h" |
51 | #include "dircache.h" | 50 | #include "dircache.h" |
52 | #ifdef HAVE_TAGCACHE | 51 | #ifdef HAVE_TAGCACHE |