From f3e1187e65df8e3fdd989cbee19ee2b9472c6735 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 3 Mar 2019 22:29:40 +0100 Subject: Cleanup: move parse-function declarations out of "dive.h" Move the declaration of these functions to "file.h" and "parse.h" according to the translation unit they are defined in. Thus, not all users of "dive.h" have to suck in "sqlite3.h". Signed-off-by: Berthold Stoeger --- core/dive.h | 10 ---------- core/file.c | 1 + core/file.h | 1 + core/parse.h | 16 ++++++++++++++++ 4 files changed, 18 insertions(+), 10 deletions(-) (limited to 'core') diff --git a/core/dive.h b/core/dive.h index 4760305ed..0e93b9671 100644 --- a/core/dive.h +++ b/core/dive.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include "divesite.h" @@ -478,15 +477,6 @@ extern int parse_xml_buffer(const char *url, const char *buf, int size, struct d extern void parse_xml_exit(void); extern void set_filename(const char *filename); -extern int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); -extern int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); -extern int parse_shearwater_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); -extern int parse_shearwater_cloud_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); -extern int parse_cobalt_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); -extern int parse_divinglog_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); -extern int parse_dlf_buffer(unsigned char *buffer, size_t size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); - -extern int parse_file(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); extern int save_dives(const char *filename); extern int save_dives_logic(const char *filename, bool select_only, bool anonymize); extern int save_dive(FILE *f, struct dive *dive, bool anonymize); diff --git a/core/file.c b/core/file.c index 8a1a1ec1e..2683b1dd6 100644 --- a/core/file.c +++ b/core/file.c @@ -17,6 +17,7 @@ #include "git-access.h" #include "qthelper.h" #include "import-csv.h" +#include "parse.h" /* For SAMPLE_* */ #include diff --git a/core/file.h b/core/file.h index a570e1330..24c9d47c6 100644 --- a/core/file.h +++ b/core/file.h @@ -16,6 +16,7 @@ extern int datatrak_import(struct memblock *mem, struct dive_table *table, struc extern void ostctools_import(const char *file, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); extern int readfile(const char *filename, struct memblock *mem); +extern int parse_file(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); extern int try_to_open_zip(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); #ifdef __cplusplus } diff --git a/core/parse.h b/core/parse.h index eb07d9404..8aaef399e 100644 --- a/core/parse.h +++ b/core/parse.h @@ -4,6 +4,8 @@ #define MAX_EVENT_NAME 128 +#include + typedef union { struct event event; char allocation[sizeof(struct event) + MAX_EVENT_NAME]; @@ -68,6 +70,9 @@ struct parser_state { #define cur_event event_allocation.event +#ifdef __cplusplus +extern "C" { +#endif void init_parser_state(struct parser_state *state); void free_parser_state(struct parser_state *state); @@ -113,4 +118,15 @@ void utf8_string(char *buffer, void *_res); void add_dive_site(char *ds_name, struct dive *dive, struct parser_state *state); int atoi_n(char *ptr, unsigned int len); +int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); +int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); +int parse_shearwater_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); +int parse_shearwater_cloud_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); +int parse_cobalt_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); +int parse_divinglog_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); +int parse_dlf_buffer(unsigned char *buffer, size_t size, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites); +#ifdef __cplusplus +} +#endif + #endif -- cgit v1.2.3-70-g09d2