Home | History | Annotate | Download | only in libxmlrpg
      1       * Summary: interface for the I/O interfaces used by the parser
      2       * Description: interface for the I/O interfaces used by the parser
      3       *
      4       * Copy: See Copyright for the status of this software.
      5       *
      6       * Author: Patrick Monnerat <pm (a] datasphere.ch>, DATASPHERE S.A.
      7 
      8       /if not defined(XML_IO_H__)
      9       /define XML_IO_H__
     10 
     11       /include "libxmlrpg/xmlversion"
     12       /include "libxmlrpg/xmlTypesC"
     13 
     14       * Those are the functions and datatypes for the parser input
     15       * I/O structures.
     16 
     17       * xmlInputMatchCallback:
     18       * @filename: the filename or URI
     19       *
     20       * Callback used in the I/O Input API to detect if the current handler
     21       * can provide input fonctionnalities for this resource.
     22       *
     23       * Returns 1 if yes and 0 if another Input module should be used
     24 
     25      d xmlInputMatchCallback...
     26      d                 s               *   based(######typedef######)
     27      d                                     procptr
     28 
     29       * xmlInputOpenCallback:
     30       * @filename: the filename or URI
     31       *
     32       * Callback used in the I/O Input API to open the resource
     33       *
     34       * Returns an Input context or NULL in case or error
     35 
     36      d xmlInputOpenCallback...
     37      d                 s               *   based(######typedef######)
     38      d                                     procptr
     39 
     40       * xmlInputReadCallback:
     41       * @context:  an Input context
     42       * @buffer:  the buffer to store data read
     43       * @len:  the length of the buffer in bytes
     44       *
     45       * Callback used in the I/O Input API to read the resource
     46       *
     47       * Returns the number of bytes read or -1 in case of error
     48 
     49      d xmlInputReadCallback...
     50      d                 s               *   based(######typedef######)
     51      d                                     procptr
     52 
     53       * xmlInputCloseCallback:
     54       * @context:  an Input context
     55       *
     56       * Callback used in the I/O Input API to close the resource
     57       *
     58       * Returns 0 or -1 in case of error
     59 
     60      d xmlInputCloseCallback...
     61      d                 s               *   based(######typedef######)
     62      d                                     procptr
     63 
     64       /if defined(LIBXML_OUTPUT_ENABLED)
     65 
     66       * Those are the functions and datatypes for the library output
     67       * I/O structures.
     68 
     69       * xmlOutputMatchCallback:
     70       * @filename: the filename or URI
     71       *
     72       * Callback used in the I/O Output API to detect if the current handler
     73       * can provide output fonctionnalities for this resource.
     74       *
     75       * Returns 1 if yes and 0 if another Output module should be used
     76 
     77      d xmlOutputMatchCallback...
     78      d                 s               *   based(######typedef######)
     79      d                                     procptr
     80 
     81       * xmlOutputOpenCallback:
     82       * @filename: the filename or URI
     83       *
     84       * Callback used in the I/O Output API to open the resource
     85       *
     86       * Returns an Output context or NULL in case or error
     87 
     88      d xmlOutputOpenCallback...
     89      d                 s               *   based(######typedef######)
     90      d                                     procptr
     91 
     92       * xmlOutputWriteCallback:
     93       * @context:  an Output context
     94       * @buffer:  the buffer of data to write
     95       * @len:  the length of the buffer in bytes
     96       *
     97       * Callback used in the I/O Output API to write to the resource
     98       *
     99       * Returns the number of bytes written or -1 in case of error
    100 
    101      d xmlOutputWriteCallback...
    102      d                 s               *   based(######typedef######)
    103      d                                     procptr
    104 
    105       * xmlOutputCloseCallback:
    106       * @context:  an Output context
    107       *
    108       * Callback used in the I/O Output API to close the resource
    109       *
    110       * Returns 0 or -1 in case of error
    111 
    112      d xmlOutputCloseCallback...
    113      d                 s               *   based(######typedef######)
    114      d                                     procptr
    115       /endif                                                                    LIBXML_OUTPUT_ENABLD
    116 
    117       /include "libxmlrpg/globals"
    118       /include "libxmlrpg/tree"
    119       /include "libxmlrpg/parser"
    120       /include "libxmlrpg/encoding"
    121 
    122      d xmlParserInputBuffer...
    123      d                 ds                  based(xmlParserInputBufferPtr)
    124      d                                     align qualified
    125      d  context                        *                                        void *
    126      d  readcallback                       like(xmlInputReadCallback)
    127      d  closecallback                      like(xmlInputCloseCallback)
    128       *
    129      d  encoder                            like(xmlCharEncodingHandlerPtr)      Conversions --> UTF8
    130       *
    131      d  buffer                             like(xmlBufPtr)                      UTF-8 local buffer
    132      d  raw                                like(xmlBufPtr)                      Raw input buffer
    133      d  compressed                   10i 0
    134      d  error                        10i 0
    135      d  rawconsumed                        like(xmlCulong)
    136 
    137       /if defined(LIBXML_OUTPUT_ENABLED)
    138      d xmlOutputBuffer...
    139      d                 ds                  based(xmlOutputBufferPtr)
    140      d                                     align qualified
    141      d  context                        *                                        void *
    142      d  writecallback                      like(xmlOutputWriteCallback)
    143      d  closecallback                      like(xmlOutputCloseCallback)
    144       *
    145      d  encoder                            like(xmlCharEncodingHandlerPtr)      Conversions --> UTF8
    146       *
    147      d  buffer                             like(xmlBufPtr)                      UTF-8/ISOLatin local
    148      d  conv                               like(xmlBufPtr)                      Buffer for output
    149      d  written                      10i 0                                      Total # byte written
    150      d  error                        10i 0
    151       /endif                                                                    LIBXML_OUTPUT_ENABLD
    152 
    153       * Interfaces for input
    154 
    155      d xmlCleanupInputCallbacks...
    156      d                 pr                  extproc('xmlCleanupInputCallbacks')
    157 
    158      d xmlPopInputCallbacks...
    159      d                 pr            10i 0 extproc('xmlPopInputCallbacks')
    160 
    161      d xmlRegisterDefaultInputCallbacks...
    162      d                 pr                  extproc(
    163      d                                      'xmlRegisterDefaultInputCallbacks')
    164 
    165      d xmlAllocParserInputBuffer...
    166      d                 pr                  extproc('xmlAllocParserInputBuffer')
    167      d                                     like(xmlParserInputBufferPtr)
    168      d  enc                                value like(xmlCharEncoding)
    169 
    170      d xmlParserInputBufferCreateFilename...
    171      d                 pr                  extproc(
    172      d                                     'xmlParserInputBufferCreateFilename')
    173      d                                     like(xmlParserInputBufferPtr)
    174      d  URI                            *   value options(*string)               const char *
    175      d  enc                                value like(xmlCharEncoding)
    176 
    177      d xmlParserInputBufferCreateFile...
    178      d                 pr                  extproc(
    179      d                                      'xmlParserInputBufferCreateFile')
    180      d                                     like(xmlParserInputBufferPtr)
    181      d  file                           *   value                                FILE *
    182      d  enc                                value like(xmlCharEncoding)
    183 
    184      d xmlParserInputBufferCreateFd...
    185      d                 pr                  extproc(
    186      d                                      'xmlParserInputBufferCreateFd')
    187      d                                     like(xmlParserInputBufferPtr)
    188      d  fd                           10i 0 value
    189      d  enc                                value like(xmlCharEncoding)
    190 
    191      d xmlParserInputBufferCreateMem...
    192      d                 pr                  extproc(
    193      d                                      'xmlParserInputBufferCreateMem')
    194      d                                     like(xmlParserInputBufferPtr)
    195      d  mem                            *   value options(*string)               const char *
    196      d  size                         10i 0 value
    197      d  enc                                value like(xmlCharEncoding)
    198 
    199      d xmlParserInputBufferCreateStatic...
    200      d                 pr                  extproc(
    201      d                                      'xmlParserInputBufferCreateStatic')
    202      d                                     like(xmlParserInputBufferPtr)
    203      d  mem                            *   value options(*string)               const char *
    204      d  size                         10i 0 value
    205      d  enc                                value like(xmlCharEncoding)
    206 
    207      d xmlParserInputBufferCreateIO...
    208      d                 pr                  extproc(
    209      d                                      'xmlParserInputBufferCreateIO')
    210      d                                     like(xmlParserInputBufferPtr)
    211      d  ioread                             value like(xmlInputReadCallback)
    212      d  ioclose                            value like(xmlInputCloseCallback)
    213      d  ioctx                          *   value                                void *
    214      d  enc                                value like(xmlCharEncoding)
    215 
    216      d xmlParserInputBufferRead...
    217      d                 pr            10i 0 extproc('xmlParserInputBufferRead')
    218      d  in                                 value like(xmlParserInputBufferPtr)
    219      d  len                          10i 0 value
    220 
    221      d xmlParserInputBufferGrow...
    222      d                 pr            10i 0 extproc('xmlParserInputBufferGrow')
    223      d  in                                 value like(xmlParserInputBufferPtr)
    224      d  len                          10i 0 value
    225 
    226      d xmlParserInputBufferPush...
    227      d                 pr            10i 0 extproc('xmlParserInputBufferPush')
    228      d  in                                 value like(xmlParserInputBufferPtr)
    229      d  len                          10i 0 value
    230      d  buf                            *   value options(*string)               const char *
    231 
    232      d xmlFreeParserInputBuffer...
    233      d                 pr                  extproc('xmlFreeParserInputBuffer')
    234      d  in                                 value like(xmlParserInputBufferPtr)
    235 
    236      d xmlParserGetDirectory...
    237      d                 pr              *   extproc('xmlParserGetDirectory')     char *
    238      d  filename                       *   value options(*string)               const char *
    239 
    240      d xmlRegisterInputCallbacks...
    241      d                 pr            10i 0 extproc('xmlRegisterInputCallbacks')
    242      d  matchFunc                          value like(xmlInputMatchCallback)
    243      d  openFunc                           value like(xmlInputOpenCallback)
    244      d  readFunc                           value like(xmlInputReadCallback)
    245      d  closeFunc                          value like(xmlInputCloseCallback)
    246 
    247       /if defined(LIBXML_OUTPUT_ENABLED)
    248 
    249       * Interfaces for output
    250 
    251      d xmlCleanupOutputCallbacks...
    252      d                 pr                  extproc('xmlCleanupOutputCallbacks')
    253 
    254      d xmlRegisterDefaultOutputCallbacks...
    255      d                 pr                  extproc(
    256      d                                      'xmlRegisterDefaultOuputCallbacks')
    257 
    258      d xmlAllocOutputBuffer...
    259      d                 pr                  extproc('xmlAllocOutputBuffer')
    260      d                                     like(xmlOutputBufferPtr)
    261      d  encoder                            value
    262      d                                     like(xmlCharEncodingHandlerPtr)
    263 
    264      d xmlOutputBufferCreateFilename...
    265      d                 pr                  extproc(
    266      d                                      'xmlOutputBufferCreateFilename')
    267      d                                     like(xmlOutputBufferPtr)
    268      d  URI                            *   value options(*string)               const char *
    269      d  encoder                            value
    270      d                                     like(xmlCharEncodingHandlerPtr)
    271      d  compression                  10i 0 value
    272 
    273      d xmlOutputBufferCreateFile...
    274      d                 pr                  extproc('xmlOutputBufferCreateFile')
    275      d                                     like(xmlOutputBufferPtr)
    276      d  file                           *   value                                FILE *
    277      d  encoder                            value
    278      d                                     like(xmlCharEncodingHandlerPtr)
    279 
    280      d xmlOutputBufferCreateBuffer...
    281      d                 pr                  extproc(
    282      d                                      'xmlOutputBufferCreateBuffer')
    283      d                                     like(xmlOutputBufferPtr)
    284      d  buffer                             value like(xmlBufferPtr)
    285      d  encoder                            value
    286      d                                     like(xmlCharEncodingHandlerPtr)
    287 
    288      d xmlOutputBufferCreateFd...
    289      d                 pr                  extproc('xmlOutputBufferCreateFd')
    290      d                                     like(xmlOutputBufferPtr)
    291      d  fd                           10i 0 value
    292      d  encoder                            value
    293      d                                     like(xmlCharEncodingHandlerPtr)
    294 
    295      d xmlOutputBufferCreateIO...
    296      d                 pr                  extproc('xmlOutputBufferCreateIO')
    297      d                                     like(xmlOutputBufferPtr)
    298      d  iowrite                            value like(xmlOutputWriteCallback)
    299      d  ioclose                            value like(xmlOutputCloseCallback)
    300      d  ioctx                          *   value                                void *
    301      d  encoder                            value
    302      d                                     like(xmlCharEncodingHandlerPtr)
    303 
    304       * Couple of APIs to get the output without digging into the buffers
    305 
    306      d xmlOutputBufferGetContent...
    307      d                 pr              *   extproc('xmlOutputBufferGetContent') const xmlChar *
    308      d  out                                value like(xmlOutputBufferPtr)
    309 
    310      d xmlOutputBufferGetSize...
    311      d                 pr                  extproc('xmlOutputBufferGetSize')
    312      d                                     like(xmlCsize_t)
    313      d  out                                value like(xmlOutputBufferPtr)
    314 
    315      d xmlOutputBufferWrite...
    316      d                 pr            10i 0 extproc('xmlOutputBufferWrite')
    317      d  out                                value like(xmlOutputBufferPtr)
    318      d  len                          10i 0 value
    319      d  buf                            *   value options(*string)               const char *
    320 
    321      d xmlOutputBufferWriteString...
    322      d                 pr            10i 0 extproc('xmlOutputBufferWriteString')
    323      d  out                                value like(xmlOutputBufferPtr)
    324      d  str                            *   value options(*string)               const char *
    325 
    326      d xmlOutputBufferWriteEscape...
    327      d                 pr            10i 0 extproc('xmlOutputBufferWriteEscape')
    328      d  out                                value like(xmlOutputBufferPtr)
    329      d  str                            *   value options(*string)               const xmlChar *
    330      d  escaping                           value like(xmlCharEncodingOutputFunc)
    331 
    332      d xmlOutputBufferFlush...
    333      d                 pr            10i 0 extproc('xmlOutputBufferFlush')
    334      d  out                                value like(xmlOutputBufferPtr)
    335 
    336      d xmlOutputBufferClose...
    337      d                 pr            10i 0 extproc('xmlOutputBufferClose')
    338      d  out                                value like(xmlOutputBufferPtr)
    339 
    340      d xmlRegisterOutputCallbacks...
    341      d                 pr            10i 0 extproc('xmlRegisterOutputCallbacks')
    342      d  matchFunc                          value like(xmlOutputMatchCallback)
    343      d  openFunc                           value like(xmlOutputOpenCallback)
    344      d  writeFunc                          value like(xmlOutputWriteCallback)
    345      d  closeFunc                          value like(xmlOutputCloseCallback)
    346 
    347       /if defined(LIBXML_HTTP_ENABLED)
    348 
    349       *  This function only exists if HTTP support built into the library
    350 
    351      d xmlRegisterHTTPPostCallbacks...
    352      d                 pr                  extproc(
    353      d                                      'xmlRegisterHTTPPostCallbacks')
    354 
    355       /endif                                                                    LIBXML_HTTP_ENABLED
    356       /endif                                                                    LIBXML_OUTPUT_ENABLD
    357 
    358      d xmlCheckHTTPInput...
    359      d                 pr                  extproc('xmlCheckHTTPInput')
    360      d                                     like(xmlParserInputPtr)
    361      d  ctxt                               value like(xmlParserCtxtPtr)
    362      d  ret                                value like(xmlParserInputPtr)
    363 
    364       * A predefined entity loader disabling network accesses
    365 
    366      d xmlNoNetExternalEntityLoader...
    367      d                 pr                  extproc(
    368      d                                      'xmlNoNetExternalEntityLoader')
    369      d                                     like(xmlParserInputPtr)
    370      d  URL                            *   value options(*string)               const char *
    371      d  ID                             *   value options(*string)               const char *
    372      d  ctxt                               value like(xmlParserCtxtPtr)
    373 
    374       * xmlNormalizeWindowsPath is obsolete, don't use it.
    375       * Check xmlCanonicPath in uri.h for a better alternative.
    376 
    377      d xmlNormalizeWindowsPath...
    378      d                 pr              *   extproc('xmlNormalizeWindowsPath')   xmlChar *
    379      d  path                           *   value options(*string)               const xmlChar *
    380 
    381      d xmlCheckFilename...
    382      d                 pr            10i 0 extproc('xmlCheckFilename')
    383      d  path                           *   value options(*string)               const char *
    384 
    385       * Default 'file://' protocol callbacks
    386 
    387      d xmlFileMatch    pr            10i 0 extproc('xmlFileMatch')
    388      d  filename                       *   value options(*string)               const char *
    389 
    390      d xmlFileOpen     pr              *   extproc('xmlFileOpen')               void *
    391      d  filename                       *   value options(*string)               const char *
    392 
    393      d xmlFileRead     pr            10i 0 extproc('xmlFileRead')
    394      d  context                        *   value                                void *
    395      d  buffer                    65535    options(*varsize)
    396      d  len                          10i 0 value
    397 
    398      d xmlFileClose    pr            10i 0 extproc('xmlFileClose')
    399      d  context                        *   value                                void *
    400 
    401       * Default 'http://' protocol callbacks
    402 
    403       /if defined(LIBXML_HTTP_ENABLED)
    404      d xmlIOHTTPMatch  pr            10i 0 extproc('xmlIOHTTPMatch')
    405      d  filename                       *   value options(*string)               const char *
    406 
    407      d xmlIOHTTPOpen   pr              *   extproc('xmlIOHTTPOpen')             void *
    408      d  filename                       *   value options(*string)               const char *
    409 
    410       /if defined(LIBXML_OUTPUT_ENABLED)
    411      d xmlIOHTTPOpenW  pr              *   extproc('xmlIOHTTPOpenW')            void *
    412      d  post_uri                       *   value options(*string)               const char *
    413      d  compression                  10i 0 value
    414       /endif                                                                    LIBXML_OUTPUT_ENABLD
    415 
    416      d xmlIOHTTPRead   pr            10i 0 extproc('xmlIOHTTPRead')
    417      d  context                        *   value                                void *
    418      d  buffer                    65535    options(*varsize)
    419      d  len                          10i 0 value
    420 
    421      d xmlIOHTTPClose  pr            10i 0 extproc('xmlIOHTTPClose')
    422      d  context                        *   value                                void *
    423       /endif                                                                    LIBXML_HTTP_ENABLED
    424 
    425       * Default 'ftp://' protocol callbacks
    426 
    427       /if defined(LIBXML_FTP_ENABLED)
    428      d xmlIOFTPMatch   pr            10i 0 extproc('xmlIOFTPMatch')
    429      d  filename                       *   value options(*string)               const char *
    430 
    431      d xmlIOFTPOpen    pr              *   extproc('xmlIOFTPOpen')              void *
    432      d  filename                       *   value options(*string)               const char *
    433 
    434      d xmlIOFTPRead    pr            10i 0 extproc('xmlIOFTPRead')
    435      d  context                        *   value                                void *
    436      d  buffer                    65535    options(*varsize)
    437      d  len                          10i 0 value
    438 
    439      d xmlIOFTPClose   pr            10i 0 extproc('xmlIOFTPClose')
    440      d  context                        *   value                                void *
    441       /endif                                                                    LIBXML_FTP_ENABLED
    442 
    443       /endif                                                                    XML_IO_H__
    444