Mercurial > hg > sidinfo
annotate sidutil.h @ 344:dc197e16db86
Added signature for changeset a7ad3b640ed0
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 13 Jan 2020 17:39:02 +0200 |
parents | f3ba2ba894b1 |
children | a6153837c138 |
rev | line source |
---|---|
313
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 /* |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 * SIDLib common utility functions |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 * Programmed and designed by Matti 'ccr' Hämäläinen <ccr@tnsp.org> |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 * (C) Copyright 2014-2020 Tecnic Software productions (TNSP) |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 */ |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 #ifndef SIDUTIL_H |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 #define SIDUTIL_H 1 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 #include "th_util.h" |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 #ifdef HAVE_ICONV |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 # include <iconv.h> |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 #endif |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
15 #ifdef __cplusplus |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
16 extern "C" { |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 #endif |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
19 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 // |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
21 // Some constants |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
22 // |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
24 // HVSC documents directory |
318
f3ba2ba894b1
Rename few HVSC related #defines to have SIDUTIL_ prefix.
Matti Hamalainen <ccr@tnsp.org>
parents:
316
diff
changeset
|
25 #define SIDUTIL_HVSC_DOCUMENTS "DOCUMENTS" |
313
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
27 // Songlengths database filename prefix (.md5|.txt appended) |
318
f3ba2ba894b1
Rename few HVSC related #defines to have SIDUTIL_ prefix.
Matti Hamalainen <ccr@tnsp.org>
parents:
316
diff
changeset
|
28 #define SIDUTIL_SLDB_FILEBASE "Songlengths" |
313
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
29 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
30 // STIL database file |
318
f3ba2ba894b1
Rename few HVSC related #defines to have SIDUTIL_ prefix.
Matti Hamalainen <ccr@tnsp.org>
parents:
316
diff
changeset
|
31 #define SIDUTIL_STILDB_FILENAME "STIL.txt" |
313
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 enum |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 { |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 TH_LANG_UTF8, |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 TH_LANG_ISO88591, |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 TH_LANG_CP850, |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 TH_LANG_CP437, |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
40 }; |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
41 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
43 // |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
44 // Typedefs |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
45 // |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
46 typedef struct |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 { |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
48 BOOL enabled; |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
49 char *outLang; |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 #ifdef HAVE_ICONV |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
51 iconv_t iconvCtx; |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 #else |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 int outLangID; |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
54 #endif |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
55 } SIDUtilChConvCtx; |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
56 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
57 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
58 // |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
59 // Functions |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
60 // |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 void sidutil_print_license(void); |
316
b0c844b39516
Move and rename siEscapeString() to sidutil_escape_string() and
Matti Hamalainen <ccr@tnsp.org>
parents:
313
diff
changeset
|
62 |
b0c844b39516
Move and rename siEscapeString() to sidutil_escape_string() and
Matti Hamalainen <ccr@tnsp.org>
parents:
313
diff
changeset
|
63 char * sidutil_escape_string(const char *str, const char *escchars); |
b0c844b39516
Move and rename siEscapeString() to sidutil_escape_string() and
Matti Hamalainen <ccr@tnsp.org>
parents:
313
diff
changeset
|
64 void sidutil_print_string_escaped(FILE *outFile, const char *str); |
b0c844b39516
Move and rename siEscapeString() to sidutil_escape_string() and
Matti Hamalainen <ccr@tnsp.org>
parents:
313
diff
changeset
|
65 |
313
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
66 const char * sidutil_strip_hvsc_path(const char *hvscPath, const char *filename); |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
67 char * sidutil_check_hvsc_file(const char *hvscPath, const char *filebase, const char *fext); |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
68 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
69 char * sidutil_chconv_convert(SIDUtilChConvCtx *ctx, const char *src); |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
70 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
71 int sidutil_chconv_init(SIDUtilChConvCtx *ctx, const char *outLang); |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
72 void sidutil_chconv_close(SIDUtilChConvCtx *ctx); |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
73 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
74 |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
75 #ifdef __cplusplus |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
76 } |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
77 #endif |
b3d46806787d
Move a number of more or less generic helper functions into a separate sidutil.[ch] module.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
78 #endif // SIDUTIL_H |