comparison 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
comparison
equal deleted inserted replaced
312:1950bb04a69b 313:b3d46806787d
1 /*
2 * SIDLib common utility functions
3 * Programmed and designed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
4 * (C) Copyright 2014-2020 Tecnic Software productions (TNSP)
5 */
6 #ifndef SIDUTIL_H
7 #define SIDUTIL_H 1
8
9 #include "th_util.h"
10 #ifdef HAVE_ICONV
11 # include <iconv.h>
12 #endif
13
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19
20 //
21 // Some constants
22 //
23
24 // HVSC documents directory
25 #define SET_HVSC_DOCUMENTS "DOCUMENTS"
26
27 // Songlengths database filename prefix (.md5|.txt appended)
28 #define SET_SLDB_FILEBASE "Songlengths"
29
30 // STIL database file
31 #define SET_STILDB_FILENAME "STIL.txt"
32
33
34 enum
35 {
36 TH_LANG_UTF8,
37 TH_LANG_ISO88591,
38 TH_LANG_CP850,
39 TH_LANG_CP437,
40 };
41
42
43 //
44 // Typedefs
45 //
46 typedef struct
47 {
48 BOOL enabled;
49 char *outLang;
50 #ifdef HAVE_ICONV
51 iconv_t iconvCtx;
52 #else
53 int outLangID;
54 #endif
55 } SIDUtilChConvCtx;
56
57
58 //
59 // Functions
60 //
61 void sidutil_print_license(void);
62 const char * sidutil_strip_hvsc_path(const char *hvscPath, const char *filename);
63 char * sidutil_check_hvsc_file(const char *hvscPath, const char *filebase, const char *fext);
64
65 char * sidutil_chconv_convert(SIDUtilChConvCtx *ctx, const char *src);
66
67 int sidutil_chconv_init(SIDUtilChConvCtx *ctx, const char *outLang);
68 void sidutil_chconv_close(SIDUtilChConvCtx *ctx);
69
70
71 #ifdef __cplusplus
72 }
73 #endif
74 #endif // SIDUTIL_H