1/*
2                            __  __            _
3                         ___\ \/ /_ __   __ _| |_
4                        / _ \\  /| '_ \ / _` | __|
5                       |  __//  \| |_) | (_| | |_
6                        \___/_/\_\ .__/ \__,_|\__|
7                                 |_| XML parser
8
9   Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
10   Copyright (c) 2000-2017 Expat development team
11   Licensed under the MIT license:
12
13   Permission is  hereby granted,  free of charge,  to any  person obtaining
14   a  copy  of  this  software   and  associated  documentation  files  (the
15   "Software"),  to  deal in  the  Software  without restriction,  including
16   without  limitation the  rights  to use,  copy,  modify, merge,  publish,
17   distribute, sublicense, and/or sell copies of the Software, and to permit
18   persons  to whom  the Software  is  furnished to  do so,  subject to  the
19   following conditions:
20
21   The above copyright  notice and this permission notice  shall be included
22   in all copies or substantial portions of the Software.
23
24   THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY  OF  ANY  KIND,
25   EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF
26   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
27   NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28   DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR
29   OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
30   USE OR OTHER DEALINGS IN THE SOFTWARE.
31*/
32
33#ifndef XmlRole_INCLUDED
34#define XmlRole_INCLUDED 1
35
36#ifdef __VMS
37/*      0        1         2         3      0        1         2         3
38        1234567890123456789012345678901     1234567890123456789012345678901 */
39#  define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
40#endif
41
42#include "xmltok.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48enum {
49  XML_ROLE_ERROR = -1,
50  XML_ROLE_NONE = 0,
51  XML_ROLE_XML_DECL,
52  XML_ROLE_INSTANCE_START,
53  XML_ROLE_DOCTYPE_NONE,
54  XML_ROLE_DOCTYPE_NAME,
55  XML_ROLE_DOCTYPE_SYSTEM_ID,
56  XML_ROLE_DOCTYPE_PUBLIC_ID,
57  XML_ROLE_DOCTYPE_INTERNAL_SUBSET,
58  XML_ROLE_DOCTYPE_CLOSE,
59  XML_ROLE_GENERAL_ENTITY_NAME,
60  XML_ROLE_PARAM_ENTITY_NAME,
61  XML_ROLE_ENTITY_NONE,
62  XML_ROLE_ENTITY_VALUE,
63  XML_ROLE_ENTITY_SYSTEM_ID,
64  XML_ROLE_ENTITY_PUBLIC_ID,
65  XML_ROLE_ENTITY_COMPLETE,
66  XML_ROLE_ENTITY_NOTATION_NAME,
67  XML_ROLE_NOTATION_NONE,
68  XML_ROLE_NOTATION_NAME,
69  XML_ROLE_NOTATION_SYSTEM_ID,
70  XML_ROLE_NOTATION_NO_SYSTEM_ID,
71  XML_ROLE_NOTATION_PUBLIC_ID,
72  XML_ROLE_ATTRIBUTE_NAME,
73  XML_ROLE_ATTRIBUTE_TYPE_CDATA,
74  XML_ROLE_ATTRIBUTE_TYPE_ID,
75  XML_ROLE_ATTRIBUTE_TYPE_IDREF,
76  XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
77  XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
78  XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
79  XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
80  XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
81  XML_ROLE_ATTRIBUTE_ENUM_VALUE,
82  XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
83  XML_ROLE_ATTLIST_NONE,
84  XML_ROLE_ATTLIST_ELEMENT_NAME,
85  XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
86  XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
87  XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
88  XML_ROLE_FIXED_ATTRIBUTE_VALUE,
89  XML_ROLE_ELEMENT_NONE,
90  XML_ROLE_ELEMENT_NAME,
91  XML_ROLE_CONTENT_ANY,
92  XML_ROLE_CONTENT_EMPTY,
93  XML_ROLE_CONTENT_PCDATA,
94  XML_ROLE_GROUP_OPEN,
95  XML_ROLE_GROUP_CLOSE,
96  XML_ROLE_GROUP_CLOSE_REP,
97  XML_ROLE_GROUP_CLOSE_OPT,
98  XML_ROLE_GROUP_CLOSE_PLUS,
99  XML_ROLE_GROUP_CHOICE,
100  XML_ROLE_GROUP_SEQUENCE,
101  XML_ROLE_CONTENT_ELEMENT,
102  XML_ROLE_CONTENT_ELEMENT_REP,
103  XML_ROLE_CONTENT_ELEMENT_OPT,
104  XML_ROLE_CONTENT_ELEMENT_PLUS,
105  XML_ROLE_PI,
106  XML_ROLE_COMMENT,
107#ifdef XML_DTD
108  XML_ROLE_TEXT_DECL,
109  XML_ROLE_IGNORE_SECT,
110  XML_ROLE_INNER_PARAM_ENTITY_REF,
111#endif /* XML_DTD */
112  XML_ROLE_PARAM_ENTITY_REF
113};
114
115typedef struct prolog_state {
116  int(PTRCALL *handler)(struct prolog_state *state, int tok, const char *ptr,
117                        const char *end, const ENCODING *enc);
118  unsigned level;
119  int role_none;
120#ifdef XML_DTD
121  unsigned includeLevel;
122  int documentEntity;
123  int inEntityValue;
124#endif /* XML_DTD */
125} PROLOG_STATE;
126
127void XmlPrologStateInit(PROLOG_STATE *);
128#ifdef XML_DTD
129void XmlPrologStateInitExternalEntity(PROLOG_STATE *);
130#endif /* XML_DTD */
131
132#define XmlTokenRole(state, tok, ptr, end, enc)                                \
133  (((state)->handler)(state, tok, ptr, end, enc))
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif /* not XmlRole_INCLUDED */
140