-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsection.h
More file actions
40 lines (32 loc) · 1001 Bytes
/
section.h
File metadata and controls
40 lines (32 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// sections.h (interfaccia semplice)
#pragma once
#include <stddef.h>
typedef struct {
char* chord; // es. "C", "Am", "Gadd9"
int duration; // in battiti
} ChordDur;
typedef struct {
char* name; // es. "INTRO", "Verse_A"
ChordDur* items; // lista (dinamica)
size_t count;
size_t cap;
} Section;
typedef struct {
char* name; // sezione da ripetere
int repeats;
} SongPart;
typedef struct {
Section* sections; // registro
size_t count;
size_t cap;
SongPart* song; // struttura [SONG]
size_t song_count;
size_t song_cap;
} SectionRegistry;
// API
void sections_init(SectionRegistry* reg);
void sections_free(SectionRegistry* reg);
// Parsing dagli argv (dopo le options): ritorna 0 se ok, <0 se errore
int parse_sections_and_structure(SectionRegistry* reg, int argc, char** argv);
// Utility: cerca sezione per nome (NULL se non trovata)
const Section* find_section(const SectionRegistry* reg, const char* name);