aboutsummaryrefslogtreecommitdiff
path: root/include/argot/value.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/argot/value.h')
-rw-r--r--include/argot/value.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/argot/value.h b/include/argot/value.h
new file mode 100644
index 0000000..1bfc8b0
--- /dev/null
+++ b/include/argot/value.h
@@ -0,0 +1,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

Return to:

Send suggestions and report system problems to the System administrator.