annotate sidutil.h @ 352:4978ff445572

Add lowercase versions of the STIL field names array as sidlib_stil_fields_lc[]. Rename the uppercase array as sidlib_stil_fields_uc[].
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 21 Jan 2020 04:41:49 +0200
parents a6153837c138
children 811eb6c6695e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
349
a6153837c138 Split HVSC SLDB and STILDB reading boilerplate code from sidinfo to sidutil.
Matti Hamalainen <ccr@tnsp.org>
parents: 318
diff changeset
10 #include "sidlib.h"
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
11 #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
12 # 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
13 #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
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
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 #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
17 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
18 #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
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 //
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 // 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
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
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
25 // HVSC documents directory
318
f3ba2ba894b1 Rename few HVSC related #defines to have SIDUTIL_ prefix.
Matti Hamalainen <ccr@tnsp.org>
parents: 316
diff changeset
26 #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
27
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
28 // 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
29 #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
30
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
31 // STIL database file
318
f3ba2ba894b1 Rename few HVSC related #defines to have SIDUTIL_ prefix.
Matti Hamalainen <ccr@tnsp.org>
parents: 316
diff changeset
32 #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
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
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 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
36 {
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_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
38 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
39 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
40 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
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 //
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 // 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
46 //
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 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
48 {
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 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
50 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
51 #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
52 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
53 #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
54 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
55 #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
56 } 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
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 //
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 // 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
61 //
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
62 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
63
b0c844b39516 Move and rename siEscapeString() to sidutil_escape_string() and
Matti Hamalainen <ccr@tnsp.org>
parents: 313
diff changeset
64 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
65 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
66
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
67 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
68 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
69
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 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
71
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 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
73 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
74
349
a6153837c138 Split HVSC SLDB and STILDB reading boilerplate code from sidinfo to sidutil.
Matti Hamalainen <ccr@tnsp.org>
parents: 318
diff changeset
75 int sidutil_read_sldb_file(const char *filename, SIDLibSLDB **pdbh);
a6153837c138 Split HVSC SLDB and STILDB reading boilerplate code from sidinfo to sidutil.
Matti Hamalainen <ccr@tnsp.org>
parents: 318
diff changeset
76 int sidutil_read_stildb_file(const char *filename, SIDLibSTILDB **pdbh, SIDLibChConvCtx *chconv);
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
77
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 #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
79 }
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
80 #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
81 #endif // SIDUTIL_H