diff options
Diffstat (limited to 'apps/plugins/searchengine/tokentool.c')
-rw-r--r-- | apps/plugins/searchengine/tokentool.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/apps/plugins/searchengine/tokentool.c b/apps/plugins/searchengine/tokentool.c deleted file mode 100644 index 6cca98ecd4..0000000000 --- a/apps/plugins/searchengine/tokentool.c +++ /dev/null | |||
@@ -1,83 +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 <stdlib.h> | ||
20 | #include <stdio.h> | ||
21 | #include "token.h" | ||
22 | |||
23 | |||
24 | #ifdef LITTLE_ENDIAN | ||
25 | #define BE32(_x_) (((_x_ & 0xff000000) >> 24) | \ | ||
26 | ((_x_ & 0x00ff0000) >> 8) | \ | ||
27 | ((_x_ & 0x0000ff00) << 8) | \ | ||
28 | ((_x_ & 0x000000ff) << 24)) | ||
29 | #else | ||
30 | #define BE32(_x_) _x_ | ||
31 | #endif | ||
32 | |||
33 | |||
34 | struct token token; | ||
35 | char buf[500]; | ||
36 | long num; | ||
37 | FILE *fp; | ||
38 | main() { | ||
39 | int done=0; | ||
40 | printf("Output filename? "); | ||
41 | fflush(stdout); | ||
42 | fgets(buf,254,stdin); | ||
43 | buf[strlen(buf)-1]=0; | ||
44 | fp=fopen(buf,"w"); | ||
45 | if(fp<0) { | ||
46 | printf("Error opening outputfile.\n"); | ||
47 | return -1; | ||
48 | } | ||
49 | do { | ||
50 | printf("EOF=0 NOT=1 AND=2 OR=3 GT=4 GTE=5 LT=6 LTE=7 EQ=8 NE=9\n"); | ||
51 | printf("(strings:) CONTAINS=10 EQUALS=11\n"); | ||
52 | printf("'('=12 ')'=13\n"); | ||
53 | printf("(arguments:) NUMBER=14 NUMBERFIELD=15 STRING=16 STRINGFIELD=17\n"); | ||
54 | printf("Token kind? "); | ||
55 | fflush(stdout); | ||
56 | fgets(buf,254,stdin); | ||
57 | token.kind=strtol(buf,0,10); | ||
58 | memset(&token.spelling,0,256); | ||
59 | if(token.kind==TOKEN_STRING) { | ||
60 | printf("Token spelling? "); | ||
61 | fflush(stdout); | ||
62 | fgets(token.spelling,254,stdin); | ||
63 | token.spelling[strlen(token.spelling)-1]=0; | ||
64 | } | ||
65 | if(token.kind==TOKEN_STRINGIDENTIFIER) | ||
66 | printf("TITLE=4 ARTIST=5 ALBUM=6 GENRE=7 FILENAME=8\n"); | ||
67 | else if(token.kind==TOKEN_NUMIDENTIFIER) | ||
68 | printf("YEAR=1 RATING=2 PLAYCOUNT=3\n"); | ||
69 | token.intvalue=0; | ||
70 | if(token.kind==TOKEN_STRINGIDENTIFIER || | ||
71 | token.kind==TOKEN_NUMIDENTIFIER || | ||
72 | token.kind==TOKEN_NUM) { | ||
73 | printf("Token intvalue? "); | ||
74 | fflush(stdout); | ||
75 | fgets(buf,254,stdin); | ||
76 | token.intvalue=BE32(strtol(buf,0,10)); | ||
77 | } | ||
78 | fwrite(&token,sizeof(struct token),1,fp); | ||
79 | done=token.kind==0; | ||
80 | } while(!done); | ||
81 | fclose(fp); | ||
82 | printf("Successfully wrote tokenfile\n"); | ||
83 | } | ||