1 /* C code produced by gperf version 3.0.1 */
2 /* Command-line: gperf -tCcTonD -K id -N id3_compat_lookup -s -3 -k '*' compat.gperf */
4 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
11 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
12 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
13 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
14 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
15 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
16 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
17 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
18 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
19 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
20 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
21 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
22 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
23 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
24 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
25 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
26 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27 /* The character set is not based on ISO-646. */
28 error
"gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
31 #line 1 "compat.gperf"
34 * libid3tag - ID3 tag manipulation library
35 * Copyright (C) 2000-2004 Underbit Technologies, Inc.
37 * This program is free software; you can redistribute it and/or modify
38 * it under the terms of the GNU General Public License as published by
39 * the Free Software Foundation; either version 2 of the License, or
40 * (at your option) any later version.
42 * This program is distributed in the hope that it will be useful,
43 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 * GNU General Public License for more details.
47 * You should have received a copy of the GNU General Public License
48 * along with this program; if not, write to the Free Software
49 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
51 * Id: compat.gperf,v 1.11 2004/01/23 09:41:32 rob Exp
74 # define EQ(id) #id, 0
75 # define OBSOLETE 0, 0
76 # define TX(id) #id, translate_##id
78 static id3_compat_func_t translate_TCON
;
80 #define TOTAL_KEYWORDS 73
81 #define MIN_WORD_LENGTH 3
82 #define MAX_WORD_LENGTH 4
83 #define MIN_HASH_VALUE 6
84 #define MAX_HASH_VALUE 127
85 /* maximum key range = 122, duplicates = 0 */
96 register const char *str
;
97 register unsigned int len
;
99 static const unsigned char asso_values
[] =
101 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
102 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
103 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
104 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
105 128, 128, 128, 128, 128, 128, 128, 128, 128, 64,
106 58, 20, 15, 128, 128, 128, 128, 128, 128, 128,
107 128, 128, 128, 128, 128, 10, 18, 3, 6, 1,
108 47, 0, 128, 42, 62, 30, 31, 0, 19, 52,
109 10, 24, 8, 30, 5, 3, 30, 8, 25, 47,
110 3, 128, 128, 128, 128, 128, 128, 128, 128, 128,
111 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
112 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
113 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
114 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
115 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
116 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
117 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
118 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
119 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
120 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
121 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
122 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
123 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
124 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
125 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
126 128, 128, 128, 128, 128, 128, 128
128 register int hval
= 0;
133 hval
+= asso_values
[(unsigned char)str
[3]];
136 hval
+= asso_values
[(unsigned char)str
[2]];
139 hval
+= asso_values
[(unsigned char)str
[1]+1];
142 hval
+= asso_values
[(unsigned char)str
[0]];
151 const struct id3_compat
*
152 id3_compat_lookup (str
, len
)
153 register const char *str
;
154 register unsigned int len
;
156 static const struct id3_compat wordlist
[] =
158 #line 97 "compat.gperf"
159 {"TLE", EQ(TLEN
) /* Length */},
160 #line 68 "compat.gperf"
161 {"ETC", EQ(ETCO
) /* Event timing codes */},
162 #line 126 "compat.gperf"
163 {"ULT", EQ(USLT
) /* Unsynchronised lyric/text transcription */},
164 #line 123 "compat.gperf"
165 {"TYE", OBSOLETE
/* Year [obsolete] */},
166 #line 92 "compat.gperf"
167 {"TFT", EQ(TFLT
) /* File type */},
168 #line 84 "compat.gperf"
169 {"TCM", EQ(TCOM
) /* Composer */},
170 #line 66 "compat.gperf"
171 {"EQU", OBSOLETE
/* Equalization [obsolete] */},
172 #line 63 "compat.gperf"
173 {"COM", EQ(COMM
) /* Comments */},
174 #line 130 "compat.gperf"
175 {"WCM", EQ(WCOM
) /* Commercial information */},
176 #line 96 "compat.gperf"
177 {"TLA", EQ(TLAN
) /* Language(s) */},
178 #line 88 "compat.gperf"
179 {"TDA", OBSOLETE
/* Date [obsolete] */},
180 #line 124 "compat.gperf"
181 {"TYER", OBSOLETE
/* Year [obsolete] */},
182 #line 83 "compat.gperf"
183 {"TBP", EQ(TBPM
) /* BPM (beats per minute) */},
184 #line 87 "compat.gperf"
185 {"TCR", EQ(TCOP
) /* Copyright message */},
186 #line 104 "compat.gperf"
187 {"TOT", EQ(TOAL
) /* Original album/movie/show title */},
188 #line 89 "compat.gperf"
189 {"TDAT", OBSOLETE
/* Date [obsolete] */},
190 #line 67 "compat.gperf"
191 {"EQUA", OBSOLETE
/* Equalization [obsolete] */},
192 #line 102 "compat.gperf"
193 {"TOR", EQ(TDOR
) /* Original release year [obsolete] */},
194 #line 131 "compat.gperf"
195 {"WCP", EQ(WCOP
) /* Copyright/legal information */},
196 #line 99 "compat.gperf"
197 {"TOA", EQ(TOPE
) /* Original artist(s)/performer(s) */},
198 #line 78 "compat.gperf"
199 {"RVA", OBSOLETE
/* Relative volume adjustment [obsolete] */},
200 #line 120 "compat.gperf"
201 {"TT3", EQ(TIT3
) /* Subtitle/description refinement */},
202 #line 98 "compat.gperf"
203 {"TMT", EQ(TMED
) /* Media type */},
204 #line 76 "compat.gperf"
205 {"POP", EQ(POPM
) /* Popularimeter */},
206 #line 74 "compat.gperf"
207 {"MLL", EQ(MLLT
) /* MPEG location lookup table */},
208 #line 79 "compat.gperf"
209 {"RVAD", OBSOLETE
/* Relative volume adjustment [obsolete] */},
210 #line 65 "compat.gperf"
211 {"CRM", OBSOLETE
/* Encrypted meta frame [obsolete] */},
212 #line 128 "compat.gperf"
213 {"WAR", EQ(WOAR
) /* Official artist/performer webpage */},
214 #line 80 "compat.gperf"
215 {"SLT", EQ(SYLT
) /* Synchronised lyric/text */},
216 #line 81 "compat.gperf"
217 {"STC", EQ(SYTC
) /* Synchronised tempo codes */},
218 #line 95 "compat.gperf"
219 {"TKE", EQ(TKEY
) /* Initial key */},
220 #line 111 "compat.gperf"
221 {"TRC", EQ(TSRC
) /* ISRC (international standard recording code) */},
222 #line 109 "compat.gperf"
223 {"TPA", EQ(TPOS
) /* Part of a set */},
224 #line 117 "compat.gperf"
225 {"TSS", EQ(TSSE
) /* Software/hardware and settings used for encoding */},
226 #line 112 "compat.gperf"
227 {"TRD", OBSOLETE
/* Recording dates [obsolete] */},
228 #line 64 "compat.gperf"
229 {"CRA", EQ(AENC
) /* Audio encryption */},
230 #line 108 "compat.gperf"
231 {"TP4", EQ(TPE4
) /* Interpreted, remixed, or otherwise modified by */},
232 #line 125 "compat.gperf"
233 {"UFI", EQ(UFID
) /* Unique file identifier */},
234 #line 101 "compat.gperf"
235 {"TOL", EQ(TOLY
) /* Original lyricist(s)/text writer(s) */},
236 #line 110 "compat.gperf"
237 {"TPB", EQ(TPUB
) /* Publisher */},
238 #line 73 "compat.gperf"
239 {"MCI", EQ(MCDI
) /* Music CD identifier */},
240 #line 107 "compat.gperf"
241 {"TP3", EQ(TPE3
) /* Conductor/performer refinement */},
242 #line 132 "compat.gperf"
243 {"WPB", EQ(WPUB
) /* Publishers official webpage */},
244 #line 113 "compat.gperf"
245 {"TRDA", OBSOLETE
/* Recording dates [obsolete] */},
246 #line 115 "compat.gperf"
247 {"TSI", OBSOLETE
/* Size [obsolete] */},
248 #line 90 "compat.gperf"
249 {"TDY", EQ(TDLY
) /* Playlist delay */},
250 #line 82 "compat.gperf"
251 {"TAL", EQ(TALB
) /* Album/movie/show title */},
252 #line 116 "compat.gperf"
253 {"TSIZ", OBSOLETE
/* Size [obsolete] */},
254 #line 129 "compat.gperf"
255 {"WAS", EQ(WOAS
) /* Official audio source webpage */},
256 #line 121 "compat.gperf"
257 {"TXT", EQ(TEXT
) /* Lyricist/text writer */},
258 #line 62 "compat.gperf"
259 {"CNT", EQ(PCNT
) /* Play counter */},
260 #line 100 "compat.gperf"
261 {"TOF", EQ(TOFN
) /* Original filename */},
262 #line 85 "compat.gperf"
263 {"TCO", TX(TCON
) /* Content type */},
264 #line 114 "compat.gperf"
265 {"TRK", EQ(TRCK
) /* Track number/position in set */},
266 #line 119 "compat.gperf"
267 {"TT2", EQ(TIT2
) /* Title/songname/content description */},
268 #line 93 "compat.gperf"
269 {"TIM", OBSOLETE
/* Time [obsolete] */},
270 #line 94 "compat.gperf"
271 {"TIME", OBSOLETE
/* Time [obsolete] */},
272 #line 103 "compat.gperf"
273 {"TORY", EQ(TDOR
) /* Original release year [obsolete] */},
274 #line 91 "compat.gperf"
275 {"TEN", EQ(TENC
) /* Encoded by */},
276 #line 118 "compat.gperf"
277 {"TT1", EQ(TIT1
) /* Content group description */},
278 #line 127 "compat.gperf"
279 {"WAF", EQ(WOAF
) /* Official audio file webpage */},
280 #line 75 "compat.gperf"
281 {"PIC", EQ(APIC
) /* Attached picture */},
282 #line 122 "compat.gperf"
283 {"TXX", EQ(TXXX
) /* User defined text information frame */},
284 #line 133 "compat.gperf"
285 {"WXX", EQ(WXXX
) /* User defined URL link frame */},
286 #line 86 "compat.gperf"
287 {"TCON", TX(TCON
) /* Content type */},
288 #line 77 "compat.gperf"
289 {"REV", EQ(RVRB
) /* Reverb */},
290 #line 106 "compat.gperf"
291 {"TP2", EQ(TPE2
) /* Band/orchestra/accompaniment */},
292 #line 105 "compat.gperf"
293 {"TP1", EQ(TPE1
) /* Lead performer(s)/soloist(s) */},
294 #line 61 "compat.gperf"
295 {"BUF", EQ(RBUF
) /* Recommended buffer size */},
296 #line 70 "compat.gperf"
297 {"IPL", EQ(TIPL
) /* Involved people list */},
298 #line 69 "compat.gperf"
299 {"GEO", EQ(GEOB
) /* General encapsulated object */},
300 #line 72 "compat.gperf"
301 {"LNK", EQ(LINK
) /* Linked information */},
302 #line 71 "compat.gperf"
303 {"IPLS", EQ(TIPL
) /* Involved people list */}
306 static const short lookup
[] =
308 -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7,
309 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1,
310 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
311 -1, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
312 48, 49, -1, -1, 50, -1, 51, 52, -1, 53, 54, 55, 56, -1,
313 57, 58, 59, 60, -1, 61, -1, 62, -1, -1, 63, -1, 64, -1,
314 -1, 65, -1, 66, -1, -1, -1, -1, -1, 67, -1, 68, -1, 69,
315 -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
316 -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
320 if (len
<= MAX_WORD_LENGTH
&& len
>= MIN_WORD_LENGTH
)
322 register int key
= hash (str
, len
);
324 if (key
<= MAX_HASH_VALUE
&& key
>= 0)
326 register int index
= lookup
[key
];
330 register const char *s
= wordlist
[index
].id
;
332 if (*str
== *s
&& !strncmp (str
+ 1, s
+ 1, len
- 1) && s
[len
] == '\0')
333 return &wordlist
[index
];
339 #line 134 "compat.gperf"
343 int translate_TCON(struct id3_frame
*frame
, char const *oldid
,
344 id3_byte_t
const *data
, id3_length_t length
)
346 id3_byte_t
const *end
;
347 enum id3_field_textencoding encoding
;
348 id3_ucs4_t
*string
= 0, *ptr
, *endptr
;
351 /* translate old TCON syntax into multiple strings */
353 assert(frame
->nfields
== 2);
355 encoding
= ID3_FIELD_TEXTENCODING_ISO_8859_1
;
359 if (id3_field_parse(&frame
->fields
[0], &data
, end
- data
, &encoding
) == -1)
362 string
= id3_parse_string(&data
, end
- data
, encoding
, 0);
367 while (*ptr
== '(') {
372 while (*endptr
&& *endptr
!= ')')
378 if (id3_field_addstring(&frame
->fields
[1], ptr
) == -1)
384 if (*ptr
&& id3_field_addstring(&frame
->fields
[1], ptr
) == -1)
399 * NAME: compat->fixup()
400 * DESCRIPTION: finish compatibility translations
402 int id3_compat_fixup(struct id3_tag
*tag
)
404 struct id3_frame
*frame
;
406 id3_ucs4_t timestamp
[17] = { 0 };
409 /* create a TDRC frame from obsolete TYER/TDAT/TIME frames */
416 * TDRC: yyyy-MM-ddTHH:mm
420 while ((frame
= id3_tag_findframe(tag
, ID3_FRAME_OBSOLETE
, index
++))) {
422 id3_byte_t
const *data
, *end
;
424 enum id3_field_textencoding encoding
;
427 id
= id3_field_getframeid(&frame
->fields
[0]);
430 if (strcmp(id
, "TYER") != 0 && strcmp(id
, "YTYE") != 0 &&
431 strcmp(id
, "TDAT") != 0 && strcmp(id
, "YTDA") != 0 &&
432 strcmp(id
, "TIME") != 0 && strcmp(id
, "YTIM") != 0)
435 data
= id3_field_getbinarydata(&frame
->fields
[1], &length
);
443 encoding
= id3_parse_uint(&data
, 1);
444 string
= id3_parse_string(&data
, end
- data
, encoding
, 0);
446 if (id3_ucs4_length(string
) < 4) {
451 if (strcmp(id
, "TYER") == 0 ||
452 strcmp(id
, "YTYE") == 0) {
453 timestamp
[0] = string
[0];
454 timestamp
[1] = string
[1];
455 timestamp
[2] = string
[2];
456 timestamp
[3] = string
[3];
458 else if (strcmp(id
, "TDAT") == 0 ||
459 strcmp(id
, "YTDA") == 0) {
461 timestamp
[5] = string
[2];
462 timestamp
[6] = string
[3];
464 timestamp
[8] = string
[0];
465 timestamp
[9] = string
[1];
467 else { /* TIME or YTIM */
469 timestamp
[11] = string
[0];
470 timestamp
[12] = string
[1];
472 timestamp
[14] = string
[2];
473 timestamp
[15] = string
[3];
482 frame
= id3_frame_new("TDRC");
488 if (id3_field_settextencoding(&frame
->fields
[0],
489 ID3_FIELD_TEXTENCODING_ISO_8859_1
) == -1 ||
490 id3_field_setstrings(&frame
->fields
[1], 1, &strings
) == -1 ||
491 id3_tag_attachframe(tag
, frame
) == -1) {
492 id3_frame_delete(frame
);