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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
// ini.h
#ifndef INI_H
#define INI_H
// defines
#define IniEntriesNb 256
// includes
#include "option.h"
// types
typedef struct {
const char *section;
const char *name;
const char *value;
const char *comment;
} ini_entry_t;
typedef struct {
ini_entry_t entries[IniEntriesNb];
int index;
int iter;
} ini_t;
typedef enum {
SYNTAX_ERROR,
EMPTY_LINE,
NAME_VALUE,
EMPTY_VALUE,
SECTION
} line_type_t;
// functions
extern void ini_init (ini_t *ini);
extern void ini_clear (ini_t *ini);
extern void ini_copy (ini_t *dst, ini_t *src);
extern int ini_parse (ini_t *ini, const char *filename);
extern void ini_disp (ini_t *ini);
extern void ini_insert (ini_t *ini, ini_entry_t *entry);
extern void ini_insert_ex (ini_t *ini,
const char *section,
const char *name,
const char *value);
extern void ini_start_iter (ini_t *ini);
extern ini_entry_t *ini_next (ini_t *ini);
extern ini_entry_t *ini_find (ini_t *ini,
const char *section,
const char *name);
extern line_type_t ini_line_parse (const char *line,
char *section,
char *name,
char *value);
extern const char * ini_specials;
#endif // !defined INI_H
// end of ini.h
|