File: test_babel.c

package info (click to toggle)
viking 1.11-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,468 kB
  • sloc: ansic: 81,706; xml: 2,893; sh: 2,501; makefile: 874; python: 589; perl: 384; cpp: 259
file content (36 lines) | stat: -rw-r--r-- 944 bytes parent folder | download | duplicates (6)
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
// Decide the Babel file types capability you wish to list
// e.g. for read support of waypoints, tracks and routes:
// run like: ./test_babel 1 0 1 0 1 0
#include <stdlib.h>
#include "babel.h"
#include "preferences.h"

static void print_file_format (gpointer data, gpointer user_data)
{
	BabelFile *file = (BabelFile*)data;
	printf("%s : %d%d%d%d%d%d\n",
		file->label,
		file->mode.waypointsRead, file->mode.waypointsWrite,
		file->mode.tracksRead, file->mode.tracksWrite,
		file->mode.routesRead, file->mode.routesWrite);
}

int main(int argc, char*argv[])
{
	// Preferences must be initialized as it gets auto used
	a_preferences_init ();

	a_babel_init();
	a_babel_post_init ();

	if (argc != 7) return 1;
	BabelMode mode = { atoi(argv[1]),atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]),atoi(argv[6]) };
	a_babel_foreach_file_with_mode(mode, print_file_format, NULL);

	a_babel_uninit();

	a_preferences_uninit ();

	return 0;
}