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                         like(xmlCint)
    134      d  error                              like(xmlCint)
    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                            like(xmlCint)                        Total # byte written
    150      d  error                              like(xmlCint)
    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                  extproc('xmlPopInputCallbacks')
    160      d                                     like(xmlCint)
    161 
    162      d xmlRegisterDefaultInputCallbacks...
    163      d                 pr                  extproc(
    164      d                                      'xmlRegisterDefaultInputCallbacks')
    165 
    166      d xmlAllocParserInputBuffer...
    167      d                 pr                  extproc('xmlAllocParserInputBuffer')
    168      d                                     like(xmlParserInputBufferPtr)
    169      d  enc                                value like(xmlCharEncoding)
    170 
    171      d xmlParserInputBufferCreateFilename...
    172      d                 pr                  extproc(
    173      d                                     'xmlParserInputBufferCreateFilename')
    174      d                                     like(xmlParserInputBufferPtr)
    175      d  URI                            *   value options(*string)               const char *
    176      d  enc                                value like(xmlCharEncoding)
    177 
    178      d xmlParserInputBufferCreateFile...
    179      d                 pr                  extproc(
    180      d                                      'xmlParserInputBufferCreateFile')
    181      d                                     like(xmlParserInputBufferPtr)
    182      d  file                           *   value                                FILE *
    183      d  enc                                value like(xmlCharEncoding)
    184 
    185      d xmlParserInputBufferCreateFd...
    186      d                 pr                  extproc(
    187      d                                      'xmlParserInputBufferCreateFd')
    188      d                                     like(xmlParserInputBufferPtr)
    189      d  fd                                 value like(xmlCint)
    190      d  enc                                value like(xmlCharEncoding)
    191 
    192      d xmlParserInputBufferCreateMem...
    193      d                 pr                  extproc(
    194      d                                      'xmlParserInputBufferCreateMem')
    195      d                                     like(xmlParserInputBufferPtr)
    196      d  mem                            *   value options(*string)               const char *
    197      d  size                               value like(xmlCint)
    198      d  enc                                value like(xmlCharEncoding)
    199 
    200      d xmlParserInputBufferCreateStatic...
    201      d                 pr                  extproc(
    202      d                                      'xmlParserInputBufferCreateStatic')
    203      d                                     like(xmlParserInputBufferPtr)
    204      d  mem                            *   value options(*string)               const char *
    205      d  size                               value like(xmlCint)
    206      d  enc                                value like(xmlCharEncoding)
    207 
    208      d xmlParserInputBufferCreateIO...
    209      d                 pr                  extproc(
    210      d                                      'xmlParserInputBufferCreateIO')
    211      d                                     like(xmlParserInputBufferPtr)
    212      d  ioread                             value like(xmlInputReadCallback)
    213      d  ioclose                            value like(xmlInputCloseCallback)
    214      d  ioctx                          *   value                                void *
    215      d  enc                                value like(xmlCharEncoding)
    216 
    217      d xmlParserInputBufferRead...
    218      d                 pr                  extproc('xmlParserInputBufferRead')
    219      d                                     like(xmlCint)
    220      d  in                                 value like(xmlParserInputBufferPtr)
    221      d  len                                value like(xmlCint)
    222 
    223      d xmlParserInputBufferGrow...
    224      d                 pr                  extproc('xmlParserInputBufferGrow')
    225      d                                     like(xmlCint)
    226      d  in                                 value like(xmlParserInputBufferPtr)
    227      d  len                                value like(xmlCint)
    228 
    229      d xmlParserInputBufferPush...
    230      d                 pr                  extproc('xmlParserInputBufferPush')
    231      d                                     like(xmlCint)
    232      d  in                                 value like(xmlParserInputBufferPtr)
    233      d  len                                value like(xmlCint)
    234      d  buf                            *   value options(*string)               const char *
    235 
    236      d xmlFreeParserInputBuffer...
    237      d                 pr                  extproc('xmlFreeParserInputBuffer')
    238      d  in                                 value like(xmlParserInputBufferPtr)
    239 
    240      d xmlParserGetDirectory...
    241      d                 pr              *   extproc('xmlParserGetDirectory')     char *
    242      d  filename                       *   value options(*string)               const char *
    243 
    244      d xmlRegisterInputCallbacks...
    245      d                 pr                  extproc('xmlRegisterInputCallbacks')
    246      d                                     like(xmlCint)
    247      d  matchFunc                          value like(xmlInputMatchCallback)
    248      d  openFunc                           value like(xmlInputOpenCallback)
    249      d  readFunc                           value like(xmlInputReadCallback)
    250      d  closeFunc                          value like(xmlInputCloseCallback)
    251 
    252       /if defined(LIBXML_OUTPUT_ENABLED)
    253 
    254       * Interfaces for output
    255 
    256      d xmlCleanupOutputCallbacks...
    257      d                 pr                  extproc('xmlCleanupOutputCallbacks')
    258 
    259      d xmlRegisterDefaultOutputCallbacks...
    260      d                 pr                  extproc(
    261      d                                      'xmlRegisterDefaultOuputCallbacks')
    262 
    263      d xmlAllocOutputBuffer...
    264      d                 pr                  extproc('xmlAllocOutputBuffer')
    265      d                                     like(xmlOutputBufferPtr)
    266      d  encoder                            value
    267      d                                     like(xmlCharEncodingHandlerPtr)
    268 
    269      d xmlOutputBufferCreateFilename...
    270      d                 pr                  extproc(
    271      d                                      'xmlOutputBufferCreateFilename')
    272      d                                     like(xmlOutputBufferPtr)
    273      d  URI                            *   value options(*string)               const char *
    274      d  encoder                            value
    275      d                                     like(xmlCharEncodingHandlerPtr)
    276      d  compression                        value like(xmlCint)
    277 
    278      d xmlOutputBufferCreateFile...
    279      d                 pr                  extproc('xmlOutputBufferCreateFile')
    280      d                                     like(xmlOutputBufferPtr)
    281      d  file                           *   value                                FILE *
    282      d  encoder                            value
    283      d                                     like(xmlCharEncodingHandlerPtr)
    284 
    285      d xmlOutputBufferCreateBuffer...
    286      d                 pr                  extproc(
    287      d                                      'xmlOutputBufferCreateBuffer')
    288      d                                     like(xmlOutputBufferPtr)
    289      d  buffer                             value like(xmlBufferPtr)
    290      d  encoder                            value
    291      d                                     like(xmlCharEncodingHandlerPtr)
    292 
    293      d xmlOutputBufferCreateFd...
    294      d                 pr                  extproc('xmlOutputBufferCreateFd')
    295      d                                     like(xmlOutputBufferPtr)
    296      d  fd                                 value like(xmlCint)
    297      d  encoder                            value
    298      d                                     like(xmlCharEncodingHandlerPtr)
    299 
    300      d xmlOutputBufferCreateIO...
    301      d                 pr                  extproc('xmlOutputBufferCreateIO')
    302      d                                     like(xmlOutputBufferPtr)
    303      d  iowrite                            value like(xmlOutputWriteCallback)
    304      d  ioclose                            value like(xmlOutputCloseCallback)
    305      d  ioctx                          *   value                                void *
    306      d  encoder                            value
    307      d                                     like(xmlCharEncodingHandlerPtr)
    308 
    309       * Couple of APIs to get the output without digging into the buffers
    310 
    311      d xmlOutputBufferGetContent...
    312      d                 pr              *   extproc('xmlOutputBufferGetContent') const xmlChar *
    313      d  out                                value like(xmlOutputBufferPtr)
    314 
    315      d xmlOutputBufferGetSize...
    316      d                 pr                  extproc('xmlOutputBufferGetSize')
    317      d                                     like(xmlCsize_t)
    318      d  out                                value like(xmlOutputBufferPtr)
    319 
    320      d xmlOutputBufferWrite...
    321      d                 pr                  extproc('xmlOutputBufferWrite')
    322      d                                     like(xmlCint)
    323      d  out                                value like(xmlOutputBufferPtr)
    324      d  len                                value like(xmlCint)
    325      d  buf                            *   value options(*string)               const char *
    326 
    327      d xmlOutputBufferWriteString...
    328      d                 pr                  extproc('xmlOutputBufferWriteString')
    329      d                                     like(xmlCint)
    330      d  out                                value like(xmlOutputBufferPtr)
    331      d  str                            *   value options(*string)               const char *
    332 
    333      d xmlOutputBufferWriteEscape...
    334      d                 pr                  extproc('xmlOutputBufferWriteEscape')
    335      d                                     like(xmlCint)
    336      d  out                                value like(xmlOutputBufferPtr)
    337      d  str                            *   value options(*string)               const xmlChar *
    338      d  escaping                           value like(xmlCharEncodingOutputFunc)
    339 
    340      d xmlOutputBufferFlush...
    341      d                 pr                  extproc('xmlOutputBufferFlush')
    342      d                                     like(xmlCint)
    343      d  out                                value like(xmlOutputBufferPtr)
    344 
    345      d xmlOutputBufferClose...
    346      d                 pr                  extproc('xmlOutputBufferClose')
    347      d                                     like(xmlCint)
    348      d  out                                value like(xmlOutputBufferPtr)
    349 
    350      d xmlRegisterOutputCallbacks...
    351      d                 pr                  extproc('xmlRegisterOutputCallbacks')
    352      d                                     like(xmlCint)
    353      d  matchFunc                          value like(xmlOutputMatchCallback)
    354      d  openFunc                           value like(xmlOutputOpenCallback)
    355      d  writeFunc                          value like(xmlOutputWriteCallback)
    356      d  closeFunc                          value like(xmlOutputCloseCallback)
    357 
    358       /if defined(LIBXML_HTTP_ENABLED)
    359 
    360       *  This function only exists if HTTP support built into the library
    361 
    362      d xmlRegisterHTTPPostCallbacks...
    363      d                 pr                  extproc(
    364      d                                      'xmlRegisterHTTPPostCallbacks')
    365 
    366       /endif                                                                    LIBXML_HTTP_ENABLED
    367       /endif                                                                    LIBXML_OUTPUT_ENABLD
    368 
    369      d xmlCheckHTTPInput...
    370      d                 pr                  extproc('xmlCheckHTTPInput')
    371      d                                     like(xmlParserInputPtr)
    372      d  ctxt                               value like(xmlParserCtxtPtr)
    373      d  ret                                value like(xmlParserInputPtr)
    374 
    375       * A predefined entity loader disabling network accesses
    376 
    377      d xmlNoNetExternalEntityLoader...
    378      d                 pr                  extproc(
    379      d                                      'xmlNoNetExternalEntityLoader')
    380      d                                     like(xmlParserInputPtr)
    381      d  URL                            *   value options(*string)               const char *
    382      d  ID                             *   value options(*string)               const char *
    383      d  ctxt                               value like(xmlParserCtxtPtr)
    384 
    385       * xmlNormalizeWindowsPath is obsolete, don't use it.
    386       * Check xmlCanonicPath in uri.h for a better alternative.
    387 
    388      d xmlNormalizeWindowsPath...
    389      d                 pr              *   extproc('xmlNormalizeWindowsPath')   xmlChar *
    390      d  path                           *   value options(*string)               const xmlChar *
    391 
    392      d xmlCheckFilename...
    393      d                 pr                  extproc('xmlCheckFilename')
    394      d                                     like(xmlCint)
    395      d  path                           *   value options(*string)               const char *
    396 
    397       * Default 'file://' protocol callbacks
    398 
    399      d xmlFileMatch    pr                  extproc('xmlFileMatch')
    400      d                                     like(xmlCint)
    401      d  filename                       *   value options(*string)               const char *
    402 
    403      d xmlFileOpen     pr              *   extproc('xmlFileOpen')               void *
    404      d  filename                       *   value options(*string)               const char *
    405 
    406      d xmlFileRead     pr                  extproc('xmlFileRead')
    407      d                                     like(xmlCint)
    408      d  context                        *   value                                void *
    409      d  buffer                    65535    options(*varsize)
    410      d  len                                value like(xmlCint)
    411 
    412      d xmlFileClose    pr                  extproc('xmlFileClose')
    413      d                                     like(xmlCint)
    414      d  context                        *   value                                void *
    415 
    416       * Default 'http://' protocol callbacks
    417 
    418       /if defined(LIBXML_HTTP_ENABLED)
    419      d xmlIOHTTPMatch  pr                  extproc('xmlIOHTTPMatch')
    420      d                                     like(xmlCint)
    421      d  filename                       *   value options(*string)               const char *
    422 
    423      d xmlIOHTTPOpen   pr              *   extproc('xmlIOHTTPOpen')             void *
    424      d  filename                       *   value options(*string)               const char *
    425 
    426       /if defined(LIBXML_OUTPUT_ENABLED)
    427      d xmlIOHTTPOpenW  pr              *   extproc('xmlIOHTTPOpenW')            void *
    428      d  post_uri                       *   value options(*string)               const char *
    429      d  compression                        value like(xmlCint)
    430       /endif                                                                    LIBXML_OUTPUT_ENABLD
    431 
    432      d xmlIOHTTPRead   pr                  extproc('xmlIOHTTPRead')
    433      d                                     like(xmlCint)
    434      d  context                        *   value                                void *
    435      d  buffer                    65535    options(*varsize)
    436      d  len                                value like(xmlCint)
    437 
    438      d xmlIOHTTPClose  pr                  extproc('xmlIOHTTPClose')
    439      d                                     like(xmlCint)
    440      d  context                        *   value                                void *
    441       /endif                                                                    LIBXML_HTTP_ENABLED
    442 
    443       * Default 'ftp://' protocol callbacks
    444 
    445       /if defined(LIBXML_FTP_ENABLED)
    446      d xmlIOFTPMatch   pr                  extproc('xmlIOFTPMatch')
    447      d                                     like(xmlCint)
    448      d  filename                       *   value options(*string)               const char *
    449 
    450      d xmlIOFTPOpen    pr              *   extproc('xmlIOFTPOpen')              void *
    451      d  filename                       *   value options(*string)               const char *
    452 
    453      d xmlIOFTPRead    pr                  extproc('xmlIOFTPRead')
    454      d                                     like(xmlCint)
    455      d  context                        *   value                                void *
    456      d  buffer                    65535    options(*varsize)
    457      d  len                                value like(xmlCint)
    458 
    459      d xmlIOFTPClose   pr                  extproc('xmlIOFTPClose')
    460      d                                     like(xmlCint)
    461      d  context                        *   value                                void *
    462       /endif                                                                    LIBXML_FTP_ENABLED
    463 
    464       /endif                                                                    XML_IO_H__
    465