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
|
/* 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_FORMAT_H
#define _ARGOT_FORMAT_H
#include <argot/value.h>
#include <argot/locus.h>
#include <argot/node.h>
#include <argot/txtacc.h>
struct argot_format_closure {
int (*fmtfun)(const char *, void *);
void *data;
};
void argot_format_locus(argot_locus_t *locus, struct argot_format_closure *fp);
void argot_format_node_path(struct argot_node *node, int flag,
struct argot_format_closure *fp);
void argot_format_value(struct argot_value *val, int flags,
struct argot_format_closure *fp);
#define ARGOT_NODE_FLAG_PATH 0x00100
#define ARGOT_NODE_FLAG_VALUE 0x00200
#define ARGOT_NODE_FLAG_DESCEND 0x01000
#define ARGOT_NODE_FLAG_LOCUS 0x02000
#define ARGOT_NODE_FLAG_QUOTE 0x04000
#define ARGOT_NODE_FLAG_NOQUOTE 0x08000
#define ARGOT_NODE_FLAG_QUOTE_HEX 0x10000
#define _ARGOT_NODE_MASK_DELIM 0x000ff
#define _ARGOT_NODE_MASK_OUTPUT 0x00f00
#define ARGOT_NODE_FLAG_DEFAULT \
(ARGOT_NODE_FLAG_PATH|ARGOT_NODE_FLAG_VALUE|\
ARGOT_NODE_FLAG_DESCEND|ARGOT_NODE_FLAG_QUOTE)
int argot_format_node(struct argot_node *node, int flags,
struct argot_format_closure *fp);
void argot_print_locus(argot_locus_t *locus, FILE *fp);
void argot_print_node_path(struct argot_node *node, int flag, FILE *fp);
void argot_print_value(struct argot_value *val, int flags, FILE *fp);
int argot_print_node(struct argot_node *node, int flags, FILE *fp);
void argot_txtacc_format_value(struct argot_value *val, int flags,
argot_txtacc_t acc);
#endif
|