-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathkcgixml.h
71 lines (64 loc) · 2.25 KB
/
kcgixml.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* $Id$ */
/*
* Copyright (c) 2015, 2017 Kristaps Dzonsons <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef KCGIXML_H
#define KCGIXML_H
/*
* The only visible symbols should be those in this header file.
*/
#pragma GCC visibility push(default)
#if !defined(__BEGIN_DECLS)
# ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# else
# define __BEGIN_DECLS
# endif
#endif
#if !defined(__END_DECLS)
# ifdef __cplusplus
# define __END_DECLS }
# else
# define __END_DECLS
# endif
#endif
/*
* The maximum number of XML scopes allowed.
* Once this has been reached, new scopes will return KCGI_ENOMEM.
*/
#define KXML_STACK_MAX 128
struct kxmlreq {
void *arg;
const char *const *elems;
size_t elemsz;
size_t stack[KXML_STACK_MAX];
size_t stackpos;
};
__BEGIN_DECLS
enum kcgi_err kxml_prologue(struct kxmlreq *);
enum kcgi_err kxml_close(struct kxmlreq *);
enum kcgi_err kxml_open(struct kxmlreq *, struct kreq *, const char *const *, size_t);
enum kcgi_err kxml_push(struct kxmlreq *, size_t);
enum kcgi_err kxml_pushattrs(struct kxmlreq *, size_t, ...);
enum kcgi_err kxml_pushnull(struct kxmlreq *, size_t);
enum kcgi_err kxml_pushnullattrs(struct kxmlreq *, size_t, ...);
enum kcgi_err kxml_pop(struct kxmlreq *);
enum kcgi_err kxml_popall(struct kxmlreq *);
enum kcgi_err kxml_putc(struct kxmlreq *, char);
enum kcgi_err kxml_puts(struct kxmlreq *, const char *);
enum kcgi_err kxml_write(const char *, size_t, void *);
__END_DECLS
#pragma GCC visibility pop /* visibility(default) */
#endif