forked from mailru/confetti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prscfg.h
53 lines (42 loc) · 812 Bytes
/
prscfg.h
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
#ifndef PRSCFG_H
#define PRSCFG_H
#include <stdio.h>
typedef struct NameAtom {
char *name;
int index;
struct NameAtom *next;
} NameAtom;
typedef struct OptDef {
enum {
scalarType = 0,
structType = 1,
arrayType = 2
} paramType;
int optional;
union {
char *scalarval;
struct OptDef *structval;
struct OptDef *arrayval;
} paramValue;
NameAtom *name;
struct OptDef *parent;
struct OptDef *next;
} OptDef;
OptDef* parseCfgDef(FILE *fh, int *error);
OptDef* parseCfgDefBuffer(char *buffer, int *error);
void freeCfgDef(OptDef *def);
typedef enum ConfettyError {
CNF_OK = 0,
CNF_MISSED,
CNF_WRONGTYPE,
CNF_WRONGINDEX,
CNF_RDONLY,
CNF_WRONGINT,
CNF_WRONGRANGE,
CNF_NOMEMORY,
CNF_SYNTAXERROR,
CNF_NOTSET,
CNF_OPTIONAL,
CNF_INTERNALERROR
} ConfettyError;
#endif