49 lines
1.4 KiB
C
49 lines
1.4 KiB
C
|
|
/*
|
|
* Copyright Luka Jankovic 2025
|
|
*
|
|
* This file is part of Kubo.
|
|
*
|
|
* Kubo is free software: you can redistribute it and/or modify it under the
|
|
* terms of the GNU General Public License as published by the Free Software
|
|
* Foundation, either version 3 of the License, or (at your option) any later
|
|
* version.
|
|
*
|
|
* Kubo is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* Kubo. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef KUBO_FILE_H
|
|
#define KUBO_FILE_H
|
|
|
|
#include <cyaml/cyaml.h>
|
|
#include <stdio.h>
|
|
|
|
struct numbers {
|
|
char *name;
|
|
int *data;
|
|
unsigned data_count;
|
|
};
|
|
|
|
static const cyaml_schema_value_t data_entry = {
|
|
CYAML_VALUE_INT(CYAML_FLAG_DEFAULT, int),
|
|
};
|
|
|
|
static const cyaml_schema_field_t top_mapping_schema[] = {
|
|
CYAML_FIELD_STRING_PTR("name", CYAML_FLAG_POINTER, struct numbers, name, 0,
|
|
CYAML_UNLIMITED),
|
|
CYAML_FIELD_SEQUENCE("data", CYAML_FLAG_POINTER, struct numbers, data,
|
|
&data_entry, 0, CYAML_UNLIMITED),
|
|
CYAML_FIELD_END};
|
|
|
|
static const cyaml_schema_value_t top_schema = {
|
|
CYAML_VALUE_MAPPING(CYAML_FLAG_POINTER, struct numbers, top_mapping_schema),
|
|
};
|
|
|
|
void kubo_file_parse(char *file_name);
|
|
|
|
#endif
|