xref: /freebsd/contrib/expat/tests/dummy.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1 /* Dummy handler functions for the Expat test suite
2                             __  __            _
3                          ___\ \/ /_ __   __ _| |_
4                         / _ \\  /| '_ \ / _` | __|
5                        |  __//  \| |_) | (_| | |_
6                         \___/_/\_\ .__/ \__,_|\__|
7                                  |_| XML parser
8 
9    Copyright (c) 2001-2006 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
10    Copyright (c) 2003      Greg Stein <gstein@users.sourceforge.net>
11    Copyright (c) 2005-2007 Steven Solie <steven@solie.ca>
12    Copyright (c) 2005-2012 Karl Waclawek <karl@waclawek.net>
13    Copyright (c) 2016-2022 Sebastian Pipping <sebastian@pipping.org>
14    Copyright (c) 2017-2022 Rhodri James <rhodri@wildebeest.org.uk>
15    Copyright (c) 2017      Joe Orton <jorton@redhat.com>
16    Copyright (c) 2017      José Gutiérrez de la Concha <jose@zeroc.com>
17    Copyright (c) 2018      Marco Maggi <marco.maggi-ipsu@poste.it>
18    Copyright (c) 2019      David Loffredo <loffredo@steptools.com>
19    Copyright (c) 2020      Tim Gates <tim.gates@iress.com>
20    Copyright (c) 2021      Donghee Na <donghee.na@python.org>
21    Licensed under the MIT license:
22 
23    Permission is  hereby granted,  free of charge,  to any  person obtaining
24    a  copy  of  this  software   and  associated  documentation  files  (the
25    "Software"),  to  deal in  the  Software  without restriction,  including
26    without  limitation the  rights  to use,  copy,  modify, merge,  publish,
27    distribute, sublicense, and/or sell copies of the Software, and to permit
28    persons  to whom  the Software  is  furnished to  do so,  subject to  the
29    following conditions:
30 
31    The above copyright  notice and this permission notice  shall be included
32    in all copies or substantial portions of the Software.
33 
34    THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT  WARRANTY  OF  ANY  KIND,
35    EXPRESS  OR IMPLIED,  INCLUDING  BUT  NOT LIMITED  TO  THE WARRANTIES  OF
36    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
37    NO EVENT SHALL THE AUTHORS OR  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
38    DAMAGES OR  OTHER LIABILITY, WHETHER  IN AN  ACTION OF CONTRACT,  TORT OR
39    OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
40    USE OR OTHER DEALINGS IN THE SOFTWARE.
41 */
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 #ifndef XML_DUMMY_H
48 #  define XML_DUMMY_H
49 
50 #  define DUMMY_START_DOCTYPE_HANDLER_FLAG (1UL << 0)
51 #  define DUMMY_END_DOCTYPE_HANDLER_FLAG (1UL << 1)
52 #  define DUMMY_ENTITY_DECL_HANDLER_FLAG (1UL << 2)
53 #  define DUMMY_NOTATION_DECL_HANDLER_FLAG (1UL << 3)
54 #  define DUMMY_ELEMENT_DECL_HANDLER_FLAG (1UL << 4)
55 #  define DUMMY_ATTLIST_DECL_HANDLER_FLAG (1UL << 5)
56 #  define DUMMY_COMMENT_HANDLER_FLAG (1UL << 6)
57 #  define DUMMY_PI_HANDLER_FLAG (1UL << 7)
58 #  define DUMMY_START_ELEMENT_HANDLER_FLAG (1UL << 8)
59 #  define DUMMY_START_CDATA_HANDLER_FLAG (1UL << 9)
60 #  define DUMMY_END_CDATA_HANDLER_FLAG (1UL << 10)
61 #  define DUMMY_UNPARSED_ENTITY_DECL_HANDLER_FLAG (1UL << 11)
62 #  define DUMMY_START_NS_DECL_HANDLER_FLAG (1UL << 12)
63 #  define DUMMY_END_NS_DECL_HANDLER_FLAG (1UL << 13)
64 #  define DUMMY_START_DOCTYPE_DECL_HANDLER_FLAG (1UL << 14)
65 #  define DUMMY_END_DOCTYPE_DECL_HANDLER_FLAG (1UL << 15)
66 #  define DUMMY_SKIP_HANDLER_FLAG (1UL << 16)
67 #  define DUMMY_DEFAULT_HANDLER_FLAG (1UL << 17)
68 
69 extern void init_dummy_handlers(void);
70 extern unsigned long get_dummy_handler_flags(void);
71 
72 extern void XMLCALL dummy_xdecl_handler(void *userData, const XML_Char *version,
73                                         const XML_Char *encoding,
74                                         int standalone);
75 
76 extern void XMLCALL dummy_start_doctype_handler(void *userData,
77                                                 const XML_Char *doctypeName,
78                                                 const XML_Char *sysid,
79                                                 const XML_Char *pubid,
80                                                 int has_internal_subset);
81 
82 extern void XMLCALL dummy_end_doctype_handler(void *userData);
83 
84 extern void XMLCALL dummy_entity_decl_handler(
85     void *userData, const XML_Char *entityName, int is_parameter_entity,
86     const XML_Char *value, int value_length, const XML_Char *base,
87     const XML_Char *systemId, const XML_Char *publicId,
88     const XML_Char *notationName);
89 
90 extern void XMLCALL dummy_notation_decl_handler(void *userData,
91                                                 const XML_Char *notationName,
92                                                 const XML_Char *base,
93                                                 const XML_Char *systemId,
94                                                 const XML_Char *publicId);
95 
96 extern void XMLCALL dummy_element_decl_handler(void *userData,
97                                                const XML_Char *name,
98                                                XML_Content *model);
99 
100 extern void XMLCALL dummy_attlist_decl_handler(
101     void *userData, const XML_Char *elname, const XML_Char *attname,
102     const XML_Char *att_type, const XML_Char *dflt, int isrequired);
103 
104 extern void XMLCALL dummy_comment_handler(void *userData, const XML_Char *data);
105 
106 extern void XMLCALL dummy_pi_handler(void *userData, const XML_Char *target,
107                                      const XML_Char *data);
108 
109 extern void XMLCALL dummy_start_element(void *userData, const XML_Char *name,
110                                         const XML_Char **atts);
111 
112 extern void XMLCALL dummy_end_element(void *userData, const XML_Char *name);
113 
114 extern void XMLCALL dummy_start_cdata_handler(void *userData);
115 
116 extern void XMLCALL dummy_end_cdata_handler(void *userData);
117 
118 extern void XMLCALL dummy_cdata_handler(void *userData, const XML_Char *s,
119                                         int len);
120 
121 extern void XMLCALL dummy_start_namespace_decl_handler(void *userData,
122                                                        const XML_Char *prefix,
123                                                        const XML_Char *uri);
124 
125 extern void XMLCALL dummy_end_namespace_decl_handler(void *userData,
126                                                      const XML_Char *prefix);
127 
128 extern void XMLCALL dummy_unparsed_entity_decl_handler(
129     void *userData, const XML_Char *entityName, const XML_Char *base,
130     const XML_Char *systemId, const XML_Char *publicId,
131     const XML_Char *notationName);
132 
133 extern void XMLCALL dummy_default_handler(void *userData, const XML_Char *s,
134                                           int len);
135 
136 extern void XMLCALL dummy_start_doctype_decl_handler(
137     void *userData, const XML_Char *doctypeName, const XML_Char *sysid,
138     const XML_Char *pubid, int has_internal_subset);
139 
140 extern void XMLCALL dummy_end_doctype_decl_handler(void *userData);
141 
142 extern void XMLCALL dummy_skip_handler(void *userData,
143                                        const XML_Char *entityName,
144                                        int is_parameter_entity);
145 
146 #endif /* XML_DUMMY_H */
147 
148 #ifdef __cplusplus
149 }
150 #endif
151