VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/os400/rpgsupport.c@ 105420

Last change on this file since 105420 was 105420, checked in by vboxsync, 4 months ago

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

  • Property svn:eol-style set to native
File size: 5.3 KB
Line 
1/**
2*** Additional procedures for ILE/RPG support.
3***
4*** See Copyright for the status of this software.
5***
6*** Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
7**/
8
9#include <sys/types.h>
10
11#include <stdarg.h>
12
13#include "libxml/xmlmemory.h"
14#include "libxml/xpath.h"
15#include "libxml/parser.h"
16#include "libxml/HTMLparser.h"
17
18#include "rpgsupport.h"
19
20
21/**
22*** ILE/RPG cannot directly dereference a pointer and has no macros.
23*** The following additional procedures supply these functions.
24*** In addition, the following code is adjusted for threads control at
25*** compile time via the C macros.
26**/
27
28#define THREADED_VAR(name, type) \
29 type __get_##name(void) { return name; } \
30 void __set_##name(type arg) { name = arg; }
31
32
33THREADED_VAR(xmlFree, xmlFreeFunc)
34
35void
36__call_xmlFree(void * mem)
37
38{
39 xmlFree(mem);
40}
41
42
43THREADED_VAR(xmlMalloc, xmlMallocFunc)
44
45void *
46__call_xmlMalloc(size_t size)
47
48{
49 return xmlMalloc(size);
50}
51
52
53THREADED_VAR(xmlMallocAtomic, xmlMallocFunc)
54
55void *
56__call_xmlMallocAtomic(size_t size)
57
58{
59 return xmlMallocAtomic(size);
60}
61
62
63THREADED_VAR(xmlRealloc, xmlReallocFunc)
64
65void *
66__call_xmlRealloc(void * mem, size_t size)
67
68{
69 return xmlRealloc(mem, size);
70}
71
72
73THREADED_VAR(xmlMemStrdup, xmlStrdupFunc)
74
75char *
76__call_xmlMemStrdup(const char * str)
77
78{
79 return xmlMemStrdup(str);
80}
81
82
83#ifdef LIBXML_DOCB_ENABLED
84THREADED_VAR(docbDefaultSAXHandler, xmlSAXHandlerV1)
85#endif
86
87
88#ifdef LIBXML_HTML_ENABLED
89THREADED_VAR(htmlDefaultSAXHandler, xmlSAXHandlerV1)
90#endif
91
92
93THREADED_VAR(xmlLastError, xmlError)
94
95THREADED_VAR(oldXMLWDcompatibility, int)
96THREADED_VAR(xmlBufferAllocScheme, xmlBufferAllocationScheme)
97THREADED_VAR(xmlDefaultBufferSize, int)
98THREADED_VAR(xmlDefaultSAXHandler, xmlSAXHandlerV1)
99THREADED_VAR(xmlDefaultSAXLocator, xmlSAXLocator)
100THREADED_VAR(xmlDoValidityCheckingDefaultValue, int)
101
102/* No caller to xmlGenericError() because the argument list is unknown. */
103THREADED_VAR(xmlGenericError, xmlGenericErrorFunc)
104
105
106THREADED_VAR(xmlStructuredError, xmlStructuredErrorFunc)
107
108void
109__call_xmlStructuredError(void * userData, xmlErrorPtr error)
110
111{
112 xmlStructuredError(userData, error);
113}
114
115THREADED_VAR(xmlGenericErrorContext, void *)
116THREADED_VAR(xmlStructuredErrorContext, void *)
117THREADED_VAR(xmlGetWarningsDefaultValue, int)
118THREADED_VAR(xmlIndentTreeOutput, int)
119THREADED_VAR(xmlTreeIndentString, const char *)
120THREADED_VAR(xmlKeepBlanksDefaultValue, int)
121THREADED_VAR(xmlLineNumbersDefaultValue, int)
122THREADED_VAR(xmlLoadExtDtdDefaultValue, int)
123THREADED_VAR(xmlParserDebugEntities, int)
124THREADED_VAR(xmlParserVersion, const char *)
125THREADED_VAR(xmlPedanticParserDefaultValue, int)
126THREADED_VAR(xmlSaveNoEmptyTags, int)
127THREADED_VAR(xmlSubstituteEntitiesDefaultValue, int)
128
129
130THREADED_VAR(xmlRegisterNodeDefaultValue, xmlRegisterNodeFunc)
131
132void
133__call_xmlRegisterNodeDefaultValue(xmlNodePtr node)
134
135{
136 xmlRegisterNodeDefaultValue(node);
137}
138
139
140THREADED_VAR(xmlDeregisterNodeDefaultValue, xmlDeregisterNodeFunc)
141
142void
143__call_xmlDeregisterNodeDefaultValue(xmlNodePtr node)
144
145{
146 xmlDeregisterNodeDefaultValue(node);
147}
148
149
150THREADED_VAR(xmlParserInputBufferCreateFilenameValue, xmlParserInputBufferCreateFilenameFunc)
151
152xmlParserInputBufferPtr
153__call_xmlParserInputBufferCreateFilenameValue(const char *URI,
154 xmlCharEncoding enc)
155
156{
157 return xmlParserInputBufferCreateFilenameValue(URI, enc);
158}
159
160
161THREADED_VAR(xmlOutputBufferCreateFilenameValue, xmlOutputBufferCreateFilenameFunc)
162
163xmlOutputBufferPtr
164__call_xmlOutputBufferCreateFilenameValue(const char *URI,
165 xmlCharEncodingHandlerPtr encoder, int compression)
166
167{
168 return xmlOutputBufferCreateFilenameValue(URI, encoder, compression);
169}
170
171
172
173/**
174*** va_list support.
175**/
176
177void
178__xmlVaStart(char * * list, char * lastargaddr, size_t lastargsize)
179
180{
181 list[1] = lastargaddr + lastargsize;
182}
183
184
185void *
186__xmlVaArg(char * * list, void * dest, size_t argsize)
187
188{
189 size_t align;
190
191 if (!argsize)
192 return (void *) NULL;
193
194 for (align = 16; align > argsize; align >>= 1)
195 ;
196
197 align--;
198 list[0] = list[1] + (align - (((size_t) list[0] - 1) & align));
199 list[1] = list[0] + argsize;
200
201 if (dest)
202 memcpy(dest, list[0], argsize);
203
204 return (void *) list[0];
205}
206
207
208void
209__xmlVaEnd(char * * list)
210
211{
212 /* Nothing to do. */
213}
214
215
216#ifdef LIBXML_XPATH_ENABLED
217
218int
219__xmlXPathNodeSetGetLength(const xmlNodeSet * ns)
220
221{
222 return xmlXPathNodeSetGetLength(ns);
223}
224
225
226xmlNodePtr
227__xmlXPathNodeSetItem(const xmlNodeSet * ns, int index)
228
229{
230 return xmlXPathNodeSetItem(ns, index);
231}
232
233
234int
235__xmlXPathNodeSetIsEmpty(const xmlNodeSet * ns)
236
237{
238 return xmlXPathNodeSetIsEmpty(ns);
239}
240
241#endif
242
243
244#ifdef LIBXML_HTML_ENABLED
245
246const char *
247__htmlDefaultSubelement(const htmlElemDesc * elt)
248
249{
250 return htmlDefaultSubelement(elt);
251}
252
253
254int
255__htmlElementAllowedHereDesc(const htmlElemDesc * parent,
256 const htmlElemDesc * elt)
257
258{
259 return htmlElementAllowedHereDesc(parent, elt);
260}
261
262
263const char * *
264__htmlRequiredAttrs(const htmlElemDesc * elt)
265
266{
267 return htmlRequiredAttrs(elt);
268}
269
270#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette