| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #ifndef ARK_PARSER_H
- #define ARK_PARSER_H
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define MAX_LINE_LEN 1024
- #define MAX_KEYS 128
- #define MAX_SECTIONS 32
- #define MAX_STANDALONE 32
- typedef struct {
- char key[256];
- char value[512];
- } ArkKeyValuePair;
- typedef struct {
- char name[256];
- ArkKeyValuePair pairs[MAX_KEYS];
- int pair_count;
- } ArkSection;
- typedef struct {
- char filepath[512];
- ArkKeyValuePair global_pairs[MAX_KEYS];
- int global_count;
-
- ArkSection sections[MAX_SECTIONS];
- int section_count;
-
- char standalone[MAX_STANDALONE][512];
- int standalone_count;
- } ArkConfig;
- ArkConfig* ark_parse(const char* filepath);
- const char* ark_get_global(ArkConfig* config, const char* key);
- const char* ark_get_section_val(ArkConfig* config, const char* section, const char* key);
- void ark_set_global(ArkConfig* config, const char* key, const char* value);
- void ark_dump(ArkConfig* config, const char* filepath);
- void ark_free(ArkConfig* config);
- #endif // ARK_PARSER_H
|