summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichiel Van Der Kolk <not.valid@email.address>2005-04-28 16:41:08 +0000
committerMichiel Van Der Kolk <not.valid@email.address>2005-04-28 16:41:08 +0000
commitfff0d92e76122c1c55fc6cb00ac808e1a70a660b (patch)
treebb9f61e15e5e495f8bd25d7dd566f34a5c73a149 /apps
parentc099300c8da48d4f61c6bcb97d1d4e0a0bcf282d (diff)
downloadrockbox-fff0d92e76122c1c55fc6cb00ac808e1a70a660b.tar.gz
rockbox-fff0d92e76122c1c55fc6cb00ac808e1a70a660b.zip
low level search query file maker, to be built on host, not target..
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6374 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/searchengine/tokentool.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/apps/plugins/searchengine/tokentool.c b/apps/plugins/searchengine/tokentool.c
new file mode 100644
index 0000000000..9abfb0e7d3
--- /dev/null
+++ b/apps/plugins/searchengine/tokentool.c
@@ -0,0 +1,70 @@
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 <stdlib.h>
20#include <stdio.h>
21#include "token.h"
22
23struct token token;
24char buf[500];
25long num;
26FILE *fp;
27main() {
28 int done=0;
29 printf("Output filename? ");
30 fflush(stdout);
31 scanf("%s",buf);
32 fp=fopen(buf,"w");
33 if(fp<0) {
34 printf("Error opening outputfile.\n");
35 return -1;
36 }
37 do {
38 printf("EOF=0 NOT=1 AND=2 OR=3 GT=4 GTE=5 LT=6 LTE=7 EQ=8 NE=9\n");
39 printf("(strings:) CONTAINS=10 EQUALS=11\n");
40 printf("'('=12 ')'=13\n");
41 printf("(arguments:) NUMBER=14 NUMBERFIELD=15 STRING=16 STRINGFIELD=17\n");
42 printf("Token kind? ");
43 fflush(stdout);
44 scanf("%d",&num);
45 token.kind=num;
46 memset(&token.spelling,0,256);
47 if(token.kind==TOKEN_STRING) {
48 printf("Token spelling? ");
49 fflush(stdout);
50 scanf("%s",&token.spelling);
51 }
52 if(token.kind==TOKEN_STRINGIDENTIFIER)
53 printf("TITLE=4 ARTIST=5 ALBUM=6 GENRE=7 FILENAME=8\n");
54 else if(token.kind==TOKEN_NUMIDENTIFIER)
55 printf("YEAR=1 RATING=2 PLAYCOUNT=3\n");
56 token.intvalue=0;
57 if(token.kind==TOKEN_STRINGIDENTIFIER ||
58 token.kind==TOKEN_NUMIDENTIFIER ||
59 token.kind==TOKEN_NUM) {
60 printf("Token intvalue? ");
61 fflush(stdout);
62 scanf("%d",&num);
63 token.intvalue=num;
64 }
65 fwrite(&token,sizeof(struct token),1,fp);
66 done=token.kind==0;
67 } while(!done);
68 fclose(fp);
69 printf("Successfully wrote tokenfile\n");
70}