aboutsummaryrefslogtreecommitdiffstats
path: root/os400/libxmlrpg/xmlIO.rpgle
blob: 261b0e22a05380736af6a95563c534f249aa2089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
      * Summary: interface for the I/O interfaces used by the parser
      * Description: interface for the I/O interfaces used by the parser
      *
      * Copy: See Copyright for the status of this software.
      *
      * Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.

      /if not defined(XML_IO_H__)
      /define XML_IO_H__

      /include "libxmlrpg/xmlversion"
      /include "libxmlrpg/xmlTypesC"

      * Those are the functions and datatypes for the parser input
      * I/O structures.

      * xmlInputMatchCallback:
      * @filename: the filename or URI
      *
      * Callback used in the I/O Input API to detect if the current handler
      * can provide input fonctionnalities for this resource.
      *
      * Returns 1 if yes and 0 if another Input module should be used

     d xmlInputMatchCallback...
     d                 s               *   based(######typedef######)
     d                                     procptr

      * xmlInputOpenCallback:
      * @filename: the filename or URI
      *
      * Callback used in the I/O Input API to open the resource
      *
      * Returns an Input context or NULL in case or error

     d xmlInputOpenCallback...
     d                 s               *   based(######typedef######)
     d                                     procptr

      * xmlInputReadCallback:
      * @context:  an Input context
      * @buffer:  the buffer to store data read
      * @len:  the length of the buffer in bytes
      *
      * Callback used in the I/O Input API to read the resource
      *
      * Returns the number of bytes read or -1 in case of error

     d xmlInputReadCallback...
     d                 s               *   based(######typedef######)
     d                                     procptr

      * xmlInputCloseCallback:
      * @context:  an Input context
      *
      * Callback used in the I/O Input API to close the resource
      *
      * Returns 0 or -1 in case of error

     d xmlInputCloseCallback...
     d                 s               *   based(######typedef######)
     d                                     procptr

      /if defined(LIBXML_OUTPUT_ENABLED)

      * Those are the functions and datatypes for the library output
      * I/O structures.

      * xmlOutputMatchCallback:
      * @filename: the filename or URI
      *
      * Callback used in the I/O Output API to detect if the current handler
      * can provide output fonctionnalities for this resource.
      *
      * Returns 1 if yes and 0 if another Output module should be used

     d xmlOutputMatchCallback...
     d                 s               *   based(######typedef######)
     d                                     procptr

      * xmlOutputOpenCallback:
      * @filename: the filename or URI
      *
      * Callback used in the I/O Output API to open the resource
      *
      * Returns an Output context or NULL in case or error

     d xmlOutputOpenCallback...
     d                 s               *   based(######typedef######)
     d                                     procptr

      * xmlOutputWriteCallback:
      * @context:  an Output context
      * @buffer:  the buffer of data to write
      * @len:  the length of the buffer in bytes
      *
      * Callback used in the I/O Output API to write to the resource
      *
      * Returns the number of bytes written or -1 in case of error

     d xmlOutputWriteCallback...
     d                 s               *   based(######typedef######)
     d                                     procptr

      * xmlOutputCloseCallback:
      * @context:  an Output context
      *
      * Callback used in the I/O Output API to close the resource
      *
      * Returns 0 or -1 in case of error

     d xmlOutputCloseCallback...
     d                 s               *   based(######typedef######)
     d                                     procptr
      /endif                                                                    LIBXML_OUTPUT_ENABLD

      /include "libxmlrpg/globals"
      /include "libxmlrpg/tree"
      /include "libxmlrpg/parser"
      /include "libxmlrpg/encoding"

     d xmlParserInputBuffer...
     d                 ds                  based(xmlParserInputBufferPtr)
     d                                     align qualified
     d  context                        *                                        void *
     d  readcallback                       like(xmlInputReadCallback)
     d  closecallback                      like(xmlInputCloseCallback)
      *
     d  encoder                            like(xmlCharEncodingHandlerPtr)      Conversions --> UTF8
      *
     d  buffer                             like(xmlBufPtr)                      UTF-8 local buffer
     d  raw                                like(xmlBufPtr)                      Raw input buffer
     d  compressed                   10i 0
     d  error                        10i 0
     d  rawconsumed                        like(xmlCulong)

      /if defined(LIBXML_OUTPUT_ENABLED)
     d xmlOutputBuffer...
     d                 ds                  based(xmlOutputBufferPtr)
     d                                     align qualified
     d  context                        *                                        void *
     d  writecallback                      like(xmlOutputWriteCallback)
     d  closecallback                      like(xmlOutputCloseCallback)
      *
     d  encoder                            like(xmlCharEncodingHandlerPtr)      Conversions --> UTF8
      *
     d  buffer                             like(xmlBufPtr)                      UTF-8/ISOLatin local
     d  conv                               like(xmlBufPtr)                      Buffer for output
     d  written                      10i 0                                      Total # byte written
     d  error                        10i 0
      /endif                                                                    LIBXML_OUTPUT_ENABLD

      * Interfaces for input

     d xmlCleanupInputCallbacks...
     d                 pr                  extproc('xmlCleanupInputCallbacks')

     d xmlPopInputCallbacks...
     d                 pr            10i 0 extproc('xmlPopInputCallbacks')

     d xmlRegisterDefaultInputCallbacks...
     d                 pr                  extproc(
     d                                      'xmlRegisterDefaultInputCallbacks')

     d xmlAllocParserInputBuffer...
     d                 pr                  extproc('xmlAllocParserInputBuffer')
     d                                     like(xmlParserInputBufferPtr)
     d  enc                                value like(xmlCharEncoding)

     d xmlParserInputBufferCreateFilename...
     d                 pr                  extproc(
     d                                     'xmlParserInputBufferCreateFilename')
     d                                     like(xmlParserInputBufferPtr)
     d  URI                            *   value options(*string)               const char *
     d  enc                                value like(xmlCharEncoding)

     d xmlParserInputBufferCreateFile...
     d                 pr                  extproc(
     d                                      'xmlParserInputBufferCreateFile')
     d                                     like(xmlParserInputBufferPtr)
     d  file                           *   value                                FILE *
     d  enc                                value like(xmlCharEncoding)

     d xmlParserInputBufferCreateFd...
     d                 pr                  extproc(
     d                                      'xmlParserInputBufferCreateFd')
     d                                     like(xmlParserInputBufferPtr)
     d  fd                           10i 0 value
     d  enc                                value like(xmlCharEncoding)

     d xmlParserInputBufferCreateMem...
     d                 pr                  extproc(
     d                                      'xmlParserInputBufferCreateMem')
     d                                     like(xmlParserInputBufferPtr)
     d  mem                            *   value options(*string)               const char *
     d  size                         10i 0 value
     d  enc                                value like(xmlCharEncoding)

     d xmlParserInputBufferCreateStatic...
     d                 pr                  extproc(
     d                                      'xmlParserInputBufferCreateStatic')
     d                                     like(xmlParserInputBufferPtr)
     d  mem                            *   value options(*string)               const char *
     d  size                         10i 0 value
     d  enc                                value like(xmlCharEncoding)

     d xmlParserInputBufferCreateIO...
     d                 pr                  extproc(
     d                                      'xmlParserInputBufferCreateIO')
     d                                     like(xmlParserInputBufferPtr)
     d  ioread                             value like(xmlInputReadCallback)
     d  ioclose                            value like(xmlInputCloseCallback)
     d  ioctx                          *   value                                void *
     d  enc                                value like(xmlCharEncoding)

     d xmlParserInputBufferRead...
     d                 pr            10i 0 extproc('xmlParserInputBufferRead')
     d  in                                 value like(xmlParserInputBufferPtr)
     d  len                          10i 0 value

     d xmlParserInputBufferGrow...
     d                 pr            10i 0 extproc('xmlParserInputBufferGrow')
     d  in                                 value like(xmlParserInputBufferPtr)
     d  len                          10i 0 value

     d xmlParserInputBufferPush...
     d                 pr            10i 0 extproc('xmlParserInputBufferPush')
     d  in                                 value like(xmlParserInputBufferPtr)
     d  len                          10i 0 value
     d  buf                            *   value options(*string)               const char *

     d xmlFreeParserInputBuffer...
     d                 pr                  extproc('xmlFreeParserInputBuffer')
     d  in                                 value like(xmlParserInputBufferPtr)

     d xmlParserGetDirectory...
     d                 pr              *   extproc('xmlParserGetDirectory')     char *
     d  filename                       *   value options(*string)               const char *

     d xmlRegisterInputCallbacks...
     d                 pr            10i 0 extproc('xmlRegisterInputCallbacks')
     d  matchFunc                          value like(xmlInputMatchCallback)
     d  openFunc                           value like(xmlInputOpenCallback)
     d  readFunc                           value like(xmlInputReadCallback)
     d  closeFunc                          value like(xmlInputCloseCallback)

      /if defined(LIBXML_OUTPUT_ENABLED)

      * Interfaces for output

     d xmlCleanupOutputCallbacks...
     d                 pr                  extproc('xmlCleanupOutputCallbacks')

     d xmlRegisterDefaultOutputCallbacks...
     d                 pr                  extproc(
     d                                      'xmlRegisterDefaultOuputCallbacks')

     d xmlAllocOutputBuffer...
     d                 pr                  extproc('xmlAllocOutputBuffer')
     d                                     like(xmlOutputBufferPtr)
     d  encoder                            value
     d                                     like(xmlCharEncodingHandlerPtr)

     d xmlOutputBufferCreateFilename...
     d                 pr                  extproc(
     d                                      'xmlOutputBufferCreateFilename')
     d                                     like(xmlOutputBufferPtr)
     d  URI                            *   value options(*string)               const char *
     d  encoder                            value
     d                                     like(xmlCharEncodingHandlerPtr)
     d  compression                  10i 0 value

     d xmlOutputBufferCreateFile...
     d                 pr                  extproc('xmlOutputBufferCreateFile')
     d                                     like(xmlOutputBufferPtr)
     d  file                           *   value                                FILE *
     d  encoder                            value
     d                                     like(xmlCharEncodingHandlerPtr)

     d xmlOutputBufferCreateBuffer...
     d                 pr                  extproc(
     d                                      'xmlOutputBufferCreateBuffer')
     d                                     like(xmlOutputBufferPtr)
     d  buffer                             value like(xmlBufferPtr)
     d  encoder                            value
     d                                     like(xmlCharEncodingHandlerPtr)

     d xmlOutputBufferCreateFd...
     d                 pr                  extproc('xmlOutputBufferCreateFd')
     d                                     like(xmlOutputBufferPtr)
     d  fd                           10i 0 value
     d  encoder                            value
     d                                     like(xmlCharEncodingHandlerPtr)

     d xmlOutputBufferCreateIO...
     d                 pr                  extproc('xmlOutputBufferCreateIO')
     d                                     like(xmlOutputBufferPtr)
     d  iowrite                            value like(xmlOutputWriteCallback)
     d  ioclose                            value like(xmlOutputCloseCallback)
     d  ioctx                          *   value                                void *
     d  encoder                            value
     d                                     like(xmlCharEncodingHandlerPtr)

      * Couple of APIs to get the output without digging into the buffers

     d xmlOutputBufferGetContent...
     d                 pr              *   extproc('xmlOutputBufferGetContent') const xmlChar *
     d  out                                value like(xmlOutputBufferPtr)

     d xmlOutputBufferGetSize...
     d                 pr                  extproc('xmlOutputBufferGetSize')
     d                                     like(xmlCsize_t)
     d  out                                value like(xmlOutputBufferPtr)

     d xmlOutputBufferWrite...
     d                 pr            10i 0 extproc('xmlOutputBufferWrite')
     d  out                                value like(xmlOutputBufferPtr)
     d  len                          10i 0 value
     d  buf                            *   value options(*string)               const char *

     d xmlOutputBufferWriteString...
     d                 pr            10i 0 extproc('xmlOutputBufferWriteString')
     d  out                                value like(xmlOutputBufferPtr)
     d  str                            *   value options(*string)               const char *

     d xmlOutputBufferWriteEscape...
     d                 pr            10i 0 extproc('xmlOutputBufferWriteEscape')
     d  out                                value like(xmlOutputBufferPtr)
     d  str                            *   value options(*string)               const xmlChar *
     d  escaping                           value like(xmlCharEncodingOutputFunc)

     d xmlOutputBufferFlush...
     d                 pr            10i 0 extproc('xmlOutputBufferFlush')
     d  out                                value like(xmlOutputBufferPtr)

     d xmlOutputBufferClose...
     d                 pr            10i 0 extproc('xmlOutputBufferClose')
     d  out                                value like(xmlOutputBufferPtr)

     d xmlRegisterOutputCallbacks...
     d                 pr            10i 0 extproc('xmlRegisterOutputCallbacks')
     d  matchFunc                          value like(xmlOutputMatchCallback)
     d  openFunc                           value like(xmlOutputOpenCallback)
     d  writeFunc                          value like(xmlOutputWriteCallback)
     d  closeFunc                          value like(xmlOutputCloseCallback)

      /if defined(LIBXML_HTTP_ENABLED)

      *  This function only exists if HTTP support built into the library

     d xmlRegisterHTTPPostCallbacks...
     d                 pr                  extproc(
     d                                      'xmlRegisterHTTPPostCallbacks')

      /endif                                                                    LIBXML_HTTP_ENABLED
      /endif                                                                    LIBXML_OUTPUT_ENABLD

     d xmlCheckHTTPInput...
     d                 pr                  extproc('xmlCheckHTTPInput')
     d                                     like(xmlParserInputPtr)
     d  ctxt                               value like(xmlParserCtxtPtr)
     d  ret                                value like(xmlParserInputPtr)

      * A predefined entity loader disabling network accesses

     d xmlNoNetExternalEntityLoader...
     d                 pr                  extproc(
     d                                      'xmlNoNetExternalEntityLoader')
     d                                     like(xmlParserInputPtr)
     d  URL                            *   value options(*string)               const char *
     d  ID                             *   value options(*string)               const char *
     d  ctxt                               value like(xmlParserCtxtPtr)

      * xmlNormalizeWindowsPath is obsolete, don't use it.
      * Check xmlCanonicPath in uri.h for a better alternative.

     d xmlNormalizeWindowsPath...
     d                 pr              *   extproc('xmlNormalizeWindowsPath')   xmlChar *
     d  path                           *   value options(*string)               const xmlChar *

     d xmlCheckFilename...
     d                 pr            10i 0 extproc('xmlCheckFilename')
     d  path                           *   value options(*string)               const char *

      * Default 'file://' protocol callbacks

     d xmlFileMatch    pr            10i 0 extproc('xmlFileMatch')
     d  filename                       *   value options(*string)               const char *

     d xmlFileOpen     pr              *   extproc('xmlFileOpen')               void *
     d  filename                       *   value options(*string)               const char *

     d xmlFileRead     pr            10i 0 extproc('xmlFileRead')
     d  context                        *   value                                void *
     d  buffer                    65535    options(*varsize)
     d  len                          10i 0 value

     d xmlFileClose    pr            10i 0 extproc('xmlFileClose')
     d  context                        *   value                                void *

      * Default 'http://' protocol callbacks

      /if defined(LIBXML_HTTP_ENABLED)
     d xmlIOHTTPMatch  pr            10i 0 extproc('xmlIOHTTPMatch')
     d  filename                       *   value options(*string)               const char *

     d xmlIOHTTPOpen   pr              *   extproc('xmlIOHTTPOpen')             void *
     d  filename                       *   value options(*string)               const char *

      /if defined(LIBXML_OUTPUT_ENABLED)
     d xmlIOHTTPOpenW  pr              *   extproc('xmlIOHTTPOpenW')            void *
     d  post_uri                       *   value options(*string)               const char *
     d  compression                  10i 0 value
      /endif                                                                    LIBXML_OUTPUT_ENABLD

     d xmlIOHTTPRead   pr            10i 0 extproc('xmlIOHTTPRead')
     d  context                        *   value                                void *
     d  buffer                    65535    options(*varsize)
     d  len                          10i 0 value

     d xmlIOHTTPClose  pr            10i 0 extproc('xmlIOHTTPClose')
     d  context                        *   value                                void *
      /endif                                                                    LIBXML_HTTP_ENABLED

      * Default 'ftp://' protocol callbacks

      /if defined(LIBXML_FTP_ENABLED)
     d xmlIOFTPMatch   pr            10i 0 extproc('xmlIOFTPMatch')
     d  filename                       *   value options(*string)               const char *

     d xmlIOFTPOpen    pr              *   extproc('xmlIOFTPOpen')              void *
     d  filename                       *   value options(*string)               const char *

     d xmlIOFTPRead    pr            10i 0 extproc('xmlIOFTPRead')
     d  context                        *   value                                void *
     d  buffer                    65535    options(*varsize)
     d  len                          10i 0 value

     d xmlIOFTPClose   pr            10i 0 extproc('xmlIOFTPClose')
     d  context                        *   value                                void *
      /endif                                                                    LIBXML_FTP_ENABLED

      /endif                                                                    XML_IO_H__