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