aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/checkcloudconnection.cpp3
-rw-r--r--core/cloudstorage.cpp2
-rw-r--r--core/configuredivecomputer.cpp2
-rw-r--r--core/configuredivecomputerthreads.cpp2
-rw-r--r--core/datatrak.c1
-rw-r--r--core/deco.c3
-rw-r--r--core/device.h3
-rw-r--r--core/dive.h5
-rw-r--r--core/divecomputer.cpp1
-rw-r--r--core/divelogexportlogic.cpp1
-rw-r--r--core/divesitehelpers.cpp1
-rw-r--r--core/errorhelper.c4
-rw-r--r--core/errorhelper.h19
-rw-r--r--core/file.c1
-rw-r--r--core/file.h2
-rw-r--r--core/git-access.c3
-rw-r--r--core/gpslocation.cpp1
-rw-r--r--core/import-csv.c2
-rw-r--r--core/libdivecomputer.c1
-rw-r--r--core/libdivecomputer.h8
-rw-r--r--core/load-git.c1
-rw-r--r--core/ostctools.c2
-rw-r--r--core/parse-xml.c3
-rw-r--r--core/parse.c1
-rw-r--r--core/planner.c3
-rw-r--r--core/qt-ble.cpp1
-rw-r--r--core/qt-init.cpp2
-rw-r--r--core/qthelper.cpp1
-rw-r--r--core/save-git.c1
-rw-r--r--core/save-html.c1
-rw-r--r--core/save-html.h3
-rw-r--r--core/save-profiledata.c3
-rw-r--r--core/save-xml.c1
-rw-r--r--core/subsurfacestartup.c2
-rw-r--r--core/subsurfacestartup.h4
-rw-r--r--core/uemis-downloader.c1
-rw-r--r--core/videoframeextractor.cpp2
-rw-r--r--core/worldmap-save.c1
-rw-r--r--core/worldmap-save.h1
39 files changed, 73 insertions, 26 deletions
diff --git a/core/checkcloudconnection.cpp b/core/checkcloudconnection.cpp
index 1d8870742..e8e48d8f6 100644
--- a/core/checkcloudconnection.cpp
+++ b/core/checkcloudconnection.cpp
@@ -8,11 +8,10 @@
#include "pref.h"
#include "qthelper.h"
#include "git-access.h"
-#include "dive.h" // for "verbose"
+#include "errorhelper.h"
#include "checkcloudconnection.h"
-
CheckCloudConnection::CheckCloudConnection(QObject *parent) :
QObject(parent),
reply(0)
diff --git a/core/cloudstorage.cpp b/core/cloudstorage.cpp
index 4e7ff10f0..c3108bc2b 100644
--- a/core/cloudstorage.cpp
+++ b/core/cloudstorage.cpp
@@ -2,7 +2,7 @@
#include "cloudstorage.h"
#include "pref.h"
#include "qthelper.h"
-#include "dive.h"
+#include "errorhelper.h"
#include "settings/qPrefCloudStorage.h"
#include <QApplication>
diff --git a/core/configuredivecomputer.cpp b/core/configuredivecomputer.cpp
index e09875dc2..31811c91b 100644
--- a/core/configuredivecomputer.cpp
+++ b/core/configuredivecomputer.cpp
@@ -8,6 +8,8 @@
#include <libxslt/transform.h>
#include <QStringList>
#include <QXmlStreamWriter>
+#include "core/dive.h" // for subsurface_fopen()
+#include "core/errorhelper.h"
#include "core/version.h"
ConfigureDiveComputer::ConfigureDiveComputer() : readThread(0),
diff --git a/core/configuredivecomputerthreads.cpp b/core/configuredivecomputerthreads.cpp
index 9b9374c58..601c55910 100644
--- a/core/configuredivecomputerthreads.cpp
+++ b/core/configuredivecomputerthreads.cpp
@@ -3,6 +3,8 @@
#include "libdivecomputer/hw_ostc.h"
#include "libdivecomputer/hw_ostc3.h"
#include "libdivecomputer.h"
+#include "units.h"
+#include "errorhelper.h"
#define OSTC3_GAS1 0x10
#define OSTC3_GAS2 0x11
diff --git a/core/datatrak.c b/core/datatrak.c
index 43c7346cd..27e1ec4bb 100644
--- a/core/datatrak.c
+++ b/core/datatrak.c
@@ -16,6 +16,7 @@
#include "device.h"
#include "file.h"
#include "divesite.h"
+#include "errorhelper.h"
#include "ssrf.h"
#include "tag.h"
diff --git a/core/deco.c b/core/deco.c
index 96cb0411c..e0b112150 100644
--- a/core/deco.c
+++ b/core/deco.c
@@ -23,7 +23,8 @@
#include "dive.h"
#include "subsurface-string.h"
#include <assert.h>
-#include "core/planner.h"
+#include "errorhelper.h"
+#include "planner.h"
#include "qthelper.h"
#define cube(x) (x * x * x)
diff --git a/core/device.h b/core/device.h
index 262829987..c1e767bee 100644
--- a/core/device.h
+++ b/core/device.h
@@ -2,10 +2,13 @@
#ifndef DEVICE_H
#define DEVICE_H
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
+struct divecomputer;
extern void fake_dc(struct divecomputer *dc);
extern void set_dc_deviceid(struct divecomputer *dc, unsigned int deviceid);
extern void create_device_node(const char *model, uint32_t deviceid, const char *serial, const char *firmware, const char *nickname);
diff --git a/core/dive.h b/core/dive.h
index 95275aa12..fcd9483f7 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -247,7 +247,7 @@ extern bool autogroup;
struct dive *unregister_dive(int idx);
extern void delete_single_dive(int idx);
-extern int run_survey, verbose, quit, force_root;
+extern int run_survey, quit, force_root;
extern struct dive_table dive_table;
extern struct dive displayed_dive;
@@ -289,9 +289,6 @@ extern bool dive_site_has_gps_location(const struct dive_site *ds);
extern int dive_has_gps_location(const struct dive *dive);
extern location_t dive_get_gps_location(const struct dive *d);
-extern int report_error(const char *fmt, ...);
-extern void set_error_cb(void(*cb)(char *)); // Callback takes ownership of passed string
-
extern bool dive_within_time_range(struct dive *dive, timestamp_t when, timestamp_t offset);
extern bool time_during_dive_with_offset(struct dive *dive, timestamp_t when, timestamp_t offset);
struct dive *find_dive_n_near(timestamp_t when, int n, timestamp_t offset);
diff --git a/core/divecomputer.cpp b/core/divecomputer.cpp
index 5e177e541..daa4eafbf 100644
--- a/core/divecomputer.cpp
+++ b/core/divecomputer.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "divecomputer.h"
#include "dive.h"
+#include "errorhelper.h"
#include "core/settings/qPrefDiveComputer.h"
#include "subsurface-string.h"
diff --git a/core/divelogexportlogic.cpp b/core/divelogexportlogic.cpp
index dff7eefc9..7323eefbb 100644
--- a/core/divelogexportlogic.cpp
+++ b/core/divelogexportlogic.cpp
@@ -5,6 +5,7 @@
#include <QDir>
#include <QTextStream>
#include "divelogexportlogic.h"
+#include "errorhelper.h"
#include "qthelper.h"
#include "units.h"
#include "statistics.h"
diff --git a/core/divesitehelpers.cpp b/core/divesitehelpers.cpp
index 6093c890c..6dc6b012a 100644
--- a/core/divesitehelpers.cpp
+++ b/core/divesitehelpers.cpp
@@ -6,6 +6,7 @@
#include "divesitehelpers.h"
#include "divesite.h"
+#include "errorhelper.h"
#include "subsurface-string.h"
#include "qthelper.h"
#include "membuffer.h"
diff --git a/core/errorhelper.c b/core/errorhelper.c
index b77f70186..7c30867a7 100644
--- a/core/errorhelper.c
+++ b/core/errorhelper.c
@@ -4,11 +4,13 @@
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif
#include <stdarg.h>
-#include "dive.h"
+#include "errorhelper.h"
#include "membuffer.h"
#define VA_BUF(b, fmt) do { va_list args; va_start(args, fmt); put_vformat(b, fmt, args); va_end(args); } while (0)
+int verbose;
+
static void (*error_cb)(char *) = NULL;
int report_error(const char *fmt, ...)
diff --git a/core/errorhelper.h b/core/errorhelper.h
new file mode 100644
index 000000000..4a32754ee
--- /dev/null
+++ b/core/errorhelper.h
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+#ifndef ERROR_HELPER_H
+#define ERROR_HELPER_H
+
+// error reporting functions
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int verbose;
+extern int report_error(const char *fmt, ...);
+extern void set_error_cb(void(*cb)(char *)); // Callback takes ownership of passed string
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/core/file.c b/core/file.c
index 2683b1dd6..301a16e0b 100644
--- a/core/file.c
+++ b/core/file.c
@@ -13,6 +13,7 @@
#include "dive.h"
#include "subsurface-string.h"
#include "divelist.h"
+#include "errorhelper.h"
#include "file.h"
#include "git-access.h"
#include "qthelper.h"
diff --git a/core/file.h b/core/file.h
index 24c9d47c6..f8f59ead2 100644
--- a/core/file.h
+++ b/core/file.h
@@ -7,6 +7,8 @@ struct memblock {
size_t size;
};
+struct trip_table;
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/core/git-access.c b/core/git-access.c
index ff27ebcf7..a142dd8f0 100644
--- a/core/git-access.c
+++ b/core/git-access.c
@@ -22,7 +22,8 @@
#include "membuffer.h"
#include "strndup.h"
#include "qthelper.h"
-#include "dive.h"
+#include "dive.h" // for subsurface_stat()
+#include "errorhelper.h"
#include "git-access.h"
#include "gettext.h"
#include "sha1.h"
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp
index acc5b1da5..c5b81e024 100644
--- a/core/gpslocation.cpp
+++ b/core/gpslocation.cpp
@@ -5,6 +5,7 @@
#include "core/pref.h"
#include "core/qthelper.h"
#include "core/divelist.h" // for mark_divelist_changed()
+#include "core/errorhelper.h"
#include "core/settings/qPrefLocationService.h"
#include <time.h>
#include <unistd.h>
diff --git a/core/import-csv.c b/core/import-csv.c
index 998d0d2e6..9c391025e 100644
--- a/core/import-csv.c
+++ b/core/import-csv.c
@@ -2,7 +2,7 @@
#include <errno.h>
#include <libdivecomputer/parser.h>
-#include "dive.h"
+#include "errorhelper.h"
#include "ssrf.h"
#include "subsurface-string.h"
#include "divelist.h"
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 7c3356f6f..63567ba56 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -19,6 +19,7 @@
#include "device.h"
#include "divelist.h"
#include "display.h"
+#include "errorhelper.h"
#include "sha1.h"
#include <libdivecomputer/version.h>
diff --git a/core/libdivecomputer.h b/core/libdivecomputer.h
index d3aafc87b..aba02a226 100644
--- a/core/libdivecomputer.h
+++ b/core/libdivecomputer.h
@@ -2,6 +2,7 @@
#ifndef LIBDIVECOMPUTER_H
#define LIBDIVECOMPUTER_H
+#include <stdint.h>
/* libdivecomputer */
@@ -18,12 +19,15 @@
#define dc_usb_storage_open(stream, context, devname) (DC_STATUS_UNSUPPORTED)
#endif
-#include "dive.h"
-
#ifdef __cplusplus
extern "C" {
+#else
+#include <stdbool.h>
#endif
+struct dive;
+struct dive_computer;
+
typedef struct dc_user_device_t
{
dc_descriptor_t *descriptor;
diff --git a/core/load-git.c b/core/load-git.c
index 2ff96ef0b..2fdb6197b 100644
--- a/core/load-git.c
+++ b/core/load-git.c
@@ -16,6 +16,7 @@
#include "gettext.h"
#include "divesite.h"
+#include "errorhelper.h"
#include "trip.h"
#include "subsurface-string.h"
#include "device.h"
diff --git a/core/ostctools.c b/core/ostctools.c
index 4ebb85015..e80df794e 100644
--- a/core/ostctools.c
+++ b/core/ostctools.c
@@ -3,7 +3,7 @@
#include <stdio.h>
#include <string.h>
-#include "dive.h"
+#include "errorhelper.h"
#include "ssrf.h"
#include "subsurface-string.h"
#include "gettext.h"
diff --git a/core/parse-xml.c b/core/parse-xml.c
index 6f1c272d3..d4b8d72a7 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -23,6 +23,7 @@
#include "gettext.h"
#include "divesite.h"
+#include "errorhelper.h"
#include "subsurface-string.h"
#include "parse.h"
#include "trip.h"
@@ -31,7 +32,7 @@
#include "qthelper.h"
#include "tag.h"
-int verbose, quit, force_root;
+int quit, force_root;
int last_xml_version = -1;
static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params);
diff --git a/core/parse.c b/core/parse.c
index e33ced85b..30efcc13c 100644
--- a/core/parse.c
+++ b/core/parse.c
@@ -8,6 +8,7 @@
#include <libdivecomputer/parser.h>
#include "divesite.h"
+#include "errorhelper.h"
#include "subsurface-string.h"
#include "parse.h"
#include "trip.h"
diff --git a/core/planner.c b/core/planner.c
index 36ae92c60..fb53fb59d 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -11,9 +11,10 @@
#include <ctype.h>
#include <string.h>
#include "dive.h"
+#include "divelist.h"
#include "subsurface-string.h"
#include "deco.h"
-#include "divelist.h"
+#include "errorhelper.h"
#include "planner.h"
#include "gettext.h"
#include "libdivecomputer/parser.h"
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp
index 863b1804c..88d7c8a4a 100644
--- a/core/qt-ble.cpp
+++ b/core/qt-ble.cpp
@@ -18,6 +18,7 @@
#include "libdivecomputer.h"
#include "core/qt-ble.h"
#include "core/btdiscovery.h"
+#include "core/errorhelper.h"
#include "core/subsurface-string.h"
#define BLE_TIMEOUT 12000 // 12 seconds seems like a very long time to wait
diff --git a/core/qt-init.cpp b/core/qt-init.cpp
index c06aeae00..b07c905c3 100644
--- a/core/qt-init.cpp
+++ b/core/qt-init.cpp
@@ -5,7 +5,7 @@
#include <QLibraryInfo>
#include <QTextCodec>
#include "qthelper.h"
-#include "dive.h" // for "verbose"
+#include "errorhelper.h"
#include "core/settings/qPref.h"
char *settings_suffix = NULL;
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 9af958347..bc4c7fb74 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -10,6 +10,7 @@
#include "subsurfacesysinfo.h"
#include "version.h"
#include "divecomputer.h"
+#include "errorhelper.h"
#include "time.h"
#include "gettextfromc.h"
#include "applicationstate.h"
diff --git a/core/save-git.c b/core/save-git.c
index 4c57a5350..ae299af24 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -21,6 +21,7 @@
#include "subsurface-string.h"
#include "trip.h"
#include "device.h"
+#include "errorhelper.h"
#include "membuffer.h"
#include "git-access.h"
#include "version.h"
diff --git a/core/save-html.c b/core/save-html.c
index ecea33458..cd82d1d44 100644
--- a/core/save-html.c
+++ b/core/save-html.c
@@ -8,6 +8,7 @@
#include "qthelper.h"
#include "gettext.h"
#include "divesite.h"
+#include "errorhelper.h"
#include "tag.h"
#include "trip.h"
#include <stdio.h>
diff --git a/core/save-html.h b/core/save-html.h
index 0868213e1..df3bb97af 100644
--- a/core/save-html.h
+++ b/core/save-html.h
@@ -2,13 +2,14 @@
#ifndef HTML_SAVE_H
#define HTML_SAVE_H
-#include "dive.h"
#include "membuffer.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct dive;
+
void put_HTML_date(struct membuffer *b, struct dive *dive, const char *pre, const char *post);
void put_HTML_depth(struct membuffer *b, struct dive *dive, const char *pre, const char *post);
void put_HTML_airtemp(struct membuffer *b, struct dive *dive, const char *pre, const char *post);
diff --git a/core/save-profiledata.c b/core/save-profiledata.c
index a88ce8ae1..347d5249f 100644
--- a/core/save-profiledata.c
+++ b/core/save-profiledata.c
@@ -1,7 +1,6 @@
#include "core/profile.h"
-#include "core/profile.h"
-#include "core/dive.h"
#include "core/display.h"
+#include "core/errorhelper.h"
#include "core/membuffer.h"
#include "core/subsurface-string.h"
#include "core/save-profiledata.h"
diff --git a/core/save-xml.c b/core/save-xml.c
index d50404059..c9e997f01 100644
--- a/core/save-xml.c
+++ b/core/save-xml.c
@@ -14,6 +14,7 @@
#include <fcntl.h>
#include "divesite.h"
+#include "errorhelper.h"
#include "subsurface-string.h"
#include "trip.h"
#include "device.h"
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c
index 2ac900c36..8b7c14179 100644
--- a/core/subsurfacestartup.c
+++ b/core/subsurfacestartup.c
@@ -4,6 +4,8 @@
#include "version.h"
#include <stdbool.h>
#include <string.h>
+#include "errorhelper.h"
+#include "dive.h" // for quit and force_root
#include "gettext.h"
#include "qthelper.h"
#include "git-access.h"
diff --git a/core/subsurfacestartup.h b/core/subsurfacestartup.h
index 40de09723..5784178a7 100644
--- a/core/subsurfacestartup.h
+++ b/core/subsurfacestartup.h
@@ -2,10 +2,6 @@
#ifndef SUBSURFACESTARTUP_H
#define SUBSURFACESTARTUP_H
-#include "dive.h"
-#include "divelist.h"
-#include "libdivecomputer.h"
-
#ifdef __cplusplus
extern "C" {
#else
diff --git a/core/uemis-downloader.c b/core/uemis-downloader.c
index 08fa44542..78ae9b7d6 100644
--- a/core/uemis-downloader.c
+++ b/core/uemis-downloader.c
@@ -26,6 +26,7 @@
#include "uemis.h"
#include "divelist.h"
#include "divesite.h"
+#include "errorhelper.h"
#include "tag.h"
#include "core/subsurface-string.h"
diff --git a/core/videoframeextractor.cpp b/core/videoframeextractor.cpp
index daed29dc3..3f695a68c 100644
--- a/core/videoframeextractor.cpp
+++ b/core/videoframeextractor.cpp
@@ -2,7 +2,7 @@
#include "videoframeextractor.h"
#include "imagedownloader.h"
#include "core/pref.h"
-#include "core/dive.h" // for report_error()!
+#include "core/errorhelper.h"
#include <QtConcurrent>
#include <QProcess>
diff --git a/core/worldmap-save.c b/core/worldmap-save.c
index a2454ce2b..3aa91e929 100644
--- a/core/worldmap-save.c
+++ b/core/worldmap-save.c
@@ -11,6 +11,7 @@
#include "membuffer.h"
#include "divesite.h"
+#include "errorhelper.h"
#include "save-html.h"
#include "worldmap-save.h"
#include "worldmap-options.h"
diff --git a/core/worldmap-save.h b/core/worldmap-save.h
index d20b6684b..9d74e123a 100644
--- a/core/worldmap-save.h
+++ b/core/worldmap-save.h
@@ -8,7 +8,6 @@ extern "C" {
extern void export_worldmap_HTML(const char *file_name, const bool selected_only);
-
#ifdef __cplusplus
}
#endif