]> git.saurik.com Git - wxWidgets.git/blob - src/expat/amiga/expat_68k_handler_stubs.c
avoid duplicate move events
[wxWidgets.git] / src / expat / amiga / expat_68k_handler_stubs.c
1 /*
2 ** Copyright (c) 2001-2009 Expat maintainers.
3 **
4 ** Permission is hereby granted, free of charge, to any person obtaining
5 ** a copy of this software and associated documentation files (the
6 ** "Software"), to deal in the Software without restriction, including
7 ** without limitation the rights to use, copy, modify, merge, publish,
8 ** distribute, sublicense, and/or sell copies of the Software, and to
9 ** permit persons to whom the Software is furnished to do so, subject to
10 ** the following conditions:
11 **
12 ** The above copyright notice and this permission notice shall be included
13 ** in all copies or substantial portions of the Software.
14 **
15 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 ** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24 #ifdef __USE_INLINE__
25 #undef __USE_INLINE__
26 #endif
27
28 #include "expat_68k.h"
29 #include <exec/emulation.h>
30 #include <proto/exec.h>
31 #include <stdarg.h>
32
33 static uint32 VARARGS68K call_68k_code (struct ExecIFace *IExec, void *code, int num_args, ...) {
34 uint32 res = 0;
35
36 va_list vargs;
37 va_startlinear(vargs, num_args);
38 uint32 *args = va_getlinearva(vargs, uint32 *);
39
40 uint8 *stack = IExec->AllocVec(4096, MEMF_SHARED);
41 if (stack) {
42 uint32 *sp = (uint32 *)(stack + 4096);
43 args += num_args;
44 while (num_args--) {
45 *--sp = *--args;
46 }
47
48 res = IExec->EmulateTags(code, ET_StackPtr, sp, TAG_END);
49 IExec->FreeVec(stack);
50 }
51
52 va_end(vargs);
53
54 return res;
55 }
56
57 void _68k_startelementhandler(void *userdata, const char *name, const char **attrs) {
58 M68kXML_Parser p = userdata;
59 call_68k_code(p->IExec, p->startelementhandler, 3, p->handlerarg, name, attrs);
60 }
61
62 void _68k_endelementhandler(void *userdata, const char *name) {
63 M68kXML_Parser p = userdata;
64 call_68k_code(p->IExec, p->endelementhandler, 2, p->handlerarg, name);
65 }
66
67 void _68k_chardatahandler(void *userdata, const char *s, int len) {
68 M68kXML_Parser p = userdata;
69 call_68k_code(p->IExec, p->chardatahandler, 3, p->handlerarg, s, len);
70 }
71
72 void _68k_procinsthandler(void *userdata, const char *target, const char *data) {
73 M68kXML_Parser p = userdata;
74 call_68k_code(p->IExec, p->procinsthandler, 3, p->handlerarg, target, data);
75 }
76
77 void _68k_commenthandler(void *userdata, const char *data) {
78 M68kXML_Parser p = userdata;
79 call_68k_code(p->IExec, p->commenthandler, 2, p->handlerarg, data);
80 }
81
82 void _68k_startcdatahandler(void *userdata) {
83 M68kXML_Parser p = userdata;
84 call_68k_code(p->IExec, p->startcdatahandler, 1, p->handlerarg);
85 }
86
87 void _68k_endcdatahandler(void *userdata) {
88 M68kXML_Parser p = userdata;
89 call_68k_code(p->IExec, p->endcdatahandler, 1, p->handlerarg);
90 }
91
92 void _68k_defaulthandler(void *userdata, const char *s, int len) {
93 M68kXML_Parser p = userdata;
94 call_68k_code(p->IExec, p->defaulthandler, 3, p->handlerarg, s, len);
95 }
96
97 void _68k_defaulthandlerexp(void *userdata, const char *s, int len) {
98 M68kXML_Parser p = userdata;
99 call_68k_code(p->IExec, p->defaulthandlerexp, 3, p->handlerarg, s, len);
100 }
101
102 int _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base,
103 const char *sysid, const char *pubid)
104 {
105 M68kXML_Parser p = XML_GetUserData(parser);
106 void *arg = p->extenthandlerarg;
107 return (int)call_68k_code(p->IExec, p->extentrefhandler, 5, arg ? arg : p, context, base, sysid, pubid);
108 }
109
110 int _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info) {
111 M68kXML_Parser p = enchandlerdata;
112 return (int)call_68k_code(p->IExec, p->unknownenchandler, 3, p->enchandlerarg, name, info);
113 }
114
115 void _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri) {
116 M68kXML_Parser p = userdata;
117 call_68k_code(p->IExec, p->startnamespacehandler, 3, p->handlerarg, prefix, uri);
118 }
119
120 void _68k_endnamespacehandler(void *userdata, const char *prefix) {
121 M68kXML_Parser p = userdata;
122 call_68k_code(p->IExec, p->endnamespacehandler, 2, p->handlerarg, prefix);
123 }
124
125 void _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone) {
126 M68kXML_Parser p = userdata;
127 call_68k_code(p->IExec, p->xmldeclhandler, 4, p->handlerarg, version, encoding, standalone);
128 }
129
130 void _68k_startdoctypehandler(void *userdata, const char *doctypename,
131 const char *sysid, const char *pubid, int has_internal_subset)
132 {
133 M68kXML_Parser p = userdata;
134 call_68k_code(p->IExec, p->startdoctypehandler, 5, p->handlerarg, doctypename, sysid, pubid, has_internal_subset);
135 }
136
137 void _68k_enddoctypehandler(void *userdata) {
138 M68kXML_Parser p = userdata;
139 call_68k_code(p->IExec, p->enddoctypehandler, 1, p->handlerarg);
140 }
141
142 void _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model) {
143 M68kXML_Parser p = userdata;
144 call_68k_code(p->IExec, p->elementdeclhandler, 3, p->handlerarg, name, model);
145 }
146
147 void _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname,
148 const char *att_type, const char *dflt, int isrequired)
149 {
150 M68kXML_Parser p = userdata;
151 call_68k_code(p->IExec, p->attlistdeclhandler, 6, p->handlerarg, elname, attname, att_type, dflt, isrequired);
152 }
153
154 void _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity,
155 const char *value, int value_length, const char *base, const char *sysid, const char *pubid,
156 const char *notationname)
157 {
158 M68kXML_Parser p = userdata;
159 call_68k_code(p->IExec, p->entitydeclhandler, 9, p->handlerarg, entityname, is_param_entity,
160 value, value_length, base, sysid, pubid, notationname);
161 }
162
163 void _68k_unparseddeclhandler(void *userdata, const char *entityname, const char *base,
164 const char *sysid, const char *pubid, const char *notationname)
165 {
166 M68kXML_Parser p = userdata;
167 call_68k_code(p->IExec, p->unparseddeclhandler, 6, p->handlerarg, entityname, base, sysid, pubid, notationname);
168 }
169
170 void _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base,
171 const char *sysid, const char *pubid)
172 {
173 M68kXML_Parser p = userdata;
174 call_68k_code(p->IExec, p->notationdeclhandler, 5, p->handlerarg, notationname, base, sysid, pubid);
175 }
176
177 int _68k_notstandalonehandler(void *userdata) {
178 M68kXML_Parser p = userdata;
179 return (int)call_68k_code(p->IExec, p->notstandalonehandler, 1, p->handlerarg);
180 }
181
182 void _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity) {
183 M68kXML_Parser p = userdata;
184 call_68k_code(p->IExec, p->skippedentityhandler, 3, p->handlerarg, entityname, is_param_entity);
185 }