You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

defs.h 36KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177
  1. /*
  2. Copyright (C) 2002-2014 Robert Lipe, robertlipe+source@gpsbabel.org
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
  14. */
  15. #ifndef gpsbabel_defs_h_included
  16. #define gpsbabel_defs_h_included
  17. #include <stdint.h>
  18. #if HAVE_CONFIG_H
  19. #include "config.h"
  20. #endif
  21. #include "queue.h"
  22. #if HAVE_LIBZ
  23. #include <zlib.h>
  24. #elif !ZLIB_INHIBITED
  25. #include "zlib/zlib.h"
  26. #endif
  27. #include "gbfile.h"
  28. #include "inifile.h"
  29. #include "session.h"
  30. #include <QtCore/QString>
  31. # include "src/core/datetime.h"
  32. #define CSTR(qstr) (qstr.toUtf8().constData())
  33. #define STRFROMUNICODE(qstr) (global_opts.codec->fromUnicode(qstr).constData())
  34. #define STRTOUNICODE(cstr) (global_opts.codec->toUnicode(cstr))
  35. /*
  36. * Amazingly, this constant is not specified in the standard...
  37. */
  38. #ifndef M_PI
  39. # define M_PI 3.14159265358979323846
  40. #endif
  41. #ifndef FALSE
  42. # define FALSE false
  43. #endif
  44. #ifndef TRUE
  45. # define TRUE true
  46. #endif
  47. #define FEET_TO_METERS(feetsies) ((feetsies) * 0.3048)
  48. #define METERS_TO_FEET(meetsies) ((meetsies) * 3.2808399)
  49. #define NMILES_TO_METERS(a) ((a) * 1852.0) /* nautical miles */
  50. #define METERS_TO_NMILES(a) ((a) / 1852.0)
  51. #define MILES_TO_METERS(a) ((a) * 1609.344)
  52. #define METERS_TO_MILES(a) ((a) / 1609.344)
  53. #define FATHOMS_TO_METERS(a) ((a) * 1.8288)
  54. #define CELSIUS_TO_FAHRENHEIT(a) (((a) * 1.8) + 32)
  55. #define FAHRENHEIT_TO_CELSIUS(a) (((a) - 32) / 1.8)
  56. #define SECONDS_PER_HOUR (60L*60)
  57. #define SECONDS_PER_DAY (24L*60*60)
  58. /* meters/second to kilometers/hour */
  59. #define MPS_TO_KPH(a) ((double)(a)*SECONDS_PER_HOUR/1000)
  60. /* meters/second to miles/hour */
  61. #define MPS_TO_MPH(a) (METERS_TO_MILES(a) * SECONDS_PER_HOUR)
  62. /* meters/second to knots */
  63. #define MPS_TO_KNOTS(a) (MPS_TO_KPH((a)/1.852))
  64. /* kilometers/hour to meters/second */
  65. #define KPH_TO_MPS(a) ((double)(a)*1000/SECONDS_PER_HOUR)
  66. /* miles/hour to meters/second */
  67. #define MPH_TO_MPS(a) (MILES_TO_METERS(a) / SECONDS_PER_HOUR)
  68. /* knots to meters/second */
  69. #define KNOTS_TO_MPS(a) (KPH_TO_MPS((a)*1.852))
  70. /*
  71. * Snprintf is in SUS (so it's in most UNIX-like substance) and it's in
  72. * C99 (albeit with slightly different semantics) but it isn't in C89.
  73. * This tweaks allows us to use snprintf on the holdout.
  74. */
  75. #if __WIN32__
  76. # define snprintf _snprintf
  77. # define vsnprintf _vsnprintf
  78. # ifndef fileno
  79. # define fileno _fileno
  80. # endif
  81. # define strdup _strdup
  82. #endif
  83. /* Workaround for lack of va_copy in Visual Studio 2012 and earlier */
  84. #if __WIN32__
  85. # if _MSC_VER
  86. # if _MSC_VER < 1700
  87. # define va_copy(dest, src) ((dest) = (src))
  88. # endif
  89. # endif
  90. #endif
  91. /* Turn off numeric conversion warning */
  92. #if __WIN32__
  93. # if _MSC_VER
  94. # pragma warning(disable:4244)
  95. # endif
  96. #if !defined _CRT_SECURE_NO_DEPRECATE
  97. # define _CRT_SECURE_NO_DEPRECATE 1
  98. #endif
  99. #endif
  100. /* Pathname separator character */
  101. #if __WIN32__
  102. # define GB_PATHSEP '\\'
  103. #else
  104. # define GB_PATHSEP '/'
  105. #endif
  106. /*
  107. * Toss in some GNU C-specific voodoo for checking.
  108. */
  109. #if __GNUC__
  110. # define PRINTFLIKE(x,y) __attribute__ ((__format__ (__printf__, (x), (y))))
  111. # define NORETURN void __attribute__ ((__noreturn__))
  112. #else
  113. # define PRINTFLIKE(x,y)
  114. # define NORETURN void
  115. #endif
  116. /*
  117. * Common definitions. There should be no protocol or file-specific
  118. * data in this file.
  119. */
  120. #define BASE_STRUCT(memberp, struct_type, member_name) \
  121. ((struct_type *)((char *)(memberp) - offsetof(struct_type, member_name)))
  122. typedef enum {
  123. fix_unknown=-1,
  124. fix_none=0,
  125. fix_2d=1,
  126. fix_3d,
  127. fix_dgps,
  128. fix_pps
  129. } fix_type;
  130. typedef enum {
  131. status_unknown=0,
  132. status_true,
  133. status_false
  134. } status_type;
  135. /*
  136. * Define globally on which kind of data gpsbabel is working.
  137. * Important for "file types" that are essentially a communication
  138. * protocol for a receiver, like the Magellan serial data.
  139. */
  140. typedef enum {
  141. unknown_gpsdata = 0,
  142. trkdata = 1 ,
  143. wptdata,
  144. rtedata,
  145. posndata
  146. } gpsdata_type;
  147. #define NOTHINGMASK 0
  148. #define WPTDATAMASK 1
  149. #define TRKDATAMASK 2
  150. #define RTEDATAMASK 4
  151. #define POSNDATAMASK 8
  152. /* mask objective testing */
  153. #define doing_nothing (global_opts.masked_objective == NOTHINGMASK)
  154. #define doing_wpts ((global_opts.masked_objective & WPTDATAMASK) == WPTDATAMASK)
  155. #define doing_trks ((global_opts.masked_objective & TRKDATAMASK) == TRKDATAMASK)
  156. #define doing_rtes ((global_opts.masked_objective & RTEDATAMASK) == RTEDATAMASK)
  157. #define doing_posn ((global_opts.masked_objective & POSNDATAMASK) == POSNDATAMASK)
  158. typedef struct {
  159. int synthesize_shortnames;
  160. int debug_level;
  161. gpsdata_type objective;
  162. unsigned int masked_objective;
  163. int verbose_status; /* set by GUI wrappers for status */
  164. int smart_icons;
  165. int smart_names;
  166. cet_cs_vec_t* charset;
  167. QString charset_name;
  168. inifile_t* inifile;
  169. QTextCodec* codec;
  170. } global_options;
  171. extern global_options global_opts;
  172. extern const char gpsbabel_version[];
  173. extern time_t gpsbabel_now; /* gpsbabel startup-time; initialized in main.c with time() */
  174. extern time_t gpsbabel_time; /* gpsbabel startup-time; initialized in main.c with current_time(), ! ZERO within testo ! */
  175. extern int geocaches_present;
  176. class QTextStream;
  177. extern QTextStream cerr;
  178. #define MILLI_TO_MICRO(t) (t * 1000) /* Milliseconds to Microseconds */
  179. #define MICRO_TO_MILLI(t) (t / 1000) /* Microseconds to Milliseconds*/
  180. #define CENTI_TO_MICRO(t) (t * 10000) /* Centiseconds to Microseconds */
  181. #define MICRO_TO_CENTI(t) (t / 10000) /* Centiseconds to Microseconds */
  182. /*
  183. * Extended data if waypoint happens to represent a geocache. This is
  184. * totally voluntary data...
  185. */
  186. typedef enum {
  187. gt_unknown = 0 ,
  188. gt_traditional,
  189. gt_multi,
  190. gt_virtual,
  191. gt_letterbox,
  192. gt_event,
  193. gt_suprise,
  194. gt_webcam,
  195. gt_earth,
  196. gt_locationless,
  197. gt_benchmark, /* Extension to Groundspeak for GSAK */
  198. gt_cito,
  199. gt_ape,
  200. gt_mega,
  201. gt_wherigo
  202. } geocache_type;
  203. typedef enum {
  204. gc_unknown = 0,
  205. gc_micro,
  206. gc_other,
  207. gc_regular,
  208. gc_large,
  209. gc_virtual,
  210. gc_small
  211. } geocache_container;
  212. class utf_string
  213. {
  214. public:
  215. utf_string() :
  216. is_html(false)
  217. {};
  218. bool is_html;
  219. QString utfstring;
  220. };
  221. class geocache_data
  222. {
  223. public:
  224. geocache_data() :
  225. id(0),
  226. type(gt_unknown),
  227. container(gc_unknown),
  228. diff(0),
  229. terr(0),
  230. is_archived(status_unknown),
  231. is_available(status_unknown),
  232. is_memberonly(status_unknown),
  233. has_customcoords(status_unknown),
  234. placer_id(0),
  235. favorite_points(0)
  236. {}
  237. int id; /* The decimal cache number */
  238. geocache_type type:5;
  239. geocache_container container:4;
  240. unsigned int diff:6; /* (multiplied by ten internally) */
  241. unsigned int terr:6; /* (likewise) */
  242. status_type is_archived:2;
  243. status_type is_available:2;
  244. status_type is_memberonly:2;
  245. status_type has_customcoords:2;
  246. gpsbabel::DateTime exported;
  247. gpsbabel::DateTime last_found;
  248. QString placer; /* Placer name */
  249. int placer_id; /* Placer id */
  250. QString hint; /* all these UTF8, XML entities removed, May be not HTML. */
  251. utf_string desc_short;
  252. utf_string desc_long;
  253. int favorite_points;
  254. QString personal_note;
  255. };
  256. typedef void (*fs_destroy)(void*);
  257. typedef void (*fs_copy)(void**, void*);
  258. typedef void (*fs_convert)(void*);
  259. typedef struct format_specific_data {
  260. long type;
  261. struct format_specific_data* next;
  262. fs_destroy destroy;
  263. fs_copy copy;
  264. fs_convert convert;
  265. } format_specific_data;
  266. class gb_color
  267. {
  268. public:
  269. gb_color() :
  270. bbggrr(-1),
  271. opacity(255) {}
  272. int bbggrr; // 32 bit color: Blue/Green/Red. < 0 == unknown.
  273. unsigned char opacity; // 0 == transparent. 255 == opaque.
  274. };
  275. format_specific_data* fs_chain_copy(format_specific_data* source);
  276. void fs_chain_destroy(format_specific_data* chain);
  277. format_specific_data* fs_chain_find(format_specific_data* chain, long type);
  278. void fs_chain_add(format_specific_data** chain, format_specific_data* data);
  279. #define FS_GPX 0x67707800L
  280. #define FS_AN1W 0x616e3177L
  281. #define FS_AN1L 0x616e316cL
  282. #define FS_AN1V 0x616e3176L
  283. #define FS_OZI 0x6f7a6900L
  284. #define FS_GMSD 0x474d5344L /* GMSD = Garmin specific data */
  285. #define FS_LOWRANCEUSR4 0x615f234cL
  286. /*
  287. * Structures and functions for multiple URLs per waypoint.
  288. */
  289. class UrlLink
  290. {
  291. public:
  292. UrlLink() { }
  293. UrlLink(const QString url) :
  294. url_(url)
  295. { }
  296. UrlLink(const char* url) :
  297. url_(url)
  298. { }
  299. UrlLink(const QString url, const QString url_link_text) :
  300. url_(url),
  301. url_link_text_(url_link_text)
  302. { }
  303. UrlLink(const QString url, const QString url_link_text, const QString url_link_type) :
  304. url_(url),
  305. url_link_text_(url_link_text),
  306. url_link_type_(url_link_type)
  307. { }
  308. QString url_;
  309. QString url_link_text_;
  310. QString url_link_type_;
  311. };
  312. /*
  313. * Misc bitfields inside struct waypoint;
  314. */
  315. class wp_flags
  316. {
  317. public:
  318. wp_flags() :
  319. shortname_is_synthetic(0),
  320. cet_converted(0),
  321. fmt_use(0),
  322. temperature(0),
  323. proximity(0),
  324. course(0),
  325. speed(0),
  326. geoidheight(0),
  327. depth(0),
  328. is_split(0),
  329. new_trkseg(0) {}
  330. unsigned int shortname_is_synthetic:1;
  331. unsigned int cet_converted:1; /* strings are converted to UTF8; interesting only for input */
  332. unsigned int fmt_use:2; /* lightweight "extra data" */
  333. /* "flagged fields" */
  334. unsigned int temperature:1; /* temperature field is set */
  335. unsigned int proximity:1; /* proximity field is set */
  336. unsigned int course:1; /* course field is set */
  337. unsigned int speed:1; /* speed field is set */
  338. unsigned int geoidheight:1; /* geoidheight field is set */
  339. unsigned int depth:1; /* depth field is set */
  340. /* !ToDo!
  341. unsigned int altitude:1; /+ altitude field is set +/
  342. ... and others
  343. */
  344. unsigned int is_split:1; /* the waypoint represents a split */
  345. unsigned int new_trkseg:1; /* True if first in new trkseg. */
  346. };
  347. // These are dicey as they're collected on read. Subsequent filters may change
  348. // things, though it's u nlikely to matter in practical terms. Don't use these
  349. // if a false positive would be deleterious.
  350. #
  351. class global_trait
  352. {
  353. public:
  354. global_trait() :
  355. trait_geocaches(0),
  356. trait_heartrate(0),
  357. trait_cadence(0),
  358. trait_power(0),
  359. trait_depth(0),
  360. trait_temperature(0) {}
  361. unsigned int trait_geocaches:1;
  362. unsigned int trait_heartrate:1;
  363. unsigned int trait_cadence:1;
  364. unsigned int trait_power:1;
  365. unsigned int trait_depth:1;
  366. unsigned int trait_temperature:1;
  367. };
  368. const global_trait* get_traits();
  369. #define WAYPT_SET(wpt,member,val) { wpt->member = (val); wpt->wpt_flags.member = 1; }
  370. #define WAYPT_GET(wpt,member,def) ((wpt->wpt_flags.member) ? (wpt->member) : (def))
  371. #define WAYPT_UNSET(wpt,member) wpt->wpt_flags.member = 0
  372. #define WAYPT_HAS(wpt,member) (wpt->wpt_flags.member)
  373. #define CSTRc(qstr) (qstr.toLatin1().constData())
  374. // Maybe the XmlGeneric string callback really shouldn't have a type
  375. // of its own; this was a crutch during the move from char* to QString.
  376. // It's "just" a search and replace to make it go away, but it might
  377. // be convenient to overload some day.
  378. typedef const QString& xg_string;
  379. /*
  380. * This is a waypoint, as stored in the GPSR. It tries to not
  381. * cater to any specific model or protocol. Anything that needs to
  382. * be truncated, edited, or otherwise trimmed should be done on the
  383. * way to the target.
  384. */
  385. class Waypoint
  386. {
  387. private:
  388. static geocache_data empty_gc_data;
  389. public:
  390. queue Q; /* Master waypoint q. Not for use
  391. by modules. */
  392. double latitude; /* Degrees */
  393. double longitude; /* Degrees */
  394. double altitude; /* Meters. */
  395. double geoidheight; /* Height (in meters) of geoid (mean sea level) above WGS84 earth ellipsoid. */
  396. /*
  397. * The "thickness" of a waypoint; adds an element of 3D. Can be
  398. * used to construct rudimentary polygons for, say, airspace
  399. * definitions. The units are meters.
  400. */
  401. double depth;
  402. /*
  403. * An alarm trigger value that can be considered to be a circle
  404. * surrounding a waypoint (or cylinder if depth is also defined).
  405. * The units are meters.
  406. */
  407. double proximity;
  408. /* shortname is a waypoint name as stored in receiver. It should
  409. * strive to be, well, short, and unique. Enforcing length and
  410. * character restrictions is the job of the output. A typical
  411. * minimum length for shortname is 6 characters for NMEA units,
  412. * 8 for Magellan and 10 for Vista. These are only guidelines.
  413. */
  414. QString shortname;
  415. /*
  416. * description is typically a human readable description of the
  417. * waypoint. It may be used as a comment field in some receivers.
  418. * These are probably under 40 bytes, but that's only a guideline.
  419. */
  420. QString description;
  421. /*
  422. * notes are relatively long - over 100 characters - prose associated
  423. * with the above. Unlike shortname and description, these are never
  424. * used to compute anything else and are strictly "passed through".
  425. * Few formats support this.
  426. */
  427. QString notes;
  428. /* TODO: UrlLink should probably move to a "real" class of its own.
  429. */
  430. QList<UrlLink> url_link_list_;
  431. wp_flags wpt_flags;
  432. QString icon_descr;
  433. gpsbabel::DateTime creation_time;
  434. /*
  435. * route priority is for use by the simplify filter. If we have
  436. * some reason to believe that the route point is more important,
  437. * we can give it a higher (numerically; 0 is the lowest) priority.
  438. * This causes it to be removed last.
  439. * This is currently used by the saroute input filter to give named
  440. * waypoints (representing turns) a higher priority.
  441. * This is also used by the google input filter because they were
  442. * nice enough to use exactly the same priority scheme.
  443. */
  444. int route_priority;
  445. /* Optional dilution of precision: positional, horizontal, veritcal.
  446. * 1 <= dop <= 50
  447. */
  448. float hdop;
  449. float vdop;
  450. float pdop;
  451. float course; /* Optional: degrees true */
  452. float speed; /* Optional: meters per second. */
  453. fix_type fix; /* Optional: 3d, 2d, etc. */
  454. int sat; /* Optional: number of sats used for fix */
  455. unsigned char heartrate; /* Beats/min. likely to get moved to fs. */
  456. unsigned char cadence; /* revolutions per minute */
  457. float power; /* watts, as measured by cyclists */
  458. float temperature; /* Degrees celsius */
  459. float odometer_distance; /* Meters? */
  460. geocache_data* gc_data;
  461. format_specific_data* fs;
  462. session_t* session; /* pointer to a session struct */
  463. void* extra_data; /* Extra data added by, say, a filter. */
  464. private:
  465. Waypoint& operator=(const Waypoint& other);
  466. public:
  467. Waypoint();
  468. ~Waypoint();
  469. Waypoint(const Waypoint& other);
  470. bool HasUrlLink() const;
  471. const UrlLink& GetUrlLink() const;
  472. const QList<UrlLink> GetUrlLinks() const;
  473. void AddUrlLink(const UrlLink l);
  474. QString CreationTimeXML() const;
  475. gpsbabel::DateTime GetCreationTime() const;
  476. void SetCreationTime(gpsbabel::DateTime t);
  477. void SetCreationTime(time_t t);
  478. void SetCreationTime(time_t t, int ms);
  479. geocache_data* AllocGCData();
  480. int EmptyGCData() const;
  481. };
  482. class route_head
  483. {
  484. public:
  485. queue Q; /* Link onto parent list. */
  486. queue waypoint_list; /* List of child waypoints */
  487. QString rte_name;
  488. QString rte_desc;
  489. QString rte_url;
  490. int rte_num;
  491. int rte_waypt_ct; /* # waypoints in waypoint list */
  492. format_specific_data* fs;
  493. unsigned short cet_converted; /* strings are converted to UTF8; interesting only for input */
  494. gb_color line_color; /* Optional line color for rendering */
  495. int line_width; /* in pixels (sigh). < 0 is unknown. */
  496. session_t* session; /* pointer to a session struct */
  497. public:
  498. route_head();
  499. ~route_head();
  500. };
  501. /*
  502. * Structure of recomputed track/roue data.
  503. */
  504. typedef struct {
  505. double distance_meters;
  506. double max_alt; /* unknown_alt => invalid */
  507. double min_alt; /* -unknown_alt => invalid */
  508. double max_spd; /* Meters/sec */
  509. double min_spd; /* Meters/sec */
  510. double avg_hrt; /* Avg Heartrate */
  511. double avg_cad; /* Avg Cadence */
  512. time_t start; /* Min time */
  513. time_t end; /* Max time */
  514. int min_hrt; /* Min Heartrate */
  515. int max_hrt; /* Max Heartrate */
  516. int max_cad; /* Max Cadence */
  517. } computed_trkdata;
  518. /*
  519. * Bounding box information.
  520. */
  521. typedef struct {
  522. double max_lat;
  523. double max_lon;
  524. double max_alt; /* unknown_alt => invalid */
  525. double min_lat;
  526. double min_lon;
  527. double min_alt; /* -unknown_alt => invalid */
  528. } bounds;
  529. typedef struct {
  530. volatile int request_terminate;
  531. } posn_status;
  532. extern posn_status tracking_status;
  533. typedef void (*ff_init)(const QString&);
  534. typedef void (*ff_deinit)(void);
  535. typedef void (*ff_read)(void);
  536. typedef void (*ff_write)(void);
  537. typedef void (*ff_exit)(void);
  538. typedef void (*ff_writeposn)(Waypoint*);
  539. typedef Waypoint* (*ff_readposn)(posn_status*);
  540. #ifndef DEBUG_MEM
  541. char* get_option(const char* iarglist, const char* argname);
  542. #else
  543. #define DEBUG_PARAMS const char *file, const int line
  544. char* GET_OPTION(const char* iarglist, const char* argname, DEBUG_PARAMS);
  545. #define get_option(iarglist, argname) GET_OPTION(iarglist, argname, __FILE__, __LINE__)
  546. #endif
  547. typedef void (*filter_init)(char const*);
  548. typedef void (*filter_process)(void);
  549. typedef void (*filter_deinit)(void);
  550. typedef void (*filter_exit)(void);
  551. typedef void (*waypt_cb)(const Waypoint*);
  552. typedef void (*route_hdr)(const route_head*);
  553. typedef void (*route_trl)(const route_head*);
  554. void waypt_add(Waypoint*);
  555. Waypoint* waypt_dupe(const Waypoint*);
  556. Waypoint* waypt_new(void);
  557. void waypt_del(Waypoint*);
  558. void waypt_free(Waypoint*);
  559. void waypt_disp_all(waypt_cb);
  560. void waypt_disp_session(const session_t* se, waypt_cb cb);
  561. void waypt_init_bounds(bounds* bounds);
  562. int waypt_bounds_valid(bounds* bounds);
  563. void waypt_add_to_bounds(bounds* bounds, const Waypoint* waypointp);
  564. void waypt_compute_bounds(bounds*);
  565. double gcgeodist(const double lat1, const double lon1,
  566. const double lat2, const double lon2);
  567. void waypt_flush(queue*);
  568. void waypt_flush_all(void);
  569. unsigned int waypt_count(void);
  570. void set_waypt_count(unsigned int nc);
  571. void waypt_add_url(Waypoint* wpt, const QString& link,
  572. const QString& url_link_text);
  573. void waypt_add_url(Waypoint* wpt, const QString& link,
  574. const QString& url_link_text,
  575. const QString& url_link_type);
  576. void xcsv_setup_internal_style(const char* style_buf);
  577. void xcsv_read_internal_style(const char* style_buf);
  578. Waypoint* find_waypt_by_name(const QString& name);
  579. void waypt_backup(signed int* count, queue** head_bak);
  580. void waypt_restore(signed int count, queue* head_bak);
  581. geocache_data* waypt_alloc_gc_data(Waypoint* wpt);
  582. int waypt_empty_gc_data(const Waypoint* wpt);
  583. geocache_type gs_mktype(const QString& t);
  584. geocache_container gs_mkcont(const QString& t);
  585. route_head* route_head_alloc(void);
  586. void route_add(Waypoint*);
  587. void route_add_wpt(route_head* rte, Waypoint* wpt);
  588. void route_add_wpt_named(route_head* rte, Waypoint* wpt, const QString& namepart, int number_digits);
  589. void route_del_wpt(route_head* rte, Waypoint* wpt);
  590. void track_add_wpt(route_head* rte, Waypoint* wpt);
  591. void track_add_wpt_named(route_head* rte, Waypoint* wpt, const QString& namepart, int number_digits);
  592. void track_del_wpt(route_head* rte, Waypoint* wpt);
  593. void route_add_head(route_head* rte);
  594. void route_del_head(route_head* rte);
  595. void route_reverse(const route_head* rte_hd);
  596. Waypoint* route_find_waypt_by_name(route_head* rh, const char* name);
  597. void track_add_head(route_head* rte);
  598. void track_del_head(route_head* rte);
  599. void track_insert_head(route_head* rte, route_head* predecessor);
  600. void route_disp(const route_head* rte, waypt_cb);
  601. void route_disp_all(route_hdr, route_trl, waypt_cb);
  602. void track_disp_all(route_hdr, route_trl, waypt_cb);
  603. void route_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc);
  604. void track_disp_session(const session_t* se, route_hdr rh, route_trl rt, waypt_cb wc);
  605. void route_flush(queue*);
  606. void route_flush_all(void);
  607. void route_flush_all_routes(void);
  608. void route_flush_all_tracks(void);
  609. route_head* route_find_route_by_name(const char* name);
  610. route_head* route_find_track_by_name(const char* name);
  611. unsigned int route_waypt_count(void);
  612. unsigned int route_count(void);
  613. unsigned int track_waypt_count(void);
  614. unsigned int track_count(void);
  615. void route_copy(int* dst_count, int* dst_wpt_count, queue** dst, queue* src);
  616. void route_backup(signed int* count, queue** head_bak);
  617. void route_restore(queue* head_bak);
  618. void route_append(queue* src);
  619. void track_backup(signed int* count, queue** head_bak);
  620. void track_restore(queue* head_bak);
  621. void track_append(queue* src);
  622. void route_flush(queue* head);
  623. void track_recompute(const route_head* trk, computed_trkdata**);
  624. /*
  625. * All shortname functions take a shortname handle as the first arg.
  626. * This is an opaque pointer. Callers must not fondle the contents of it.
  627. */
  628. // This is a crutch until the new C++ shorthandle goes in.
  629. #define PRIME 37
  630. typedef struct {
  631. unsigned int target_len;
  632. char* badchars;
  633. char* goodchars;
  634. char* defname;
  635. queue namelist[PRIME];
  636. /* Various internal flags at end to allow alignment flexibility. */
  637. unsigned int mustupper:1;
  638. unsigned int whitespaceok:1;
  639. unsigned int repeating_whitespaceok:1;
  640. unsigned int must_uniq:1;
  641. unsigned int is_utf8:1;
  642. } mkshort_handle_imp;
  643. typedef mkshort_handle_imp* short_handle;
  644. #ifndef DEBUG_MEM
  645. char* mkshort(short_handle, const char*);
  646. QString mkshort(short_handle, const QString&);
  647. short_handle mkshort_new_handle(void);
  648. #else
  649. char* MKSHORT(short_handle, const char*, DEBUG_PARAMS);
  650. short_handle MKSHORT_NEW_HANDLE(DEBUG_PARAMS);
  651. #define mkshort( a, b) MKSHORT(a,b,__FILE__, __LINE__)
  652. #define mkshort_new_handle() MKSHORT_NEW_HANDLE(__FILE__,__LINE__)
  653. #endif
  654. QString mkshort_from_wpt(short_handle h, const Waypoint* wpt);
  655. void mkshort_del_handle(short_handle* h);
  656. void setshort_length(short_handle, int n);
  657. void setshort_badchars(short_handle, const char*);
  658. void setshort_goodchars(short_handle, const char*);
  659. void setshort_mustupper(short_handle, int n);
  660. void setshort_mustuniq(short_handle, int n);
  661. void setshort_whitespace_ok(short_handle, int n);
  662. void setshort_repeating_whitespace_ok(short_handle, int n);
  663. void setshort_defname(short_handle, const char* s);
  664. void setshort_is_utf8(short_handle h, const int is_utf8);
  665. #define ARGTYPE_UNKNOWN 0x00000000
  666. #define ARGTYPE_INT 0x00000001
  667. #define ARGTYPE_FLOAT 0x00000002
  668. #define ARGTYPE_STRING 0x00000003
  669. #define ARGTYPE_BOOL 0x00000004
  670. #define ARGTYPE_FILE 0x00000005
  671. #define ARGTYPE_OUTFILE 0x00000006
  672. /* REQUIRED means that the option is required to be set.
  673. * See also BEGIN/END_REQ */
  674. #define ARGTYPE_REQUIRED 0x40000000
  675. /* HIDDEN means that the option does not appear in help texts. Useful
  676. * for debugging or testing options */
  677. #define ARGTYPE_HIDDEN 0x20000000
  678. /* BEGIN/END_EXCL mark the beginning and end of an exclusive range of
  679. * options. No more than one of the options in the range may be selected
  680. * or set. If exactly one must be set, use with BEGIN/END_REQ
  681. * Both of these flags set is just like neither set, so avoid doing that. */
  682. #define ARGTYPE_BEGIN_EXCL 0x10000000
  683. #define ARGTYPE_END_EXCL 0x08000000
  684. /* BEGIN/END_REQ mark the beginning and end of a required range of
  685. * options. One or more of the options in the range MUST be selected or set.
  686. * If exactly one must be set, use with BEGIN/END_EXCL
  687. * Both of these flags set is synonymous with REQUIRED, so use that instead
  688. * for "groups" of exactly one option. */
  689. #define ARGTYPE_BEGIN_REQ 0x04000000
  690. #define ARGTYPE_END_REQ 0x02000000
  691. #define ARGTYPE_TYPEMASK 0x00000fff
  692. #define ARGTYPE_FLAGMASK 0xfffff000
  693. #define ARG_NOMINMAX NULL, NULL
  694. #define ARG_TERMINATOR {0, 0, 0, 0, 0, ARG_NOMINMAX, NULL}
  695. typedef struct arglist {
  696. const char* argstring;
  697. char** argval;
  698. const char* helpstring;
  699. const char* defaultvalue;
  700. const uint32_t argtype;
  701. const char* minvalue; /* minimum value for numeric options */
  702. const char* maxvalue; /* maximum value for numeric options */
  703. char* argvalptr; /* !!! internal helper. Not used in definitions !!! */
  704. } arglist_t;
  705. typedef enum {
  706. ff_type_file = 1, /* normal format: useful to a GUI. */
  707. ff_type_internal, /* fmt not useful with default options */
  708. ff_type_serial /* format describes a serial protocol (GUI can display port names) */
  709. } ff_type;
  710. typedef enum {
  711. ff_cap_rw_wpt,
  712. ff_cap_rw_trk,
  713. ff_cap_rw_rte
  714. } ff_cap_array;
  715. typedef enum {
  716. ff_cap_none,
  717. ff_cap_read = 1,
  718. ff_cap_write = 2
  719. } ff_cap;
  720. #define FF_CAP_RW_ALL \
  721. { (ff_cap) (ff_cap_read | ff_cap_write), (ff_cap) (ff_cap_read | ff_cap_write), (ff_cap) (ff_cap_read | ff_cap_write) }
  722. #define FF_CAP_RW_WPT \
  723. { (ff_cap) (ff_cap_read | ff_cap_write), ff_cap_none, ff_cap_none}
  724. /*
  725. * Format capabilities for realtime positioning.
  726. */
  727. typedef struct position_ops {
  728. ff_init rd_init;
  729. ff_readposn rd_position;
  730. ff_deinit rd_deinit;
  731. ff_init wr_init;
  732. ff_writeposn wr_position;
  733. ff_deinit wr_deinit;
  734. } position_ops_t;
  735. #define NULL_POS_OPS { 0, 0, 0, 0, 0, 0, }
  736. /*
  737. * Describe the file format to the caller.
  738. */
  739. typedef struct ff_vecs {
  740. ff_type type;
  741. ff_cap cap[3];
  742. ff_init rd_init;
  743. ff_init wr_init;
  744. ff_deinit rd_deinit;
  745. ff_deinit wr_deinit;
  746. ff_read read;
  747. ff_write write;
  748. ff_exit exit;
  749. arglist_t* args;
  750. const char* encode;
  751. int fixed_encode;
  752. position_ops_t position_ops;
  753. const char* name; /* dyn. initialized by find_vec */
  754. } ff_vecs_t;
  755. typedef struct style_vecs {
  756. const char* name;
  757. const char* style_buf;
  758. } style_vecs_t;
  759. extern style_vecs_t style_list[];
  760. void waypt_init(void);
  761. void route_init(void);
  762. void waypt_disp(const Waypoint*);
  763. void waypt_status_disp(int total_ct, int myct);
  764. double waypt_time(const Waypoint* wpt);
  765. double waypt_speed(const Waypoint* A, const Waypoint* B);
  766. double waypt_speed_ex(const Waypoint* A, const Waypoint* B);
  767. double waypt_vertical_speed(const Waypoint* A, const Waypoint* B);
  768. double waypt_gradient(const Waypoint* A, const Waypoint* B);
  769. double waypt_course(const Waypoint* A, const Waypoint* B);
  770. double waypt_distance(const Waypoint* A, const Waypoint* B);
  771. double waypt_distance_ex(const Waypoint* A, const Waypoint* B);
  772. NORETURN fatal(const char*, ...) PRINTFLIKE(1, 2);
  773. void is_fatal(const int condition, const char*, ...) PRINTFLIKE(2, 3);
  774. void warning(const char*, ...) PRINTFLIKE(1, 2);
  775. void debug_print(int level, const char* fmt, ...) PRINTFLIKE(2,3);
  776. ff_vecs_t* find_vec(const char*, const char**);
  777. void assign_option(const char* vecname, arglist_t* ap, const char* val);
  778. void disp_vec_options(const char* vecname, arglist_t* ap);
  779. void disp_vecs(void);
  780. void disp_vec(const char* vecname);
  781. void init_vecs(void);
  782. void exit_vecs(void);
  783. void disp_formats(int version);
  784. const char* name_option(long type);
  785. void printposn(const double c, int is_lat);
  786. #ifndef DEBUG_MEM
  787. void* xcalloc(size_t nmemb, size_t size);
  788. void* xmalloc(size_t size);
  789. void* xrealloc(void* p, size_t s);
  790. void xfree(const void* mem);
  791. char* xstrdup(const QString& s);
  792. char* xstrndup(const char* s, size_t n);
  793. char* xstrndupt(const char* s, size_t n);
  794. char* xstrappend(char* src, const char* addon);
  795. #define xxcalloc(nmemb, size, file, line) xcalloc(nmemb, size)
  796. #define xxmalloc(size, file, line) xmalloc(size)
  797. #define xxrealloc(p, s, file, line) xrealloc(p,s)
  798. #define xxfree(mem, file, line) xfree(mem)
  799. #define xxstrdup(s, file, line) xstrdup(s)
  800. char *xstrdup(const char* s);
  801. #define xxstrappend(src, addon, file, line) xstrappend(src, addon)
  802. #else /* DEBUG_MEM */
  803. void* XCALLOC(size_t nmemb, size_t size, DEBUG_PARAMS);
  804. void* XMALLOC(size_t size, DEBUG_PARAMS);
  805. void* XREALLOC(void* p, size_t s, DEBUG_PARAMS);
  806. void XFREE(void* mem, DEBUG_PARAMS);
  807. char* XSTRDUP(const char* s, DEBUG_PARAMS);
  808. char* XSTRNDUP(const char* src, size_t size, DEBUG_PARAMS);
  809. char* XSTRNDUPT(const char* src, size_t size, DEBUG_PARAMS);
  810. char* XSTRAPPEND(char* src, const char* addon, DEBUG_PARAMS);
  811. void debug_mem_open();
  812. void debug_mem_output(char* format, ...);
  813. void debug_mem_close();
  814. #define xcalloc(nmemb, size) XCALLOC(nmemb, size, __FILE__, __LINE__)
  815. #define xmalloc(size) XMALLOC(size, __FILE__, __LINE__)
  816. #define xrealloc(p, s) XREALLOC(p,s,__FILE__,__LINE__)
  817. #define xfree(mem) XFREE(mem, __FILE__, __LINE__)
  818. #define xstrdup(s) XSTRDUP(s, __FILE__, __LINE__)
  819. #define xstrndup(s, z) XSTRNDUP(s, z, __FILE__, __LINE__)
  820. #define xstrndupt(s, z) XSTRNDUPT(s, z, __FILE__, __LINE__)
  821. #define xstrappend(src,addon) XSTRAPPEND(src, addon, __FILE__, __LINE__)
  822. #define xxcalloc XCALLOC
  823. #define xxmalloc XMALLOC
  824. #define xxrealloc XREALLOC
  825. #define xxfree XFREE
  826. #define xxstrdup XSTRDUP
  827. #define xxstrndupt XSTRNDUPT
  828. #define xxstrappend XSTRAPPEND
  829. #endif /* DEBUG_MEM */
  830. FILE* xfopen(const char* fname, const char* type, const char* errtxt);
  831. // FIXME: case_ignore_strcmp() and case_ignore_strncmp() should probably
  832. // just be replaced at the call sites. These shims are just here to make
  833. // them more accomidating of QString input.
  834. inline int
  835. case_ignore_strcmp(const QString& s1, const QString& s2) {
  836. return QString::compare(s1, s2, Qt::CaseInsensitive);
  837. }
  838. // In 95% of the callers, this could be s1.startsWith(s2)...
  839. inline int case_ignore_strncmp(const QString& s1, const QString& s2, int n) {
  840. return s1.left(n).compare(s2.left(n), Qt::CaseInsensitive);
  841. }
  842. int str_match(const char* str, const char* match);
  843. int case_ignore_str_match(const char* str, const char* match);
  844. QString strenquote(const QString& str, const QChar quot_char);
  845. char* strsub(const char* s, const char* search, const char* replace);
  846. char* gstrsub(const char* s, const char* search, const char* replace);
  847. const char* xstrrstr(const char* s1, const char* s2);
  848. void rtrim(char* s);
  849. char* lrtrim(char* s);
  850. int xasprintf(char** strp, const char* fmt, ...) PRINTFLIKE(2, 3);
  851. int xasprintf(QString* strp, const char* fmt, ...) PRINTFLIKE(2, 3);
  852. int xvasprintf(char** strp, const char* fmt, va_list ap);
  853. char* strupper(char* src);
  854. char* strlower(char* src);
  855. signed int get_tz_offset(void);
  856. time_t mklocaltime(struct tm* t);
  857. time_t mkgmtime(struct tm* t);
  858. gpsbabel::DateTime current_time(void);
  859. void dotnet_time_to_time_t(double dotnet, time_t* t, int* ms);
  860. signed int month_lookup(const char* m);
  861. const char* get_cache_icon(const Waypoint* waypointp);
  862. const char* gs_get_cachetype(geocache_type t);
  863. const char* gs_get_container(geocache_container t);
  864. char* xml_entitize(const char* str);
  865. char* html_entitize(const QString& str);
  866. char* strip_html(const utf_string*);
  867. char* strip_nastyhtml(const QString& in);
  868. char* convert_human_date_format(const char* human_datef); /* "MM,YYYY,DD" -> "%m,%Y,%d" */
  869. char* convert_human_time_format(const char* human_timef); /* "HH+mm+ss" -> "%H+%M+%S" */
  870. char* pretty_deg_format(double lat, double lon, char fmt, const char* sep, int html); /* decimal -> dd.dddd or dd mm.mmm or dd mm ss */
  871. const QString get_filename(const QString& fname); /* extract the filename portion */
  872. /*
  873. * Character encoding transformations.
  874. */
  875. #define CET_NOT_CONVERTABLE_DEFAULT '$'
  876. #define CET_CHARSET_ASCII "US-ASCII"
  877. #define CET_CHARSET_UTF8 "UTF-8"
  878. #define CET_CHARSET_HEBREW "ISO-8859-8"
  879. #define CET_CHARSET_MS_ANSI "windows-1252"
  880. #define CET_CHARSET_LATIN1 "ISO-8859-1"
  881. #define str_utf8_to_cp1252(str) cet_str_utf8_to_cp1252((str))
  882. #define str_cp1252_to_utf8(str) cet_str_cp1252_to_utf8((str))
  883. #define str_utf8_to_iso8859_1(str) cet_str_utf8_to_iso8859_1((str))
  884. #define str_iso8859_1_to_utf8(str) cet_str_iso8859_1_to_utf8((str))
  885. /* this lives in gpx.c */
  886. gpsbabel::DateTime xml_parse_time(const QString& cdatastr);
  887. QString rot13(const QString& str);
  888. /*
  889. * PalmOS records like fixed-point numbers, which should be rounded
  890. * to deal with possible floating-point representation errors.
  891. */
  892. signed int si_round(double d);
  893. #if _MSC_VER
  894. //These functions are not included in the MS pre C99 implementation, use internal implementation
  895. //This asssumes that non-_MSC_VER includes math.h (all should include defs.h)
  896. #define round si_round
  897. #define lround si_round
  898. #endif
  899. /*
  900. * Data types for Palm/OS files.
  901. */
  902. typedef struct {
  903. unsigned char data[4];
  904. } pdb_32;
  905. typedef struct {
  906. unsigned char data[2];
  907. } pdb_16;
  908. typedef struct {
  909. unsigned char data[8];
  910. } pdb_double;
  911. typedef struct {
  912. unsigned char data[4];
  913. } pdb_float;
  914. /*
  915. * Protypes for Endianness helpers.
  916. */
  917. signed int be_read16(const void* p);
  918. unsigned int be_readu16(const void* p);
  919. signed int be_read32(const void* p);
  920. signed int le_read16(const void* p);
  921. unsigned int le_readu16(const void* p);
  922. signed int le_read32(const void* p);
  923. unsigned int le_readu32(const void* p);
  924. void le_read64(void* dest, const void* src);
  925. void be_write16(void* pp, const unsigned i);
  926. void be_write32(void* pp, const unsigned i);
  927. void le_write16(void* pp, const unsigned i);
  928. void le_write32(void* pp, const unsigned i);
  929. double endian_read_double(const void* ptr, int read_le);
  930. float endian_read_float(const void* ptr, int read_le);
  931. void endian_write_double(void* ptr, double d, int write_le);
  932. void endian_write_float(void* ptr, float f, int write_le);
  933. float be_read_float(void* p);
  934. double be_read_double(void* p);
  935. void be_write_float(void* pp, float d);
  936. void be_write_double(void* pp, double d);
  937. float le_read_float(const void* p);
  938. double le_read_double(const void* p);
  939. void le_write_float(void* ptr, float f);
  940. void le_write_double(void* p, double d);
  941. #define pdb_write_float be_write_float
  942. #define pdb_read_float be_read_float
  943. #define pdb_write_double be_write_double
  944. #define pdb_read_double be_read_double
  945. /*
  946. * Prototypes for generic conversion routines (util.c).
  947. */
  948. double ddmm2degrees(double ddmm_val);
  949. double degrees2ddmm(double deg_val);
  950. typedef enum {
  951. grid_unknown = -1,
  952. grid_lat_lon_ddd = 0,
  953. grid_lat_lon_dmm = 1,
  954. grid_lat_lon_dms = 2,
  955. grid_bng = 3,
  956. grid_utm = 4,
  957. grid_swiss = 5
  958. } grid_type;
  959. #define GRID_INDEX_MIN grid_lat_lon_ddd
  960. #define GRID_INDEX_MAX grid_swiss
  961. #define DATUM_OSGB36 86
  962. #define DATUM_WGS84 118
  963. /* bit manipulation functions (util.c) */
  964. char gb_getbit(const void* buf, const uint32_t nr);
  965. void gb_setbit(void* buf, const uint32_t nr);
  966. void* gb_int2ptr(const int i);
  967. int gb_ptr2int(const void* p);
  968. /*
  969. * From parse.c
  970. */
  971. int parse_coordinates(const char* str, int datum, const grid_type grid,
  972. double* latitude, double* longitude, const char* module);
  973. int parse_coordinates(const QString& str, int datum, const grid_type grid,
  974. double* latitude, double* longitude, const char* module);
  975. int parse_distance(const char* str, double* val, double scale, const char* module);
  976. int parse_distance(const QString& str, double* val, double scale, const char* module);
  977. int parse_speed(const char* str, double* val, const double scale, const char* module);
  978. int parse_speed(const QString& str, double* val, const double scale, const char* module);
  979. time_t parse_date(const char* str, const char* format, const char* module);
  980. time_t parse_date(const QString& str, const char* format, const char* module);
  981. /*
  982. * From util_crc.c
  983. */
  984. unsigned long get_crc32(const void* data, int datalen);
  985. unsigned long get_crc32_s(const void* data);
  986. /*
  987. * From units.c
  988. */
  989. typedef enum {
  990. units_unknown = 0,
  991. units_statute = 1,
  992. units_metric = 2,
  993. units_nautical =3,
  994. units_aviation =4
  995. } fmt_units;
  996. int fmt_setunits(fmt_units);
  997. double fmt_distance(const double, const char** tag);
  998. double fmt_altitude(const double, const char** tag);
  999. double fmt_speed(const double, const char** tag);
  1000. /*
  1001. * From gbsleep.c
  1002. */
  1003. void gb_sleep(unsigned long microseconds);
  1004. /*
  1005. * From nmea.c
  1006. */
  1007. int nmea_cksum(const char* const buf);
  1008. /*
  1009. * Color helpers.
  1010. */
  1011. int color_to_bbggrr(const char* cname);
  1012. /*
  1013. * A constant for unknown altitude. It's tempting to just use zero
  1014. * but that's not very nice for the folks near sea level.
  1015. */
  1016. #define unknown_alt -99999999.0
  1017. #define unknown_color -1
  1018. // TODO: this is a (probably temporary) shim for the C->QString conversion.
  1019. // It's here instead of gps to avoid C/C++ linkage issues.
  1020. int32_t GPS_Lookup_Datum_Index(const QString& n);
  1021. #endif /* gpsbabel_defs_h_included */