]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd | |
3 | See the file copying.txt for copying permission. | |
4 | */ | |
5 | ||
6 | #ifndef XmlRole_INCLUDED | |
7 | #define XmlRole_INCLUDED 1 | |
8 | ||
9 | #include "xmltok.h" | |
10 | ||
11 | #ifdef __cplusplus | |
12 | extern "C" { | |
13 | #endif | |
14 | ||
15 | enum { | |
16 | XML_ROLE_ERROR = -1, | |
17 | XML_ROLE_NONE = 0, | |
18 | XML_ROLE_XML_DECL, | |
19 | XML_ROLE_INSTANCE_START, | |
20 | XML_ROLE_DOCTYPE_NAME, | |
21 | XML_ROLE_DOCTYPE_SYSTEM_ID, | |
22 | XML_ROLE_DOCTYPE_PUBLIC_ID, | |
23 | XML_ROLE_DOCTYPE_CLOSE, | |
24 | XML_ROLE_GENERAL_ENTITY_NAME, | |
25 | XML_ROLE_PARAM_ENTITY_NAME, | |
26 | XML_ROLE_ENTITY_VALUE, | |
27 | XML_ROLE_ENTITY_SYSTEM_ID, | |
28 | XML_ROLE_ENTITY_PUBLIC_ID, | |
29 | XML_ROLE_ENTITY_NOTATION_NAME, | |
30 | XML_ROLE_NOTATION_NAME, | |
31 | XML_ROLE_NOTATION_SYSTEM_ID, | |
32 | XML_ROLE_NOTATION_NO_SYSTEM_ID, | |
33 | XML_ROLE_NOTATION_PUBLIC_ID, | |
34 | XML_ROLE_ATTRIBUTE_NAME, | |
35 | XML_ROLE_ATTRIBUTE_TYPE_CDATA, | |
36 | XML_ROLE_ATTRIBUTE_TYPE_ID, | |
37 | XML_ROLE_ATTRIBUTE_TYPE_IDREF, | |
38 | XML_ROLE_ATTRIBUTE_TYPE_IDREFS, | |
39 | XML_ROLE_ATTRIBUTE_TYPE_ENTITY, | |
40 | XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, | |
41 | XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, | |
42 | XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, | |
43 | XML_ROLE_ATTRIBUTE_ENUM_VALUE, | |
44 | XML_ROLE_ATTRIBUTE_NOTATION_VALUE, | |
45 | XML_ROLE_ATTLIST_ELEMENT_NAME, | |
46 | XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, | |
47 | XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, | |
48 | XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, | |
49 | XML_ROLE_FIXED_ATTRIBUTE_VALUE, | |
50 | XML_ROLE_ELEMENT_NAME, | |
51 | XML_ROLE_CONTENT_ANY, | |
52 | XML_ROLE_CONTENT_EMPTY, | |
53 | XML_ROLE_CONTENT_PCDATA, | |
54 | XML_ROLE_GROUP_OPEN, | |
55 | XML_ROLE_GROUP_CLOSE, | |
56 | XML_ROLE_GROUP_CLOSE_REP, | |
57 | XML_ROLE_GROUP_CLOSE_OPT, | |
58 | XML_ROLE_GROUP_CLOSE_PLUS, | |
59 | XML_ROLE_GROUP_CHOICE, | |
60 | XML_ROLE_GROUP_SEQUENCE, | |
61 | XML_ROLE_CONTENT_ELEMENT, | |
62 | XML_ROLE_CONTENT_ELEMENT_REP, | |
63 | XML_ROLE_CONTENT_ELEMENT_OPT, | |
64 | XML_ROLE_CONTENT_ELEMENT_PLUS, | |
65 | #ifdef XML_DTD | |
66 | XML_ROLE_TEXT_DECL, | |
67 | XML_ROLE_IGNORE_SECT, | |
68 | XML_ROLE_INNER_PARAM_ENTITY_REF, | |
69 | #endif /* XML_DTD */ | |
70 | XML_ROLE_PARAM_ENTITY_REF, | |
71 | XML_ROLE_EXTERNAL_GENERAL_ENTITY_NO_NOTATION | |
72 | }; | |
73 | ||
74 | typedef struct prolog_state { | |
75 | int (*handler)(struct prolog_state *state, | |
76 | int tok, | |
77 | const char *ptr, | |
78 | const char *end, | |
79 | const ENCODING *enc); | |
80 | unsigned level; | |
81 | #ifdef XML_DTD | |
82 | unsigned includeLevel; | |
83 | int documentEntity; | |
84 | #endif /* XML_DTD */ | |
85 | } PROLOG_STATE; | |
86 | ||
87 | void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *); | |
88 | #ifdef XML_DTD | |
89 | void XMLTOKAPI XmlPrologStateInitExternalEntity(PROLOG_STATE *); | |
90 | #endif /* XML_DTD */ | |
91 | ||
92 | #define XmlTokenRole(state, tok, ptr, end, enc) \ | |
93 | (((state)->handler)(state, tok, ptr, end, enc)) | |
94 | ||
95 | #ifdef __cplusplus | |
96 | } | |
97 | #endif | |
98 | ||
99 | #endif /* not XmlRole_INCLUDED */ |