2005-04-28 14:06:20 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 by Michiel van der Kolk
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2005-04-29 21:02:17 +00:00
|
|
|
#define TOKEN_INVALID -1
|
|
|
|
#define TOKEN_EOF 0 // EOF
|
2005-04-28 12:33:38 +00:00
|
|
|
#define TOKEN_NOT 1 // "not"
|
|
|
|
#define TOKEN_AND 2 // "and"
|
|
|
|
#define TOKEN_OR 3 // "or"
|
|
|
|
#define TOKEN_GT 4 // '>'
|
|
|
|
#define TOKEN_GTE 5 // '>='
|
|
|
|
#define TOKEN_LT 6 // '<'
|
|
|
|
#define TOKEN_LTE 7 // '<='
|
|
|
|
#define TOKEN_EQ 8 // '=='
|
|
|
|
#define TOKEN_NE 9 // '!='
|
|
|
|
#define TOKEN_CONTAINS 10 // "contains"
|
2005-04-29 21:02:17 +00:00
|
|
|
#define TOKEN_EQUALS 11 // "equals"
|
2005-04-28 12:33:38 +00:00
|
|
|
#define TOKEN_LPAREN 12 // '('
|
|
|
|
#define TOKEN_RPAREN 13 // ')'
|
|
|
|
#define TOKEN_NUM 14 // (0..9)+
|
|
|
|
#define TOKEN_NUMIDENTIFIER 15 // year, trackid, bpm, etc.
|
|
|
|
#define TOKEN_STRING 16 // (?)+
|
|
|
|
#define TOKEN_STRINGIDENTIFIER 17 // album, artist, title, genre ...
|
|
|
|
|
2005-04-29 21:02:17 +00:00
|
|
|
#define INTVALUE_YEAR 1
|
|
|
|
#define INTVALUE_RATING 2
|
|
|
|
#define INTVALUE_PLAYCOUNT 3
|
|
|
|
#define INTVALUE_TITLE 4
|
|
|
|
#define INTVALUE_ARTIST 5
|
|
|
|
#define INTVALUE_ALBUM 6
|
|
|
|
#define INTVALUE_GENRE 7
|
|
|
|
#define INTVALUE_FILENAME 8
|
2005-04-28 12:33:38 +00:00
|
|
|
|
2005-04-28 14:06:20 +00:00
|
|
|
/* static char *spelling[] = { "not", "and", "or",">",">=","<", "<=","==","!=",
|
2005-04-29 21:02:17 +00:00
|
|
|
"contains","(",")" }; */
|
2005-04-28 12:33:38 +00:00
|
|
|
|
|
|
|
struct token {
|
|
|
|
unsigned char kind;
|
2005-04-29 22:45:50 +00:00
|
|
|
char spelling[255]; // 255 should make it aligned again..
|
2005-04-28 16:39:41 +00:00
|
|
|
long intvalue;
|
2005-04-28 12:33:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
char *getstring(struct token *token);
|
|
|
|
int getvalue(struct token *token);
|