| defs.h | | defs.h | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| #include "gbtypes.h" | | #include "gbtypes.h" | |
| #if HAVE_LIBZ | | #if HAVE_LIBZ | |
| #include <zlib.h> | | #include <zlib.h> | |
| #elif !ZLIB_INHIBITED | | #elif !ZLIB_INHIBITED | |
| #include "zlib/zlib.h" | | #include "zlib/zlib.h" | |
| #endif | | #endif | |
| #include "gbfile.h" | | #include "gbfile.h" | |
| #include "cet.h" | | #include "cet.h" | |
| #include "cet_util.h" | | #include "cet_util.h" | |
| #include "inifile.h" | | #include "inifile.h" | |
|
| | | #include "session.h" | |
| | | | |
| // Turn on Unicode in expat? | | // Turn on Unicode in expat? | |
| #ifdef _UNICODE | | #ifdef _UNICODE | |
| # define XML_UNICODE | | # define XML_UNICODE | |
| #endif | | #endif | |
| | | | |
| /* | | /* | |
| * Amazingly, this constant is not specified in the standard... | | * Amazingly, this constant is not specified in the standard... | |
| */ | | */ | |
| #ifndef M_PI | | #ifndef M_PI | |
| # define M_PI 3.14159265358979323846 | | # define M_PI 3.14159265358979323846 | |
| #endif | | #endif | |
| | | | |
|
| | | #ifndef FALSE | |
| | | # define FALSE 0 | |
| | | #endif | |
| | | | |
| | | #ifndef TRUE | |
| | | # define TRUE !FALSE | |
| | | #endif | |
| | | | |
| #define FEET_TO_METERS(feetsies) ((feetsies) * 0.3048) | | #define FEET_TO_METERS(feetsies) ((feetsies) * 0.3048) | |
| #define METERS_TO_FEET(meetsies) ((meetsies) * 3.2808399) | | #define METERS_TO_FEET(meetsies) ((meetsies) * 3.2808399) | |
| | | | |
| #define NMILES_TO_METERS(a) ((a) * 1852.0) /* nautical miles */ | | #define NMILES_TO_METERS(a) ((a) * 1852.0) /* nautical miles */ | |
| #define MILES_TO_METERS(a) ((a) * 1609.344) | | #define MILES_TO_METERS(a) ((a) * 1609.344) | |
| #define METERS_TO_MILES(a) ((a) / 1609.344) | | #define METERS_TO_MILES(a) ((a) / 1609.344) | |
| #define FATHOMS_TO_METERS(a) ((a) * 1.8288) | | #define FATHOMS_TO_METERS(a) ((a) * 1.8288) | |
| | | | |
| #define CELSIUS_TO_FAHRENHEIT(a) (((a) * 1.8) + 32) | | #define CELSIUS_TO_FAHRENHEIT(a) (((a) * 1.8) + 32) | |
| #define FAHRENHEIT_TO_CELSIUS(a) (((a) - 32) / 1.8) | | #define FAHRENHEIT_TO_CELSIUS(a) (((a) - 32) / 1.8) | |
| | | | |
| skipping to change at line 291 | | skipping to change at line 300 | |
| | | | |
| typedef struct format_specific_data { | | typedef struct format_specific_data { | |
| long type; | | long type; | |
| struct format_specific_data *next; | | struct format_specific_data *next; | |
| | | | |
| fs_destroy destroy; | | fs_destroy destroy; | |
| fs_copy copy; | | fs_copy copy; | |
| fs_convert convert; | | fs_convert convert; | |
| } format_specific_data; | | } format_specific_data; | |
| | | | |
|
| | | typedef struct { | |
| | | int bbggrr; // 32 bit color: Blue/Green/Red. < 0 == unknown. | |
| | | unsigned char opacity; // 0 == transparent. 255 == opaque. | |
| | | } gb_color; | |
| | | | |
| format_specific_data *fs_chain_copy( format_specific_data *source ); | | format_specific_data *fs_chain_copy( format_specific_data *source ); | |
| void fs_chain_destroy( format_specific_data *chain ); | | void fs_chain_destroy( format_specific_data *chain ); | |
| format_specific_data *fs_chain_find( format_specific_data *chain, long type
); | | format_specific_data *fs_chain_find( format_specific_data *chain, long type
); | |
| void fs_chain_add( format_specific_data **chain, format_specific_data *data
); | | void fs_chain_add( format_specific_data **chain, format_specific_data *data
); | |
| | | | |
| typedef struct fs_xml { | | typedef struct fs_xml { | |
| format_specific_data fs; | | format_specific_data fs; | |
| xml_tag *tag; | | xml_tag *tag; | |
| } fs_xml; | | } fs_xml; | |
| | | | |
| | | | |
| skipping to change at line 337 | | skipping to change at line 351 | |
| /* "flagged fields" */ | | /* "flagged fields" */ | |
| unsigned int temperature:1; /* temperature field is set
*/ | | unsigned int temperature:1; /* temperature field is set
*/ | |
| unsigned int proximity:1; /* proximity field is set */ | | unsigned int proximity:1; /* proximity field is set */ | |
| unsigned int course:1; /* course field is set */ | | unsigned int course:1; /* course field is set */ | |
| unsigned int speed:1; /* speed field is set */ | | unsigned int speed:1; /* speed field is set */ | |
| unsigned int depth:1; /* depth field is set */ | | unsigned int depth:1; /* depth field is set */ | |
| /* !ToDo! | | /* !ToDo! | |
| unsigned int altitude:1; /+ altitude field is set +/ | | unsigned int altitude:1; /+ altitude field is set +/ | |
| ... and others | | ... and others | |
| */ | | */ | |
|
| | | unsigned int is_split:1; /* the waypoint represents a
split */ | |
| | | | |
| } wp_flags; | | } wp_flags; | |
| | | | |
| #define WAYPT_SET(wpt,member,val) { wpt->member = (val); wpt->wpt_flags.mem
ber = 1; } | | #define WAYPT_SET(wpt,member,val) { wpt->member = (val); wpt->wpt_flags.mem
ber = 1; } | |
| #define WAYPT_GET(wpt,member,def) ((wpt->wpt_flags.member) ? (wpt->member)
: (def)) | | #define WAYPT_GET(wpt,member,def) ((wpt->wpt_flags.member) ? (wpt->member)
: (def)) | |
| #define WAYPT_UNSET(wpt,member) wpt->wpt_flags.member = 0 | | #define WAYPT_UNSET(wpt,member) wpt->wpt_flags.member = 0 | |
| #define WAYPT_HAS(wpt,member) (wpt->wpt_flags.member) | | #define WAYPT_HAS(wpt,member) (wpt->wpt_flags.member) | |
| /* | | /* | |
| * This is a waypoint, as stored in the GPSR. It tries to not | | * This is a waypoint, as stored in the GPSR. It tries to not | |
| * cater to any specific model or protocol. Anything that needs to | | * cater to any specific model or protocol. Anything that needs to | |
| | | | |
| skipping to change at line 436 | | skipping to change at line 451 | |
| float vdop; | | float vdop; | |
| float pdop; | | float pdop; | |
| float course; /* Optional: degrees true */ | | float course; /* Optional: degrees true */ | |
| float speed; /* Optional: meters per second. */ | | float speed; /* Optional: meters per second. */ | |
| fix_type fix; /* Optional: 3d, 2d, etc. */ | | fix_type fix; /* Optional: 3d, 2d, etc. */ | |
| int sat; /* Optional: number of sats used for fix */ | | int sat; /* Optional: number of sats used for fix */ | |
| | | | |
| unsigned char heartrate; /* Beats/min. likely to get moved to fs. */ | | unsigned char heartrate; /* Beats/min. likely to get moved to fs. */ | |
| unsigned char cadence; /* revolutions per minute */ | | unsigned char cadence; /* revolutions per minute */ | |
| float temperature; /* Degrees celsius */ | | float temperature; /* Degrees celsius */ | |
|
| geocache_data gc_data; | | const geocache_data *gc_data; | |
| format_specific_data *fs; | | format_specific_data *fs; | |
|
| | | session_t *session; /* pointer to a session struct */ | |
| void *extra_data; /* Extra data added by, say, a filter. */ | | void *extra_data; /* Extra data added by, say, a filter. */ | |
| } waypoint; | | } waypoint; | |
| | | | |
| typedef struct { | | typedef struct { | |
| queue Q; /* Link onto parent list. */ | | queue Q; /* Link onto parent list. */ | |
| queue waypoint_list; /* List of child waypoints */ | | queue waypoint_list; /* List of child waypoints */ | |
| char *rte_name; | | char *rte_name; | |
| char *rte_desc; | | char *rte_desc; | |
| char *rte_url; | | char *rte_url; | |
| int rte_num; | | int rte_num; | |
| int rte_waypt_ct; /* # waypoints in waypoint list */ | | int rte_waypt_ct; /* # waypoints in waypoint list */ | |
| format_specific_data *fs; | | format_specific_data *fs; | |
| unsigned short cet_converted; /* strings are converted to UTF8; in
teresting only for input */ | | unsigned short cet_converted; /* strings are converted to UTF8; in
teresting only for input */ | |
|
| | | gb_color line_color; /* Optional line color for rendering * | |
| | | / | |
| | | int line_width; /* in pixels (sigh). < 0 is unknown. */ | |
| | | session_t *session; /* pointer to a session struct */ | |
| } route_head; | | } route_head; | |
| | | | |
| /* | | /* | |
| * Structure of recomputed track/roue data. | | * Structure of recomputed track/roue data. | |
| */ | | */ | |
| typedef struct { | | typedef struct { | |
| double distance_meters; | | double distance_meters; | |
| double max_alt; | | double max_alt; | |
| double min_alt; | | double min_alt; | |
| double max_spd; /* Meters/sec */ | | double max_spd; /* Meters/sec */ | |
| | | | |
| skipping to change at line 519 | | skipping to change at line 538 | |
| | | | |
| typedef void (*waypt_cb) (const waypoint *); | | typedef void (*waypt_cb) (const waypoint *); | |
| typedef void (*route_hdr)(const route_head *); | | typedef void (*route_hdr)(const route_head *); | |
| typedef void (*route_trl)(const route_head *); | | typedef void (*route_trl)(const route_head *); | |
| void waypt_add (waypoint *); | | void waypt_add (waypoint *); | |
| waypoint * waypt_dupe (const waypoint *); | | waypoint * waypt_dupe (const waypoint *); | |
| waypoint * waypt_new(void); | | waypoint * waypt_new(void); | |
| void waypt_del (waypoint *); | | void waypt_del (waypoint *); | |
| void waypt_free (waypoint *); | | void waypt_free (waypoint *); | |
| void waypt_disp_all(waypt_cb); | | void waypt_disp_all(waypt_cb); | |
|
| | | void waypt_disp_session(const session_t *se, waypt_cb cb); | |
| void waypt_init_bounds(bounds *bounds); | | void waypt_init_bounds(bounds *bounds); | |
| int waypt_bounds_valid(bounds *bounds); | | int waypt_bounds_valid(bounds *bounds); | |
| void waypt_add_to_bounds(bounds *bounds, const waypoint *waypointp); | | void waypt_add_to_bounds(bounds *bounds, const waypoint *waypointp); | |
| void waypt_compute_bounds(bounds *); | | void waypt_compute_bounds(bounds *); | |
| void waypt_flush(queue *); | | void waypt_flush(queue *); | |
| void waypt_flush_all(void); | | void waypt_flush_all(void); | |
| unsigned int waypt_count(void); | | unsigned int waypt_count(void); | |
| void set_waypt_count(unsigned int nc); | | void set_waypt_count(unsigned int nc); | |
| void waypt_add_url(waypoint *wpt, char *link, char *url_link_text); | | void waypt_add_url(waypoint *wpt, char *link, char *url_link_text); | |
| void free_gpx_extras (xml_tag * tag); | | void free_gpx_extras (xml_tag * tag); | |
| void xcsv_setup_internal_style(const char *style_buf); | | void xcsv_setup_internal_style(const char *style_buf); | |
| void xcsv_read_internal_style(const char *style_buf); | | void xcsv_read_internal_style(const char *style_buf); | |
| waypoint * find_waypt_by_name(const char *name); | | waypoint * find_waypt_by_name(const char *name); | |
| void waypt_backup(signed int *count, queue **head_bak); | | void waypt_backup(signed int *count, queue **head_bak); | |
| void waypt_restore(signed int count, queue *head_bak); | | void waypt_restore(signed int count, queue *head_bak); | |
| | | | |
|
| | | geocache_data *waypt_alloc_gc_data(waypoint *wpt); | |
| | | int waypt_empty_gc_data(const waypoint *wpt); | |
| | | geocache_type gs_mktype(const char *t); | |
| | | geocache_container gs_mkcont(const char *t); | |
| | | | |
| route_head *route_head_alloc(void); | | route_head *route_head_alloc(void); | |
| void route_add (waypoint *); | | void route_add (waypoint *); | |
| void route_add_wpt(route_head *rte, waypoint *wpt); | | void route_add_wpt(route_head *rte, waypoint *wpt); | |
| void route_del_wpt(route_head *rte, waypoint *wpt); | | void route_del_wpt(route_head *rte, waypoint *wpt); | |
| void track_add_wpt(route_head *rte, waypoint *wpt); | | void track_add_wpt(route_head *rte, waypoint *wpt); | |
| void track_del_wpt(route_head *rte, waypoint *wpt); | | void track_del_wpt(route_head *rte, waypoint *wpt); | |
| void route_add_head(route_head *rte); | | void route_add_head(route_head *rte); | |
| void route_del_head(route_head *rte); | | void route_del_head(route_head *rte); | |
| void route_reverse(const route_head *rte_hd); | | void route_reverse(const route_head *rte_hd); | |
| waypoint * route_find_waypt_by_name(route_head *rh, const char *name); | | waypoint * route_find_waypt_by_name(route_head *rh, const char *name); | |
| void track_add_head(route_head *rte); | | void track_add_head(route_head *rte); | |
| void track_del_head(route_head *rte); | | void track_del_head(route_head *rte); | |
| void route_disp(const route_head *rte, waypt_cb); | | void route_disp(const route_head *rte, waypt_cb); | |
| void route_disp_all(route_hdr, route_trl, waypt_cb); | | void route_disp_all(route_hdr, route_trl, waypt_cb); | |
| void track_disp_all(route_hdr, route_trl, waypt_cb); | | void track_disp_all(route_hdr, route_trl, waypt_cb); | |
|
| | | void route_disp_session(const session_t *se, route_hdr rh, route_trl rt, wa | |
| | | ypt_cb wc); | |
| | | void track_disp_session(const session_t *se, route_hdr rh, route_trl rt, wa | |
| | | ypt_cb wc); | |
| void route_flush( queue *); | | void route_flush( queue *); | |
| void route_flush_all(void); | | void route_flush_all(void); | |
| void route_flush_all_routes(void); | | void route_flush_all_routes(void); | |
| void route_flush_all_tracks(void); | | void route_flush_all_tracks(void); | |
| route_head * route_find_route_by_name(const char *name); | | route_head * route_find_route_by_name(const char *name); | |
| route_head * route_find_track_by_name(const char *name); | | route_head * route_find_track_by_name(const char *name); | |
| unsigned int route_waypt_count(void); | | unsigned int route_waypt_count(void); | |
| unsigned int route_count(void); | | unsigned int route_count(void); | |
| unsigned int track_waypt_count(void); | | unsigned int track_waypt_count(void); | |
| unsigned int track_count(void); | | unsigned int track_count(void); | |
| | | | |
| skipping to change at line 594 | | skipping to change at line 621 | |
| char *mkshort_from_wpt(short_handle h, const waypoint *wpt); | | char *mkshort_from_wpt(short_handle h, const waypoint *wpt); | |
| void mkshort_del_handle(short_handle *h); | | void mkshort_del_handle(short_handle *h); | |
| void setshort_length(short_handle, int n); | | void setshort_length(short_handle, int n); | |
| void setshort_badchars(short_handle, const char *); | | void setshort_badchars(short_handle, const char *); | |
| void setshort_goodchars(short_handle, const char *); | | void setshort_goodchars(short_handle, const char *); | |
| void setshort_mustupper(short_handle, int n); | | void setshort_mustupper(short_handle, int n); | |
| void setshort_mustuniq(short_handle, int n); | | void setshort_mustuniq(short_handle, int n); | |
| void setshort_whitespace_ok(short_handle, int n); | | void setshort_whitespace_ok(short_handle, int n); | |
| void setshort_repeating_whitespace_ok(short_handle, int n); | | void setshort_repeating_whitespace_ok(short_handle, int n); | |
| void setshort_defname(short_handle, const char *s); | | void setshort_defname(short_handle, const char *s); | |
|
| | | void setshort_is_utf8(short_handle h, const int is_utf8); | |
| | | | |
| /* | | /* | |
| * Vmem flags values. | | * Vmem flags values. | |
| */ | | */ | |
| #define VMFL_NOZERO (1 << 0) | | #define VMFL_NOZERO (1 << 0) | |
| typedef struct vmem { | | typedef struct vmem { | |
| void *mem; /* visible memory object */ | | void *mem; /* visible memory object */ | |
| size_t size; /* allocated size of object */ | | size_t size; /* allocated size of object */ | |
| } vmem_t; | | } vmem_t; | |
| vmem_t vmem_alloc(size_t, int flags); | | vmem_t vmem_alloc(size_t, int flags); | |
| | | | |
| skipping to change at line 645 | | skipping to change at line 673 | |
| #define ARGTYPE_BEGIN_REQ 0x04000000 | | #define ARGTYPE_BEGIN_REQ 0x04000000 | |
| #define ARGTYPE_END_REQ 0x02000000 | | #define ARGTYPE_END_REQ 0x02000000 | |
| | | | |
| #define ARGTYPE_TYPEMASK 0x00000fff | | #define ARGTYPE_TYPEMASK 0x00000fff | |
| #define ARGTYPE_FLAGMASK 0xfffff000 | | #define ARGTYPE_FLAGMASK 0xfffff000 | |
| | | | |
| #define ARG_NOMINMAX NULL, NULL | | #define ARG_NOMINMAX NULL, NULL | |
| #define ARG_TERMINATOR {0, 0, 0, 0, 0, ARG_NOMINMAX} | | #define ARG_TERMINATOR {0, 0, 0, 0, 0, ARG_NOMINMAX} | |
| | | | |
| typedef struct arglist { | | typedef struct arglist { | |
|
| char *argstring; | | const char *argstring; | |
| char **argval; | | char **argval; | |
|
| char *helpstring; | | const char *helpstring; | |
| char *defaultvalue; | | const char *defaultvalue; | |
| gbuint32 argtype; | | const gbuint32 argtype; | |
| char *minvalue; /* minimum value for numeric options */ | | const char *minvalue; /* minimum value for numeric options | |
| char *maxvalue; /* maximum value for numeric options */ | | */ | |
| | | const char *maxvalue; /* maximum value for numeric options | |
| | | */ | |
| | | char *argvalptr; /* !!! internal helper. Not used in definiti | |
| | | ons !!! */ | |
| } arglist_t; | | } arglist_t; | |
| | | | |
| typedef enum { | | typedef enum { | |
| ff_type_file = 1, /* normal format: useful to a GUI. */ | | ff_type_file = 1, /* normal format: useful to a GUI. */ | |
| ff_type_internal, /* fmt not useful with default options */ | | ff_type_internal, /* fmt not useful with default options */ | |
| ff_type_serial /* format describes a serial protocol (GUI c
an display port names) */ | | ff_type_serial /* format describes a serial protocol (GUI c
an display port names) */ | |
| } ff_type; | | } ff_type; | |
| | | | |
| typedef enum { | | typedef enum { | |
| ff_cap_rw_wpt, | | ff_cap_rw_wpt, | |
| | | | |
| skipping to change at line 705 | | skipping to change at line 734 | |
| ff_type type; | | ff_type type; | |
| ff_cap cap[3]; | | ff_cap cap[3]; | |
| ff_init rd_init; | | ff_init rd_init; | |
| ff_init wr_init; | | ff_init wr_init; | |
| ff_deinit rd_deinit; | | ff_deinit rd_deinit; | |
| ff_deinit wr_deinit; | | ff_deinit wr_deinit; | |
| ff_read read; | | ff_read read; | |
| ff_write write; | | ff_write write; | |
| ff_exit exit; | | ff_exit exit; | |
| arglist_t *args; | | arglist_t *args; | |
|
| char *encode; | | const char *encode; | |
| int fixed_encode; | | int fixed_encode; | |
| position_ops_t position_ops; | | position_ops_t position_ops; | |
|
| | | const char *name; /* dyn. initialized by find_vec */ | |
| } ff_vecs_t; | | } ff_vecs_t; | |
| | | | |
| typedef struct style_vecs { | | typedef struct style_vecs { | |
| const char *name; | | const char *name; | |
| const char *style_buf; | | const char *style_buf; | |
| } style_vecs_t; | | } style_vecs_t; | |
| extern style_vecs_t style_list[]; | | extern style_vecs_t style_list[]; | |
| | | | |
| void waypt_init(void); | | void waypt_init(void); | |
| void route_init(void); | | void route_init(void); | |
| | | | |
| skipping to change at line 736 | | skipping to change at line 766 | |
| | | | |
| NORETURN fatal(const char *, ...) PRINTFLIKE(1, 2); | | NORETURN fatal(const char *, ...) PRINTFLIKE(1, 2); | |
| void is_fatal(const int condition, const char *, ...) PRINTFLIKE(2, 3); | | void is_fatal(const int condition, const char *, ...) PRINTFLIKE(2, 3); | |
| void warning(const char *, ...) PRINTFLIKE(1, 2); | | void warning(const char *, ...) PRINTFLIKE(1, 2); | |
| | | | |
| ff_vecs_t *find_vec(char * const, char **); | | ff_vecs_t *find_vec(char * const, char **); | |
| void assign_option(const char *vecname, arglist_t *ap, const char *val); | | void assign_option(const char *vecname, arglist_t *ap, const char *val); | |
| void disp_vec_options(const char *vecname, arglist_t *ap); | | void disp_vec_options(const char *vecname, arglist_t *ap); | |
| void disp_vecs(void); | | void disp_vecs(void); | |
| void disp_vec( const char *vecname ); | | void disp_vec( const char *vecname ); | |
|
| | | void init_vecs(void); | |
| void exit_vecs(void); | | void exit_vecs(void); | |
| void disp_formats(int version); | | void disp_formats(int version); | |
| const char * name_option(long type); | | const char * name_option(long type); | |
| void printposn(const double c, int is_lat); | | void printposn(const double c, int is_lat); | |
| | | | |
| #ifndef DEBUG_MEM | | #ifndef DEBUG_MEM | |
| void *xcalloc(size_t nmemb, size_t size); | | void *xcalloc(size_t nmemb, size_t size); | |
| void *xmalloc(size_t size); | | void *xmalloc(size_t size); | |
| void *xrealloc(void *p, size_t s); | | void *xrealloc(void *p, size_t s); | |
| void xfree(void *mem); | | void xfree(void *mem); | |
| | | | |
| skipping to change at line 818 | | skipping to change at line 849 | |
| signed int month_lookup(const char *m); | | signed int month_lookup(const char *m); | |
| const char *get_cache_icon(const waypoint *waypointp); | | const char *get_cache_icon(const waypoint *waypointp); | |
| const char *gs_get_cachetype(geocache_type t); | | const char *gs_get_cachetype(geocache_type t); | |
| const char *gs_get_container(geocache_container t); | | const char *gs_get_container(geocache_container t); | |
| char * xml_entitize(const char * str); | | char * xml_entitize(const char * str); | |
| char * html_entitize(const char * str); | | char * html_entitize(const char * str); | |
| char * strip_html(const utf_string*); | | char * strip_html(const utf_string*); | |
| char * strip_nastyhtml(const char * in); | | char * strip_nastyhtml(const char * in); | |
| char * convert_human_date_format(const char *human_datef); /* "MM,YYYY,
DD" -> "%m,%Y,%d" */ | | char * convert_human_date_format(const char *human_datef); /* "MM,YYYY,
DD" -> "%m,%Y,%d" */ | |
| char * convert_human_time_format(const char *human_timef); /* "HH+mm+ss
" -> "%H+%M+%S" */ | | char * convert_human_time_format(const char *human_timef); /* "HH+mm+ss
" -> "%H+%M+%S" */ | |
|
| char * pretty_deg_format(double lat, double lon, char fmt, char *sep, int h
tml); /* decimal -> dd.dddd or dd mm.mmm or dd mm ss */ | | 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 */ | |
| | | | |
| char * get_filename(const char *fname); /* e
xtract the filename portion */ | | char * get_filename(const char *fname); /* e
xtract the filename portion */ | |
| | | | |
| /* | | /* | |
| * Character encoding transformations. | | * Character encoding transformations. | |
| */ | | */ | |
| | | | |
| #define CET_NOT_CONVERTABLE_DEFAULT '$' | | #define CET_NOT_CONVERTABLE_DEFAULT '$' | |
| #define CET_CHARSET_ASCII "US-ASCII" | | #define CET_CHARSET_ASCII "US-ASCII" | |
| #define CET_CHARSET_UTF8 "UTF-8" | | #define CET_CHARSET_UTF8 "UTF-8" | |
| | | | |
| skipping to change at line 841 | | skipping to change at line 872 | |
| | | | |
| #define str_utf8_to_cp1252(str) cet_str_utf8_to_cp1252((str)) | | #define str_utf8_to_cp1252(str) cet_str_utf8_to_cp1252((str)) | |
| #define str_cp1252_to_utf8(str) cet_str_cp1252_to_utf8((str)) | | #define str_cp1252_to_utf8(str) cet_str_cp1252_to_utf8((str)) | |
| | | | |
| #define str_utf8_to_iso8859_1(str) cet_str_utf8_to_iso8859_1((str)) | | #define str_utf8_to_iso8859_1(str) cet_str_utf8_to_iso8859_1((str)) | |
| #define str_iso8859_1_to_utf8(str) cet_str_iso8859_1_to_utf8((str)) | | #define str_iso8859_1_to_utf8(str) cet_str_iso8859_1_to_utf8((str)) | |
| | | | |
| /* this lives in gpx.c */ | | /* this lives in gpx.c */ | |
| time_t xml_parse_time( const char *cdatastr, int * microsecs ); | | time_t xml_parse_time( const char *cdatastr, int * microsecs ); | |
| | | | |
|
| xml_tag *xml_findfirst( xml_tag *root, char *tagname ); | | xml_tag *xml_findfirst( xml_tag *root, const char *tagname ); | |
| xml_tag *xml_findnext( xml_tag *root, xml_tag *cur, char *tagname ); | | xml_tag *xml_findnext( xml_tag *root, xml_tag *cur, const char *tagname ); | |
| char *xml_attribute( xml_tag *tag, char *attrname ); | | char *xml_attribute( xml_tag *tag, const char *attrname ); | |
| | | | |
| char * rot13( const char *str ); | | char * rot13( const char *str ); | |
| | | | |
| /* | | /* | |
| * PalmOS records like fixed-point numbers, which should be rounded | | * PalmOS records like fixed-point numbers, which should be rounded | |
| * to deal with possible floating-point representation errors. | | * to deal with possible floating-point representation errors. | |
| */ | | */ | |
| | | | |
| signed int si_round( double d ); | | signed int si_round( double d ); | |
| | | | |
| | | | |
| skipping to change at line 932 | | skipping to change at line 963 | |
| grid_utm = 4, | | grid_utm = 4, | |
| grid_swiss = 5 | | grid_swiss = 5 | |
| } grid_type; | | } grid_type; | |
| | | | |
| #define GRID_INDEX_MIN grid_lat_lon_ddd | | #define GRID_INDEX_MIN grid_lat_lon_ddd | |
| #define GRID_INDEX_MAX grid_swiss | | #define GRID_INDEX_MAX grid_swiss | |
| | | | |
| #define DATUM_OSGB36 86 | | #define DATUM_OSGB36 86 | |
| #define DATUM_WGS84 118 | | #define DATUM_WGS84 118 | |
| | | | |
|
| | | /* bit manipulation functions (util.c) */ | |
| | | | |
| | | char gb_getbit(const void *buf, const gbuint32 nr); | |
| | | void gb_setbit(void *buf, const gbuint32 nr); | |
| | | | |
| | | void *gb_int2ptr(const int i); | |
| | | int gb_ptr2int(const void *p); | |
| | | | |
| /* | | /* | |
| * From parse.c | | * From parse.c | |
| */ | | */ | |
| int parse_coordinates(const char *str, int datum, const grid_type grid, | | int parse_coordinates(const char *str, int datum, const grid_type grid, | |
| double *latitude, double *longitude, const char *module); | | double *latitude, double *longitude, const char *module); | |
| int parse_distance(const char *str, double *val, double scale, const char *
module); | | int parse_distance(const char *str, double *val, double scale, const char *
module); | |
| int parse_speed(const char *str, double *val, const double scale, const cha
r *module); | | int parse_speed(const char *str, double *val, const double scale, const cha
r *module); | |
|
| | | time_t parse_date(const char *str, const char *format, const char *module); | |
| | | | |
| /* | | /* | |
| * From util_crc.c | | * From util_crc.c | |
| */ | | */ | |
| unsigned long get_crc32(const void * data, int datalen); | | unsigned long get_crc32(const void * data, int datalen); | |
| unsigned long get_crc32_s(const void * data); | | unsigned long get_crc32_s(const void * data); | |
| | | | |
| /* | | /* | |
| * From units.c | | * From units.c | |
| */ | | */ | |
| | | | |
| skipping to change at line 979 | | skipping to change at line 1019 | |
| /* | | /* | |
| * Color helpers. | | * Color helpers. | |
| */ | | */ | |
| int color_to_bbggrr(char *cname); | | int color_to_bbggrr(char *cname); | |
| | | | |
| /* | | /* | |
| * A constant for unknown altitude. It's tempting to just use zero | | * A constant for unknown altitude. It's tempting to just use zero | |
| * but that's not very nice for the folks near sea level. | | * but that's not very nice for the folks near sea level. | |
| */ | | */ | |
| #define unknown_alt -99999999.0 | | #define unknown_alt -99999999.0 | |
|
| | | #define unknown_color -1 | |
| | | | |
| #endif /* gpsbabel_defs_h_included */ | | #endif /* gpsbabel_defs_h_included */ | |
| | | | |
End of changes. 21 change blocks. |
| 12 lines changed or deleted | | 59 lines changed or added | |
|
| gbfile.h | | gbfile.h | |
| /* | | /* | |
| | | | |
| Common GPSBabel file I/O API | | Common GPSBabel file I/O API | |
| | | | |
|
| Copyright (C) 2006 Olaf Klein | | Copyright (C) 2006,2007,2008 Olaf Klein, o.b.klein@gpsbabel.org | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | 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 | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| This program is distributed in the hope that it will be useful, | | This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | | GNU General Public License for more details. | |
| | | | |
| You should have received a copy of the GNU General Public License | | You should have received a copy of the GNU General Public License | |
| along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software | |
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA | | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA | |
| | | | |
| */ | | */ | |
| | | | |
| #ifndef GBFILE_H | | #ifndef GBFILE_H | |
| #define GBFILE_H | | #define GBFILE_H | |
| | | | |
|
| | | #include <ctype.h> | |
| | | #include <stdarg.h> | |
| | | #include <string.h> | |
| #include "config.h" | | #include "config.h" | |
| #include "defs.h" | | #include "defs.h" | |
|
| #include <stdarg.h> | | #include "cet.h" | |
| | | | |
| | | struct gbfile_s; | |
| | | typedef struct gbfile_s gbfile; | |
| | | | |
| | | typedef void (*gbfclearerr_cb) (gbfile *self); | |
| | | typedef int (*gbfclose_cb) (gbfile *self); | |
| | | typedef int (*gbfeof_cb) (gbfile *self); | |
| | | typedef int (*gbferror_cb) (gbfile *self); | |
| | | typedef int (*gbfflush_cb) (gbfile *self); | |
| | | typedef gbfile* (*gbfopen_cb) (gbfile *self, const char *mode); | |
| | | typedef gbsize_t (*gbfread_cb) (void *buf, const gbsize_t size, const gbsiz | |
| | | e_t members, gbfile *self); | |
| | | typedef int (*gbfseek_cb) (gbfile *self, gbint32 offset, int whence); | |
| | | typedef gbsize_t (*gbftell_cb) (gbfile *self); | |
| | | typedef gbsize_t (*gbfwrite_cb) (const void *buf, const gbsize_t size, cons | |
| | | t gbsize_t members, gbfile *self); | |
| | | typedef int (*gbfungetc_cb) (const int c, gbfile *self); | |
| | | | |
| typedef struct gbfile_s { | | typedef struct gbfile_s { | |
| #ifdef DEBUG_MEM | | #ifdef DEBUG_MEM | |
| void *dummy; /* ZERO pointer for stdio oop's */ | | void *dummy; /* ZERO pointer for stdio oop's */ | |
| #endif | | #endif | |
| union { | | union { | |
| FILE *std; | | FILE *std; | |
|
| | | unsigned char *mem; | |
| #if !ZLIB_INHIBITED | | #if !ZLIB_INHIBITED | |
| gzFile *gz; | | gzFile *gz; | |
| #endif | | #endif | |
| } handle; | | } handle; | |
| char *name; | | char *name; | |
| char *module; | | char *module; | |
|
| char *line; | | | |
| int linesz; | | | |
| char *buff; /* static growing buffer, primary used by gbprintf *
/ | | char *buff; /* static growing buffer, primary used by gbprintf *
/ | |
| int buffsz; | | int buffsz; | |
| char mode; | | char mode; | |
| int back; | | int back; | |
|
| | | gbsize_t mempos; /* curr. position in memory */ | |
| | | gbsize_t memlen; /* max. number of written bytes to memory */ | |
| | | gbsize_t memsz; /* curr. size of allocated memory */ | |
| unsigned char big_endian:1; | | unsigned char big_endian:1; | |
| unsigned char binary:1; | | unsigned char binary:1; | |
| unsigned char gzapi:1; | | unsigned char gzapi:1; | |
|
| } gbfile; | | unsigned char memapi:1; | |
| | | unsigned char unicode:1; | |
| | | unsigned char unicode_checked:1; | |
| | | unsigned char is_pipe:1; | |
| | | gbfclearerr_cb fileclearerr; | |
| | | gbfclose_cb fileclose; | |
| | | gbfeof_cb fileeof; | |
| | | gbferror_cb fileerror; | |
| | | gbfflush_cb fileflush; | |
| | | gbfopen_cb fileopen; | |
| | | gbfread_cb fileread; | |
| | | gbfseek_cb fileseek; | |
| | | gbftell_cb filetell; | |
| | | gbfungetc_cb fileungetc; | |
| | | gbfwrite_cb filewrite; | |
| | | } gbfile_t; | |
| | | | |
| gbfile *gbfopen(const char *filename, const char *mode, const char *module)
; | | gbfile *gbfopen(const char *filename, const char *mode, const char *module)
; | |
| gbfile *gbfopen_be(const char *filename, const char *mode, const char *modu
le); | | gbfile *gbfopen_be(const char *filename, const char *mode, const char *modu
le); | |
| #define gbfopen_le gbfopen | | #define gbfopen_le gbfopen | |
| void gbfclose(gbfile *file); | | void gbfclose(gbfile *file); | |
| | | | |
| gbsize_t gbfread(void *buf, const gbsize_t size, const gbsize_t members, gb
file *file); | | gbsize_t gbfread(void *buf, const gbsize_t size, const gbsize_t members, gb
file *file); | |
| int gbfgetc(gbfile *file); | | int gbfgetc(gbfile *file); | |
| char *gbfgets(char *buf, int len, gbfile *file); | | char *gbfgets(char *buf, int len, gbfile *file); | |
| | | | |
| | | | |
| skipping to change at line 97 | | skipping to change at line 132 | |
| int gbfputint16(const gbint16 i, gbfile *file); | | int gbfputint16(const gbint16 i, gbfile *file); | |
| #define gbfputuint16(a,b) gbfputint16((gbuint16)(a),(b)) | | #define gbfputuint16(a,b) gbfputint16((gbuint16)(a),(b)) | |
| int gbfputint32(const gbint32 i, gbfile *file); | | int gbfputint32(const gbint32 i, gbfile *file); | |
| #define gbfputuint32(a,b) gbfputint32((gbuint32)(a),(b)) | | #define gbfputuint32(a,b) gbfputint32((gbuint32)(a),(b)) | |
| | | | |
| int gbfputdbl(const double d, gbfile *file); // write a double value | | int gbfputdbl(const double d, gbfile *file); // write a double value | |
| int gbfputflt(const float f, gbfile *file); // write a float value | | int gbfputflt(const float f, gbfile *file); // write a float value | |
| int gbfputcstr(const char *s, gbfile *file); // write string including '\
0' | | int gbfputcstr(const char *s, gbfile *file); // write string including '\
0' | |
| int gbfputpstr(const char *s, gbfile *file); // write as pascal string | | int gbfputpstr(const char *s, gbfile *file); // write as pascal string | |
| | | | |
|
| | | gbsize_t gbfcopyfrom(gbfile *file, gbfile *src, gbsize_t count); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 8 change blocks. |
| 5 lines changed or deleted | | 44 lines changed or added | |
|