1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 Robert Bieber
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "tag_table.h"
#include <string.h>
/* The tag definition table */
struct tag_info legal_tags[] =
{
{ "V" , "IIiii|2sc" },
{ "Vi" , "SIIiii|2s" },
{ "Vd" , "S" },
{ "T" , "" },
{ "" , ""} /* Keep this here to mark the end of the table */
};
/* A table of legal escapable characters */
char legal_escape_characters[] = "%(|);#,";
/*
* Just does a straight search through the tag table to find one by
* the given name
*/
char* find_tag(char* name)
{
struct tag_info* current = legal_tags;
/*
* Continue searching so long as we have a non-empty name string
* and the name of the current element doesn't match the name
* we're searching for
*/
while(strcmp(current->name, name) && current->name[0] != '\0')
current++;
if(current->name[0] == '\0')
return NULL;
else
return current->params;
}
/* Searches through the legal escape characters string */
int find_escape_character(char lookup)
{
char* current = legal_escape_characters;
while(*current != lookup && *current != '\0')
current++;
if(*current == lookup)
return 1;
else
return 0;
}
|