Home | History | Annotate | Download | only in libxmlrpg
      1       * Summary: regular expressions handling
      2       * Description: basic API for libxml regular expressions handling used
      3       *              for XML Schemas and validation.
      4       *
      5       * Copy: See Copyright for the status of this software.
      6       *
      7       * Author: Patrick Monnerat <pm (a] datasphere.ch>, DATASPHERE S.A.
      8 
      9       /if not defined(XML_REGEXP_H__)
     10       /define XML_REGEXP_H__
     11 
     12       /include "libxmlrpg/xmlversion"
     13 
     14       /if defined(LIBXML_REGEXP_ENABLED)
     15 
     16       * xmlRegexpPtr:
     17       *
     18       * A libxml regular expression, they can actually be far more complex
     19       * thank the POSIX regex expressions.
     20 
     21      d xmlRegexpPtr    s               *   based(######typedef######)
     22 
     23       * xmlRegExecCtxtPtr:
     24       *
     25       * A libxml progressive regular expression evaluation context
     26 
     27      d xmlRegExecCtxtPtr...
     28      d                 s               *   based(######typedef######)
     29 
     30       /include "libxmlrpg/tree"
     31       /include "libxmlrpg/dict"
     32 
     33       * The POSIX like API
     34 
     35      d xmlRegexpCompile...
     36      d                 pr                  extproc('xmlRegexpCompile')
     37      d                                     like(xmlRegexpPtr)
     38      d  regexp                         *   value options(*string)               const xmlChar *
     39 
     40      d xmlRegFreeRegexp...
     41      d                 pr                  extproc('xmlRegFreeRegexp')
     42      d  regexp                             value like(xmlRegexpPtr)
     43 
     44      d xmlRegexpExec   pr            10i 0 extproc('xmlRegexpExec')
     45      d  comp                               value like(xmlRegexpPtr)
     46      d  value                          *   value options(*string)               const xmlChar *
     47 
     48      d xmlRegexpPrint  pr                  extproc('xmlRegexpPrint')
     49      d  output                         *   value                                FILE *
     50      d  regexp                             value like(xmlRegexpPtr)
     51 
     52      d xmlRegexpIsDeterminist...
     53      d                 pr            10i 0 extproc('xmlRegexpIsDeterminist')
     54      d  comp                               value like(xmlRegexpPtr)
     55 
     56       * xmlRegExecCallbacks:
     57       * @exec: the regular expression context
     58       * @token: the current token string
     59       * @transdata: transition data
     60       * @inputdata: input data
     61       *
     62       * Callback function when doing a transition in the automata
     63 
     64      d xmlRegExecCallbacks...
     65      d                 s               *   based(######typedef######)
     66      d                                     procptr
     67 
     68       * The progressive API
     69 
     70      d xmlRegNewExecCtxt...
     71      d                 pr                  extproc('xmlRegNewExecCtxt')
     72      d                                     like(xmlRegExecCtxtPtr)
     73      d  comp                               value like(xmlRegexpPtr)
     74      d  callback                           value like(xmlRegExecCallbacks)
     75      d  data                           *   value                                void *
     76 
     77      d xmlRegFreeExecCtxt...
     78      d                 pr                  extproc('xmlRegFreeExecCtxt')
     79      d  exec                               value like(xmlRegExecCtxtPtr)
     80 
     81      d xmlRegExecPushString...
     82      d                 pr            10i 0 extproc('xmlRegExecPushString')
     83      d  exec                               value like(xmlRegExecCtxtPtr)
     84      d  value                          *   value options(*string)               const xmlChar *
     85      d  data                           *   value                                void *
     86 
     87      d xmlRegExecPushString2...
     88      d                 pr            10i 0 extproc('xmlRegExecPushString2')
     89      d  exec                               value like(xmlRegExecCtxtPtr)
     90      d  value                          *   value options(*string)               const xmlChar *
     91      d  value2                         *   value options(*string)               const xmlChar *
     92      d  data                           *   value                                void *
     93 
     94      d xmlRegExecNextValues...
     95      d                 pr            10i 0 extproc('xmlRegExecNextValues')
     96      d  exec                               value like(xmlRegExecCtxtPtr)
     97      d  nbval                        10i 0
     98      d  nbneg                        10i 0
     99      d  values                         *                                        xmlChar * (*)
    100      d  terminal                     10i 0
    101 
    102      d xmlRegExecErrInfo...
    103      d                 pr            10i 0 extproc('xmlRegExecErrInfo')
    104      d  exec                               value like(xmlRegExecCtxtPtr)
    105      d  string                         *                                        const xmlChar * (*)
    106      d  nbval                        10i 0
    107      d  nbneg                        10i 0
    108      d  values                         *                                        xmlChar * (*)
    109      d  terminal                     10i 0
    110 
    111       /if defined(LIBXML_EXPR_ENABLED)
    112 
    113       * Formal regular expression handling
    114       * Its goal is to do some formal work on content models
    115 
    116       * expressions are used within a context
    117 
    118      d xmlExpCtxtPtr   s               *   based(######typedef######)
    119 
    120      d xmlExpFreeCtxt  pr                  extproc('xmlExpFreeCtxt')
    121      d  ctxt                               value like(xmlExpCtxtPtr)
    122 
    123      d xmlExpNewCtxt   pr                  extproc('xmlExpNewCtxt')
    124      d                                     like(xmlExpCtxtPtr)
    125      d  maxNodes                     10i 0 value
    126      d  dict                               value like(xmlDictPtr)
    127 
    128      d xmlExpCtxtNbNodes...
    129      d                 pr            10i 0 extproc('xmlExpCtxtNbNodes')
    130      d  ctxt                               value like(xmlExpCtxtPtr)
    131 
    132      d xmlExpCtxtNbCons...
    133      d                 pr            10i 0 extproc('xmlExpCtxtNbCons')
    134      d  ctxt                               value like(xmlExpCtxtPtr)
    135 
    136       * Expressions are trees but the tree is opaque
    137 
    138      d xmlExpNodePtr   s               *   based(######typedef######)
    139 
    140      d xmlExpNodeType  s             10i 0 based(######typedef######)           enum
    141      d  XML_EXP_EMPTY  c                   0
    142      d  XML_EXP_FORBID...
    143      d                 c                   1
    144      d  XML_EXP_ATOM   c                   2
    145      d  XML_EXP_SEQ    c                   3
    146      d  XML_EXP_OR     c                   4
    147      d  XML_EXP_COUNT  c                   5
    148 
    149       * 2 core expressions shared by all for the empty language set
    150       * and for the set with just the empty token
    151 
    152      d forbiddenExp    s                   import('forbiddenExp')
    153      d                                     like(xmlExpNodePtr)
    154 
    155      d emptyExp        s                   import('emptyExp')
    156      d                                     like(xmlExpNodePtr)
    157 
    158 
    159       * Expressions are reference counted internally
    160 
    161      d xmlExpFree      pr                  extproc('xmlExpFree')
    162      d  expr                               value like(xmlExpNodePtr)
    163 
    164      d xmlExpRef       pr                  extproc('xmlExpRef')
    165      d  expr                               value like(xmlExpNodePtr)
    166 
    167       * constructors can be either manual or from a string
    168 
    169      d xmlExpParse     pr                  extproc('xmlExpParse')
    170      d                                     like(xmlExpNodePtr)
    171      d  ctxt                               value like(xmlExpCtxtPtr)
    172      d  expr                           *   value options(*string)               const char *
    173 
    174      d xmlExpNewAtom   pr                  extproc('xmlExpNewAtom')
    175      d                                     like(xmlExpNodePtr)
    176      d  ctxt                               value like(xmlExpCtxtPtr)
    177      d  name                           *   value options(*string)               const xmlChar *
    178      d  len                          10i 0 value
    179 
    180      d xmlExpNewOr     pr                  extproc('xmlExpNewOr')
    181      d                                     like(xmlExpNodePtr)
    182      d  ctxt                               value like(xmlExpCtxtPtr)
    183      d  left                               value like(xmlExpNodePtr)
    184      d  right                              value like(xmlExpNodePtr)
    185 
    186      d xmlExpNewSeq    pr                  extproc('xmlExpNewSeq')
    187      d                                     like(xmlExpNodePtr)
    188      d  ctxt                               value like(xmlExpCtxtPtr)
    189      d  left                               value like(xmlExpNodePtr)
    190      d  right                              value like(xmlExpNodePtr)
    191 
    192      d xmlExpNewRange  pr                  extproc('xmlExpNewRange')
    193      d                                     like(xmlExpNodePtr)
    194      d  ctxt                               value like(xmlExpCtxtPtr)
    195      d  subset                             value like(xmlExpNodePtr)
    196      d  min                          10i 0 value
    197      d  max                          10i 0 value
    198 
    199       * The really interesting APIs
    200 
    201      d xmlExpIsNillable...
    202      d                 pr            10i 0 extproc('xmlExpIsNillable')
    203      d  expr                               value like(xmlExpNodePtr)
    204 
    205      d xmlExpMaxToken  pr            10i 0 extproc('xmlExpMaxToken')
    206      d  expr                               value like(xmlExpNodePtr)
    207 
    208      d xmlExpGetLanguage...
    209      d                 pr            10i 0 extproc('xmlExpGetLanguage')
    210      d  ctxt                               value like(xmlExpCtxtPtr)
    211      d  expr                               value like(xmlExpNodePtr)
    212      d  langList                       *                                        const xmlChar *(*)
    213      d  len                          10i 0 value
    214 
    215      d xmlExpGetStart  pr            10i 0 extproc('xmlExpGetStart')
    216      d  ctxt                               value like(xmlExpCtxtPtr)
    217      d  expr                               value like(xmlExpNodePtr)
    218      d  tokList                        *                                        const xmlChar *(*)
    219      d  len                          10i 0 value
    220 
    221      d xmlExpStringDerive...
    222      d                 pr                  extproc('xmlExpStringDerive')
    223      d                                     like(xmlExpNodePtr)
    224      d  ctxt                               value like(xmlExpCtxtPtr)
    225      d  expr                               value like(xmlExpNodePtr)
    226      d  str                            *   value options(*string)               const xmlChar *
    227      d  len                          10i 0 value
    228 
    229      d xmlExpExpDerive...
    230      d                 pr                  extproc('xmlExpExpDerive')
    231      d                                     like(xmlExpNodePtr)
    232      d  ctxt                               value like(xmlExpCtxtPtr)
    233      d  expr                               value like(xmlExpNodePtr)
    234      d  sub                                value like(xmlExpNodePtr)
    235 
    236      d xmlExpSubsume   pr            10i 0 extproc('xmlExpSubsume')
    237      d  ctxt                               value like(xmlExpCtxtPtr)
    238      d  expr                               value like(xmlExpNodePtr)
    239      d  sub                                value like(xmlExpNodePtr)
    240 
    241      d xmlExpDump      pr                  extproc('xmlExpDump')
    242      d  buf                                value like(xmlBufferPtr)
    243      d  expr                               value like(xmlExpNodePtr)
    244       /endif                                                                    LIBXML_EXPR_ENABLED
    245       /endif                                                                    LIBXML_REGEXP_ENABLD
    246       /endif                                                                    XML_REGEXP_H__
    247