File: create_map.cpp

package info (click to toggle)
id3v2 0.1.12-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 592 kB
  • ctags: 72
  • sloc: cpp: 3,046; sh: 242; makefile: 42
file content (43 lines) | stat: -rw-r--r-- 1,344 bytes parent folder | download | duplicates (3)
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
// 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 program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//  
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


#include <iostream>
#include <stdlib.h>
#include "genre.cpp"

#ifndef SORT_RUNTIME
int CompareGenres(const void *a, const void *b)
{
    int g1, g2;
    g1 = *((int*)a);
    g2 = *((int*)b);

    return strcmp(GetGenreFromNum(g1), GetGenreFromNum(g2));
}
#endif  // SORT_RUNTIME

int main(int, char**)
{
    int i;
    for (i=0; i<GetGenreCount(); ++i)
        genre_map[i] = i;

    qsort(genre_map, GetGenreCount(), sizeof(int), &CompareGenres);

    std::cout << "int genre_map[] = {" << genre_map[0];
    for (i=1; i<GetGenreCount(); ++i)
        std::cout << ", " << genre_map[i];
    std::cout << "};" << std::endl;
}