diff sidutil.h @ 313:b3d46806787d

Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 11 Jan 2020 18:30:10 +0200
parents
children b0c844b39516
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sidutil.h	Sat Jan 11 18:30:10 2020 +0200
@@ -0,0 +1,74 @@
+/*
+ * SIDLib common utility functions
+ * Programmed and designed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
+ * (C) Copyright 2014-2020 Tecnic Software productions (TNSP)
+ */
+#ifndef SIDUTIL_H
+#define SIDUTIL_H 1
+
+#include "th_util.h"
+#ifdef HAVE_ICONV
+#    include <iconv.h>
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//
+// Some constants
+//
+
+// HVSC documents directory
+#define SET_HVSC_DOCUMENTS   "DOCUMENTS"
+
+// Songlengths database filename prefix (.md5|.txt appended)
+#define SET_SLDB_FILEBASE    "Songlengths"
+
+// STIL database file
+#define SET_STILDB_FILENAME  "STIL.txt"
+
+
+enum
+{
+    TH_LANG_UTF8,
+    TH_LANG_ISO88591,
+    TH_LANG_CP850,
+    TH_LANG_CP437,
+};
+
+
+//
+// Typedefs
+//
+typedef struct
+{
+    BOOL enabled;
+    char *outLang;
+#ifdef HAVE_ICONV
+    iconv_t iconvCtx;
+#else
+    int outLangID;
+#endif
+} SIDUtilChConvCtx;
+
+
+//
+// Functions
+//
+void           sidutil_print_license(void);
+const char *   sidutil_strip_hvsc_path(const char *hvscPath, const char *filename);
+char *         sidutil_check_hvsc_file(const char *hvscPath, const char *filebase, const char *fext);
+
+char *         sidutil_chconv_convert(SIDUtilChConvCtx *ctx, const char *src);
+
+int            sidutil_chconv_init(SIDUtilChConvCtx *ctx, const char *outLang);
+void           sidutil_chconv_close(SIDUtilChConvCtx *ctx);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif // SIDUTIL_H