commit 11224f296021397c5dad29011fea403127125bdd
parent 0067e97f7b5d5ab6baed637a77fc5a8af05e1019
Author: nibo <nibo@relim.de>
Date: Mon, 27 Jan 2025 13:30:09 +0100
Rename NamingSystem to NotationSystem
Diffstat:
| M | config.c | | | 46 | +++++++++++++++++++++++----------------------- |
| M | config.h | | | 6 | +++--- |
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/config.c b/config.c
@@ -7,7 +7,7 @@
#include "util.h"
#include "chord_diagram.h"
-static const char *naming_systems[] = {
+static const char *notation_systems[] = {
"common",
"german",
"scandinavian",
@@ -173,20 +173,20 @@ config_text_type_parse(const char *str)
return -1;
}
-static enum NamingSystem
-config_naming_system_parse(const char *str)
+static enum NotationSystem
+config_notation_system_parse(const char *str)
{
- if (!strcmp(str, naming_systems[NS_COMMON]) || !strcmp(str, "dutch")) {
+ if (!strcmp(str, notation_systems[NS_COMMON]) || !strcmp(str, "dutch")) {
return NS_COMMON;
- } else if (!strcmp(str, naming_systems[NS_GERMAN])) {
+ } else if (!strcmp(str, notation_systems[NS_GERMAN])) {
return NS_GERMAN;
- } else if (!strcmp(str, naming_systems[NS_SCANDINAVIAN])) {
+ } else if (!strcmp(str, notation_systems[NS_SCANDINAVIAN])) {
return NS_SCANDINAVIAN;
- } else if (!strcmp(str, naming_systems[NS_LATIN])) {
+ } else if (!strcmp(str, notation_systems[NS_LATIN])) {
return NS_LATIN;
- } else if (!strcmp(str, naming_systems[NS_ROMAN])) {
+ } else if (!strcmp(str, notation_systems[NS_ROMAN])) {
return NS_ROMAN;
- } else if (!strcmp(str, naming_systems[NS_NASHVILLE])) {
+ } else if (!strcmp(str, notation_systems[NS_NASHVILLE])) {
return NS_NASHVILLE;
} else {
return NS_CUSTOM;
@@ -194,9 +194,9 @@ config_naming_system_parse(const char *str)
}
static const char *
-config_naming_system_to_config_string(enum NamingSystem system)
+config_notation_system_to_config_string(enum NotationSystem system)
{
- return naming_systems[system];
+ return notation_systems[system];
}
static enum Instrument
@@ -253,7 +253,7 @@ config_notes_free(struct Note **notes)
}
static struct Note **
-config_notes_new_default(enum NamingSystem system)
+config_notes_new_default(enum NotationSystem system)
{
struct Note **notes_default = emalloc(8 * sizeof(struct Note *));
struct Note *notes;
@@ -301,7 +301,7 @@ config_notes_load(toml_table_t *notes, const char *system)
toml_array_t *arr = toml_table_array(notes, system);
int arr_len = toml_array_len(arr);
if (arr_len != 7) {
- util_log(LOG_ERR, "Custom naming system '%s' in [notes] has to have exactly 7 items. For an example see `lorid --print-default-config`.", system);
+ util_log(LOG_ERR, "Custom notation system '%s' in [notes] has to have exactly 7 items. For an example see `lorid --print-default-config`.", system);
free(notes);
return NULL;
}
@@ -320,7 +320,7 @@ config_notes_load(toml_table_t *notes, const char *system)
if (value.ok) {
custom_notes[i]->sharp = value.u.s;
if (i == 2 || i == 6) {
- util_log(LOG_ERR, "Custom naming system '%s' in [notes] can't have sharp value at array index '%d'.", system, i);
+ util_log(LOG_ERR, "Custom notation system '%s' in [notes] can't have sharp value at array index '%d'.", system, i);
goto CLEAN;
}
}
@@ -328,7 +328,7 @@ config_notes_load(toml_table_t *notes, const char *system)
if (value.ok) {
custom_notes[i]->flat = value.u.s;
if (i == 0 || i == 3) {
- util_log(LOG_ERR, "Custom naming system '%s' in [notes] can't have flat value at array index '%d'.", system, i);
+ util_log(LOG_ERR, "Custom notation system '%s' in [notes] can't have flat value at array index '%d'.", system, i);
goto CLEAN;
}
}
@@ -345,7 +345,7 @@ config_notes_load(toml_table_t *notes, const char *system)
}
static void
-config_notes_print_as_toml(enum NamingSystem system)
+config_notes_print_as_toml(enum NotationSystem system)
{
struct Note *notes;
switch (system) {
@@ -370,7 +370,7 @@ config_notes_print_as_toml(enum NamingSystem system)
case NS_CUSTOM:
return;
}
- printf("%s = [\n", config_naming_system_to_config_string(system));
+ printf("%s = [\n", config_notation_system_to_config_string(system));
int i;
for (i = 0; i<7; i++) {
printf("\t{ note = \"%s\",", notes[i].note);
@@ -503,10 +503,10 @@ config_print_default(void)
printf("[parser]\n");
printf("[parser.chords]\n");
printf("mode = \"%s\"\n", config_parse_mode_to_config_string(config->parser->chords->mode));
- printf("system = \"%s\"\n\n", config_naming_system_to_config_string(config->parser->chords->system));
+ printf("system = \"%s\"\n\n", config_notation_system_to_config_string(config->parser->chords->system));
printf("[output]\n");
- printf("system = \"%s\"\n", config_naming_system_to_config_string(config->output->system));
+ printf("system = \"%s\"\n", config_notation_system_to_config_string(config->output->system));
printf("start_song_on_new_page = %s\n\n", config->output->start_song_on_new_page ? "true" : "false");
printf("[output.toc]\n");
printf("show = %s\n", config->output->toc->show ? "true" : "false");
@@ -877,7 +877,7 @@ config_load(const char *filepath)
if (output) {
toml_table_t *styles, *notes, *chorus, *diagram, *toc, *page_no;
toml_value_t value;
- enum NamingSystem system;
+ enum NotationSystem system;
enum Instrument instrument;
enum Alignment align;
struct Note **custom_notes;
@@ -924,7 +924,7 @@ config_load(const char *filepath)
}
value = toml_table_string(output, "system");
if (value.ok) {
- system = config_naming_system_parse(value.u.s);
+ system = config_notation_system_parse(value.u.s);
if (system == NS_CUSTOM) {
notes = toml_table_table(table, "notes");
if (!notes) {
@@ -998,11 +998,11 @@ config_load(const char *filepath)
if (chords) {
toml_table_t *notes;
toml_value_t value;
- enum NamingSystem system;
+ enum NotationSystem system;
struct Note **custom_notes;
value = toml_table_string(chords, "system");
if (value.ok) {
- system = config_naming_system_parse(value.u.s);
+ system = config_notation_system_parse(value.u.s);
if (system == NS_CUSTOM) {
notes = toml_table_table(table, "notes");
if (!notes) {
diff --git a/config.h b/config.h
@@ -8,7 +8,7 @@
#endif /* DEBUG */
#define DEFAULT_FONT_FAMILY "Open Sans"
-enum NamingSystem {
+enum NotationSystem {
NS_COMMON,
NS_GERMAN,
NS_SCANDINAVIAN,
@@ -43,7 +43,7 @@ struct Note {
};
struct ConfigChords {
- enum NamingSystem system;
+ enum NotationSystem system;
enum ParseMode mode;
};
@@ -79,7 +79,7 @@ struct ConfigOutput {
struct ConfigPageNo *page_no;
struct ChoStyle **styles; // TODO: Make array of size 7
struct Note **notes;
- enum NamingSystem system;
+ enum NotationSystem system;
bool start_song_on_new_page;
};