diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-01-21 17:25:55 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-07-04 15:41:59 +0300 |
commit | 8e541ddaffcab6eaa36faf86304b51a0bc6a92a1 (patch) | |
tree | fc909de2e7322c9ad04e8d51d0f9e5213b552cb1 /include/grecs/value.h | |
parent | 17d95ceb6d3f749e9ce20747197703e40e453759 (diff) | |
download | grecs-8e541ddaffcab6eaa36faf86304b51a0bc6a92a1.tar.gz grecs-8e541ddaffcab6eaa36faf86304b51a0bc6a92a1.tar.bz2 |
Split declarations between several header files.
* Makefile.am (SUBDIRS): Add include
* am/grecs.m4 (GRECS_INCLUDES): Update
(GRECS_COND_BUILD_INSTALL)
(GRECS_COND_BUILD_SHARED)
(GRECS_COND_BUILD_STATIC): New conditions.
Build include/Makefile and include/grecs/Makefile.
* configure.ac: Use src/grecs-gram.y as a source
validity marker
* include/Makefile.a: New file.
* src/grecs.hin: Remove. Split into include/*. See below.
* include/grecs.h: New file.
* include/grecs/.gitignore: New file.
* include/grecs/Makefile.am: New file.
* include/grecs/doc.h: New file.
* include/grecs/error.h: New file.
* include/grecs/format.h: New file.
* include/grecs/lex.h: New file.
* include/grecs/list.h: New file.
* include/grecs/mem.h: New file.
* include/grecs/node.h: New file.
* include/grecs/parser.h: New file.
* include/grecs/preproc.h: New file.
* include/grecs/sockaddr.h: New file.
* include/grecs/symtab.h: New file.
* include/grecs/table.h: New file.
* include/grecs/tree.h: New file.
* include/grecs/txtacc.h: New file.
* include/grecs/types.h.in: New file.
* include/grecs/util.h: New file.
* include/grecs/value.h: New file.
* include/grecs/version.h: New file.
* src/grecs-locus.h: Move to ...
* include/grecs/locus.h: ... here
* src/grecsopt.h: Move to ...
* include/grecs/opt.h: ... here
* src/json.h: Move to ...
* include/grecs/json.h: ... here
* src/wordsplit.h: Move to ...
* include/wordsplit.h: ... here
* src/Make-inst.am (include_HEADERS): Remove.
* src/Make-shared.am (grecsinclude_HEADERS)
(noinst_HEADERS): Remove.
* src/Make-static.am (noinst_HEADERS): Remove.
* src/Make.am: Remove header-related stuff
* src/bind-gram.y: Fix includes.
* src/bind-lex.l: Likewise.
* src/cidr.c: Likewise.
* src/dhcpd-gram.y: Likewise.
* src/dhcpd-lex.l: Likewise.
* src/diag.c: Likewise.
* src/format.c: Likewise.
* src/grecs-gram.y: Likewise.
* src/grecs-lex.l: Likewise.
* src/json-gram.y: Likewise.
* src/json-lex.l: Likewise.
* src/jsonfmt.c: Likewise.
* src/lookup.c: Likewise.
* src/meta1-gram.y: Likewise.
* src/meta1-lex.l: Likewise.
* src/opthelp.c: Likewise.
* src/preproc.c: Likewise.
* src/sockaddr.c: Likewise.
* src/txtacc.c: Likewise.
* src/version.c: Likewise.
* tests/gcfenum.c: Likewise.
* tests/gcffmt.c: Likewise.
* tests/gcfpeek.c: Likewise.
* tests/gcfset.c: Likewise.
* tests/gcfver.c: Likewise.
* tests/json.c: Likewise.
Diffstat (limited to 'include/grecs/value.h')
-rw-r--r-- | include/grecs/value.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/grecs/value.h b/include/grecs/value.h new file mode 100644 index 0000000..73f979c --- /dev/null +++ b/include/grecs/value.h @@ -0,0 +1,52 @@ +/* grecs - 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 _GRECS_VALUE_H +#define _GRECS_VALUE_H + +#include <grecs/locus.h> +#include <grecs/list.h> + +#define GRECS_TYPE_STRING 0 +#define GRECS_TYPE_LIST 1 +#define GRECS_TYPE_ARRAY 2 + +typedef struct grecs_value { + int type; + grecs_locus_t locus; + union { + grecs_list_t list; + char *string; + struct { + size_t c; + struct grecs_value **v; + } arg; + } v; +} grecs_value_t; + +#define GRECS_VALUE_EMPTY_P(val) \ + (!(val) || \ + ((val)->type == GRECS_TYPE_STRING && (val)->v.string == NULL)) + +void grecs_value_free(struct grecs_value *val); +void grecs_value_free_content(struct grecs_value *val); +grecs_value_t *grecs_value_ptr_from_static(grecs_value_t *input); + +int grecs_value_eq(struct grecs_value *a, struct grecs_value *b); +int grecs_value_match(struct grecs_value *pat, struct grecs_value *b, + int flags); + +#endif |