blob: 1bfc8b0c4c784acb96de61c7fbc893f0258a5183 (
plain)
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
|
/* argot - Gray's Extensible Configuration System -*- c -*-
Copyright (C) 2007-2016 Sergey Poznyakoff
Grecs 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.
Grecs 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 Grecs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _ARGOT_VALUE_H
#define _ARGOT_VALUE_H
#include <argot/locus.h>
#include <argot/list.h>
#define ARGOT_TYPE_STRING 0
#define ARGOT_TYPE_LIST 1
#define ARGOT_TYPE_ARRAY 2
typedef struct argot_value {
int type;
argot_locus_t locus;
union {
argot_list_ptr_t list;
char *string;
struct {
size_t c;
struct argot_value **v;
} arg;
} v;
} argot_value_t;
#define ARGOT_VALUE_EMPTY_P(val) \
(!(val) || \
((val)->type == ARGOT_TYPE_STRING && (val)->v.string == NULL))
void argot_value_free(struct argot_value *val);
void argot_value_free_content(struct argot_value *val);
argot_value_t *argot_value_ptr_from_static(argot_value_t *input);
int argot_value_eq(struct argot_value *a, struct argot_value *b);
int argot_value_match(struct argot_value *pat, struct argot_value *b,
int flags);
#endif
|