forked from len0rd/rockbox
Code policy...
Removed tokentool for now since this is not the proper place, but what is? git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6383 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
388d9ff6a3
commit
ec407a86a7
7 changed files with 329 additions and 417 deletions
|
@ -159,25 +159,21 @@ unsigned char *parseCompareString() {
|
||||||
rb->snprintf(errormsg,250,"'%d' found where STRING/STRINGID expected\n",currentToken->kind);
|
rb->snprintf(errormsg,250,"'%d' found where STRING/STRINGID expected\n",currentToken->kind);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentToken->kind==TOKEN_CONTAINS ||
|
if(currentToken->kind==TOKEN_CONTAINS ||
|
||||||
currentToken->kind==TOKEN_EQUALS) {
|
currentToken->kind==TOKEN_EQUALS) {
|
||||||
if(currentToken->kind==TOKEN_CONTAINS) {
|
if(currentToken->kind==TOKEN_CONTAINS) {
|
||||||
contains=1;
|
contains=1;
|
||||||
PUTS("Contains");
|
PUTS("Contains");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
contains=0;
|
contains=0;
|
||||||
PUTS("Equals");
|
PUTS("Equals");
|
||||||
}
|
}
|
||||||
parser_acceptIt();
|
parser_acceptIt();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
syntaxerror=1;
|
syntaxerror=1;
|
||||||
rb->snprintf(errormsg,250,"'%d' found where CONTAINS/EQUALS expected\n",currentToken->kind);
|
rb->snprintf(errormsg,250,"'%d' found where CONTAINS/EQUALS expected\n",currentToken->kind);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentToken->kind==TOKEN_STRING ||
|
if(currentToken->kind==TOKEN_STRING ||
|
||||||
currentToken->kind==TOKEN_STRINGIDENTIFIER) {
|
currentToken->kind==TOKEN_STRINGIDENTIFIER) {
|
||||||
rb->memcpy(&string2,currentToken,sizeof(struct token));
|
rb->memcpy(&string2,currentToken,sizeof(struct token));
|
||||||
|
|
|
@ -87,7 +87,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
hits++;
|
hits++;
|
||||||
rb->fdprintf(fd,"%s\n",getfilename(i));
|
rb->fdprintf(fd,"%s\n",getfilename(i));
|
||||||
}
|
}
|
||||||
/* rb->write(fd,result,rb->tagdbheader->filecount);*/
|
|
||||||
rb->close(fd);
|
rb->close(fd);
|
||||||
}
|
}
|
||||||
rb->snprintf(buf,250,"Hits: %d",hits);
|
rb->snprintf(buf,250,"Hits: %d",hits);
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "token.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef LITTLE_ENDIAN
|
|
||||||
#define BE32(_x_) (((_x_ & 0xff000000) >> 24) | \
|
|
||||||
((_x_ & 0x00ff0000) >> 8) | \
|
|
||||||
((_x_ & 0x0000ff00) << 8) | \
|
|
||||||
((_x_ & 0x000000ff) << 24))
|
|
||||||
#else
|
|
||||||
#define BE32(_x_) _x_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
struct token token;
|
|
||||||
char buf[500];
|
|
||||||
long num;
|
|
||||||
FILE *fp;
|
|
||||||
main() {
|
|
||||||
int done=0;
|
|
||||||
printf("Output filename? ");
|
|
||||||
fflush(stdout);
|
|
||||||
fgets(buf,254,stdin);
|
|
||||||
buf[strlen(buf)-1]=0;
|
|
||||||
fp=fopen(buf,"w");
|
|
||||||
if(fp<0) {
|
|
||||||
printf("Error opening outputfile.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
printf("EOF=0 NOT=1 AND=2 OR=3 GT=4 GTE=5 LT=6 LTE=7 EQ=8 NE=9\n");
|
|
||||||
printf("(strings:) CONTAINS=10 EQUALS=11\n");
|
|
||||||
printf("'('=12 ')'=13\n");
|
|
||||||
printf("(arguments:) NUMBER=14 NUMBERFIELD=15 STRING=16 STRINGFIELD=17\n");
|
|
||||||
printf("Token kind? ");
|
|
||||||
fflush(stdout);
|
|
||||||
fgets(buf,254,stdin);
|
|
||||||
token.kind=strtol(buf,0,10);
|
|
||||||
memset(&token.spelling,0,256);
|
|
||||||
if(token.kind==TOKEN_STRING) {
|
|
||||||
printf("Token spelling? ");
|
|
||||||
fflush(stdout);
|
|
||||||
fgets(token.spelling,254,stdin);
|
|
||||||
token.spelling[strlen(token.spelling)-1]=0;
|
|
||||||
}
|
|
||||||
if(token.kind==TOKEN_STRINGIDENTIFIER)
|
|
||||||
printf("TITLE=4 ARTIST=5 ALBUM=6 GENRE=7 FILENAME=8\n");
|
|
||||||
else if(token.kind==TOKEN_NUMIDENTIFIER)
|
|
||||||
printf("YEAR=1 RATING=2 PLAYCOUNT=3\n");
|
|
||||||
token.intvalue=0;
|
|
||||||
if(token.kind==TOKEN_STRINGIDENTIFIER ||
|
|
||||||
token.kind==TOKEN_NUMIDENTIFIER ||
|
|
||||||
token.kind==TOKEN_NUM) {
|
|
||||||
printf("Token intvalue? ");
|
|
||||||
fflush(stdout);
|
|
||||||
fgets(buf,254,stdin);
|
|
||||||
token.intvalue=BE32(strtol(buf,0,10));
|
|
||||||
}
|
|
||||||
fwrite(&token,sizeof(struct token),1,fp);
|
|
||||||
done=token.kind==0;
|
|
||||||
} while(!done);
|
|
||||||
fclose(fp);
|
|
||||||
printf("Successfully wrote tokenfile\n");
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue