-
Notifications
You must be signed in to change notification settings - Fork 127
/
format_skeleton.cc
152 lines (129 loc) · 4.28 KB
/
format_skeleton.cc
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
Format converter module skeleton.
Steps to create a new format.
1) Copy this file to <your_format_name>.c
2) Rename all format_skeleton tokens to <your_format_name>.
3) Replace the fictional name and address in the Copyright section below.
** As your work is likely built on the work of others, please retain
the original line. **
4) Create a new section in vecs.c.
5) Add compilation instructions to Makefile.
6) Add sample files (it's better when they're created by the "real"
application and not our own output) to reference/ along with
files in a well supported (preferably non-binary) format and
entries in our 'testo' program. This allows users of different
OSes and hardware to exercise your module.
Copyright (C) YYYY John Doe, [email protected]
Copyright (C) 2001-YYYY Robert Lipe, [email protected]
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "defs.h"
// Any arg in this list will appear in command line help and will be
// populated for you.
// Values for ARGTYPE_xxx can be found in defs.h and are used to
// select the type of option.
static
QVector<arglist_t> format_skeleton_args = {
// {"foo", &fooopt, "The text of the foo option in help",
// "default", ARGYTPE_STRING, ARG_NOMINMAX} ,
};
/*******************************************************************************
* %%% global callbacks called by gpsbabel main process %%% *
*******************************************************************************/
static void
format_skeleton_rd_init(const char* fname)
{
// fin = gbfopen(fname, "r");
}
static void
format_skeleton_rd_deinit()
{
// gbfclose(fin);
}
static void
format_skeleton_read()
{
// your special code to extract waypoint, route and track
// information from gbfile "fin"
//
// Sample text-file read code:
// char *s;
// while ((s = gbfgetstr(fin))) {
// do_anything(s);
// }
//
//
// For waypoints:
// while (have waypoints) {
// waypoint = new waypoint
// populate waypoint
// waypt_add(waypoint);
// }
//
// For routes:
//
// route = new route_head;
// populate struct route_hdr
// route_add_head(route);
// while (have more routepoints) {
// waypoint = new waypoint
// populate waypoint
// route_add_wpt(route, waypoint)
// }
//
// Tracks are just like routes, except the word "track" replaces "routes".
//
}
static void
format_skeleton_wr_init(const char* fname)
{
// fout = gbfopen(fname, "w");
}
static void
format_skeleton_wr_deinit()
{
// gbfclose(fout);
}
static void
format_skeleton_write()
{
// Here is how you register callbacks for all waypoints, routes, tracks.
// waypt_disp_all(waypt)
// route_disp_all(head, tail, rtept);
// track_disp_all(head, tail, trkpt);
}
static void
format_skeleton_exit(void) /* optional */
{
}
/**************************************************************************/
// capabilities below means: we can only read and write waypoints
// please change this depending on your new module
ff_vecs_t format_skeleton_vecs = {
ff_type_file,
{
(ff_cap)(ff_cap_read | ff_cap_write) /* waypoints */,
ff_cap_none /* tracks */,
ff_cap_none /* routes */
},
format_skeleton_rd_init,
format_skeleton_wr_init,
format_skeleton_rd_deinit,
format_skeleton_wr_deinit,
format_skeleton_read,
format_skeleton_write,
format_skeleton_exit,
&format_skeleton_args,
NULL_POS_OPS // Unless you do realtime positioning
};
/**************************************************************************/