blob: 0df4a6ec5f0fc70e820270cc66bfacd6b213efa2 [file] [log] [blame]
Michiel Van Der Kolk4350eec2005-04-28 14:06:20 +00001/***************************************************************************
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 ****************************************************************************/
Michiel Van Der Kolk9369d482005-04-28 12:33:38 +000019#define TOKEN_INVALID -1
20#define TOKEN_EOF 0 // EOF
21#define TOKEN_NOT 1 // "not"
22#define TOKEN_AND 2 // "and"
23#define TOKEN_OR 3 // "or"
24#define TOKEN_GT 4 // '>'
25#define TOKEN_GTE 5 // '>='
26#define TOKEN_LT 6 // '<'
27#define TOKEN_LTE 7 // '<='
28#define TOKEN_EQ 8 // '=='
29#define TOKEN_NE 9 // '!='
30#define TOKEN_CONTAINS 10 // "contains"
31#define TOKEN_EQUALS 11 // "equals"
32#define TOKEN_LPAREN 12 // '('
33#define TOKEN_RPAREN 13 // ')'
34#define TOKEN_NUM 14 // (0..9)+
35#define TOKEN_NUMIDENTIFIER 15 // year, trackid, bpm, etc.
36#define TOKEN_STRING 16 // (?)+
37#define TOKEN_STRINGIDENTIFIER 17 // album, artist, title, genre ...
38
39#define INTVALUE_YEAR 1
40#define INTVALUE_RATING 2
41#define INTVALUE_PLAYCOUNT 3
42#define INTVALUE_TITLE 4
43#define INTVALUE_ARTIST 5
44#define INTVALUE_ALBUM 6
45#define INTVALUE_GENRE 7
46#define INTVALUE_FILENAME 8
47
Michiel Van Der Kolk4350eec2005-04-28 14:06:20 +000048/* static char *spelling[] = { "not", "and", "or",">",">=","<", "<=","==","!=",
49 "contains","(",")" }; */
Michiel Van Der Kolk9369d482005-04-28 12:33:38 +000050
51struct token {
52 unsigned char kind;
53 char spelling[256];
Michiel Van Der Kolkc0993002005-04-28 16:39:41 +000054 long intvalue;
Michiel Van Der Kolk9369d482005-04-28 12:33:38 +000055};
56
57char *getstring(struct token *token);
58int getvalue(struct token *token);