commit 682f6666f149870494bb17ff008624e307ebb6c1
parent 1c1748db729acadbf0ffea998bf02b9799683e05
Author: Eduardo Fontana Lazzari <edufonlaz@gmail.com>
Date: Tue, 3 Dec 2024 13:41:46 +0100
Declaration of lib API functions & helper macros
Diffstat:
| A | src/sphin.h | | | 88 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 88 insertions(+), 0 deletions(-)
diff --git a/src/sphin.h b/src/sphin.h
@@ -0,0 +1,88 @@
+/* Copyright (C) 2024 Centre National de la Recherche Scientifique
+ * Copyright (C) 2024 Clermont Auvergne INP
+ * Copyright (C) 2024 INSA Lyon
+ * Copyright (C) 2024 Institut Mines Télécom Albi-Carmaux
+ * Copyright (C) 2024 Institut National Polytechnique de Toulouse
+ * Copyright (C) 2024 |Méso|Star> (contact@meso-star.com)
+ * Copyright (C) 2024 PhotonLyX (info@photonlyx.com)
+ * Copyright (C) 2024 Université de Lorraine
+ * Copyright (C) 2024 Université Paul Sabatier
+ * Copyright (C) 2024 Université Toulouse - Jean Jaurès
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef SPHIN_H
+#define SPHIN_H
+
+#include <rsys/rsys.h>
+
+/* Library symbol management */
+#if defined(SPHIN_SHARED_BUILD)
+ #define SPHIN_API extern EXPORT_SYM
+#else
+ #define SPHIN_API extern IMPORT_SYM
+#endif
+
+/* Helper macro that asserts if the invocation of the sphin function `Func'
+ * returns an error. One should use this macro on sphin function calls for which
+ * no explicit error checking is performed */
+#ifndef NDEBUG
+ #define SPHIN(Func) ASSERT(sphin_ ## Func == RES_OK)
+#else
+ #define SPHIN(Func) sphin_ ## Func
+#endif
+
+struct sphin_create_args {
+ struct logger* logger; /* May be NULL <=> default logger */
+ struct mem_allocator* allocator; /* NULL <=> use default allocator */
+ int verbose; /* Verbosity level */
+};
+static const struct sphin_create_args SPHIN_CREATE_ARGS_DEFAULT = {
+ NULL, NULL, 0
+};
+
+struct sphin;
+
+BEGIN_DECLS
+
+/*******************************************************************************
+ * API of the library loading sphin fileformat
+ ******************************************************************************/
+SPHIN_API res_T
+sphin_create
+ (struct sphin_create_args* args,
+ struct sphin** sphin);
+
+SPHIN_API res_T
+sphin_ref_get
+ (struct sphin* sphin);
+
+SPHIN_API res_T
+sphin_ref_put
+ (struct sphin* sphin);
+
+SPHIN_API res_T
+sphin_load
+ (struct sphin* sphin,
+ const char* filename);
+
+SPHIN_API res_T
+sphin_load_stream
+ (struct sphin* sphin,
+ FILE* stream,
+ const char* stream_name);
+
+END_DECLS
+
+#endif /* SPHIN_H */