commit 71407bba8abaaeb33f4e30061b6aeb73c9718eca
Author: gearsix <gearsix@tuta.io>
Date: Fri, 7 Oct 2022 15:03:14 +0100
git init; added: idx.h, idx_t.h.
Added idx_t, a typedef for a systems 64-bit data type that gets used
for that systems 64-bit fseek and ftell calls. Prototypes for idxtell
and idxseek have also been added, these will make said system calls.
Diffstat:
A | idx.h | | | 18 | ++++++++++++++++++ |
A | idx_t.h | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/idx.h b/idx.h
@@ -0,0 +1,17 @@
+#ifndef IDX
+#define IDX
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "idx_t.h" /* idx_t typedef */
+
+int idxseek(FILE *stream, idx_t offset, int origin);
+
+idx_t idxtell(FILE *stream);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IDX */
+\ No newline at end of file
diff --git a/idx_t.h b/idx_t.h
@@ -0,0 +1,42 @@
+#ifndef IDX_T
+#define IDX_T
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Systems with POSIX support */
+#ifdef __unix__ || (__APPLE__ && __MACH__)
+ #include <unistd.h>
+ #define IDX_POSIX
+ typedef off_t idx_t
+
+/* Windows... */
+#elif defined(_WIN32)
+ #define IDX_WIN
+ typedef __int64 idx_t;
+
+/* Unknown system!
+ This limits the `idx.h` to using the standard
+ library, rendering it fairly pointless since
+ `fseek` and `ftell` are limited to `long int`.
+
+ If you would like to use `idx.h` anyway, just
+ remove or comment out the `#error` below.
+
+ That said, if you're on a system with 64-bit
+ support that idx.h doesn't know about, please
+ drop an email or submit a patch. */
+#else
+ #error "System not supported. See idx_t.h for details."
+ #define IDX_UNKW
+ typedef unsigned long idx_t;
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IDX_T */
+