Annotation of win32/gnome/libxslt-x.x.x/libxslt/xsltutils.h, revision 1.2

1.1       paf         1: /*
1.2     ! paf         2:  * xsltutils.h: interfaces for the utilities module of the XSLT engine.
1.1       paf         3:  *
                      4:  * See Copyright for the status of this software.
                      5:  *
                      6:  * daniel@veillard.com
                      7:  */
                      8: 
                      9: #ifndef __XML_XSLTUTILS_H__
                     10: #define __XML_XSLTUTILS_H__
                     11: 
                     12: #if defined(WIN32) && defined(_MSC_VER)
                     13: #include <libxslt/xsltwin32config.h>
                     14: #else
                     15: #include <libxslt/xsltconfig.h>
                     16: #endif
                     17: 
                     18: #include <libxml/xpath.h>
                     19: #include <libxml/xmlerror.h>
                     20: #include "xsltInternals.h"
                     21: 
                     22: #ifdef __cplusplus
                     23: extern "C" {
                     24: #endif
                     25: 
                     26: /**
1.2     ! paf        27:  * XSLT_TODO:
1.1       paf        28:  *
1.2     ! paf        29:  * Macro to flag unimplemented blocks.
1.1       paf        30:  */
                     31: #define XSLT_TODO                                                      \
                     32:     xsltGenericError(xsltGenericErrorContext,                          \
                     33:            "Unimplemented block at %s:%d\n",                           \
                     34:             __FILE__, __LINE__);
                     35: 
                     36: /**
1.2     ! paf        37:  * XSLT_STRANGE:
1.1       paf        38:  *
1.2     ! paf        39:  * Macro to flag that a problem was detected internally.
1.1       paf        40:  */
                     41: #define XSLT_STRANGE                                                   \
                     42:     xsltGenericError(xsltGenericErrorContext,                          \
                     43:            "Internal error at %s:%d\n",                                \
                     44:             __FILE__, __LINE__);
                     45: 
                     46: /**
                     47:  * IS_XSLT_ELEM:
                     48:  *
1.2     ! paf        49:  * Checks that the element pertains to XSLT namespace.
1.1       paf        50:  */
                     51: #define IS_XSLT_ELEM(n)                                                        \
                     52:     (((n) != NULL) && ((n)->ns != NULL) &&                             \
                     53:      (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
                     54: 
                     55: /**
                     56:  * IS_XSLT_NAME:
                     57:  *
1.2     ! paf        58:  * Checks the value of an element in XSLT namespace.
1.1       paf        59:  */
                     60: #define IS_XSLT_NAME(n, val)                                           \
                     61:     (xmlStrEqual((n)->name, (const xmlChar *) (val)))
                     62: 
                     63: /**
                     64:  * IS_XSLT_REAL_NODE:
                     65:  *
1.2     ! paf        66:  * Check that a node is a 'real' one: document, element, text or attribute.
1.1       paf        67:  */
                     68: #ifdef LIBXML_DOCB_ENABLED
                     69: #define IS_XSLT_REAL_NODE(n)                                           \
                     70:     (((n) != NULL) &&                                                  \
                     71:      (((n)->type == XML_ELEMENT_NODE) ||                               \
                     72:       ((n)->type == XML_TEXT_NODE) ||                                  \
                     73:       ((n)->type == XML_ATTRIBUTE_NODE) ||                             \
                     74:       ((n)->type == XML_DOCUMENT_NODE) ||                              \
                     75:       ((n)->type == XML_HTML_DOCUMENT_NODE) ||                         \
                     76:       ((n)->type == XML_DOCB_DOCUMENT_NODE)))
                     77: #else
                     78: #define IS_XSLT_REAL_NODE(n)                                           \
                     79:     (((n) != NULL) &&                                                  \
                     80:      (((n)->type == XML_ELEMENT_NODE) ||                               \
                     81:       ((n)->type == XML_TEXT_NODE) ||                                  \
                     82:       ((n)->type == XML_ATTRIBUTE_NODE) ||                             \
                     83:       ((n)->type == XML_DOCUMENT_NODE) ||                              \
                     84:       ((n)->type == XML_HTML_DOCUMENT_NODE)))
                     85: #endif
                     86: 
                     87: /*
1.2     ! paf        88:  * Our own version of namespaced atributes lookup.
1.1       paf        89:  */
1.2     ! paf        90: xmlChar *      xsltGetNsProp                   (xmlNodePtr node,
1.1       paf        91:                                                 const xmlChar *name,
                     92:                                                 const xmlChar *nameSpace);
1.2     ! paf        93: int            xsltGetUTF8Char                 (const unsigned char *utf,
        !            94:                                                 int *len);
1.1       paf        95: 
                     96: /*
1.2     ! paf        97:  * XSLT specific error and debug reporting functions.
1.1       paf        98:  */
                     99: LIBXSLT_PUBLIC extern xmlGenericErrorFunc xsltGenericError;
                    100: LIBXSLT_PUBLIC extern void *xsltGenericErrorContext;
                    101: LIBXSLT_PUBLIC extern xmlGenericErrorFunc xsltGenericDebug;
                    102: LIBXSLT_PUBLIC extern void *xsltGenericDebugContext;
                    103: 
                    104: void           xsltPrintErrorContext           (xsltTransformContextPtr ctxt,
                    105:                                                 xsltStylesheetPtr style,
                    106:                                                 xmlNodePtr node);
                    107: void           xsltMessage                     (xsltTransformContextPtr ctxt,
                    108:                                                 xmlNodePtr node,
                    109:                                                 xmlNodePtr inst);
                    110: void           xsltSetGenericErrorFunc         (void *ctx,
                    111:                                                 xmlGenericErrorFunc handler);
                    112: void           xsltSetGenericDebugFunc         (void *ctx,
                    113:                                                 xmlGenericErrorFunc handler);
1.2     ! paf       114: void           xsltSetTransformErrorFunc       (xsltTransformContextPtr ctxt,
        !           115:                                                 void *ctx,
        !           116:                                                 xmlGenericErrorFunc handler);
        !           117: void           xsltTransformError              (xsltTransformContextPtr ctxt,
        !           118:                                                 xsltStylesheetPtr style,
        !           119:                                                 xmlNodePtr node,
        !           120:                                                 const char *msg,
        !           121:                                                 ...);
1.1       paf       122: 
                    123: /*
1.2     ! paf       124:  * Sorting.
1.1       paf       125:  */
                    126: 
                    127: void           xsltDocumentSortFunction        (xmlNodeSetPtr list);
1.2     ! paf       128: void           xsltSetSortFunc                 (xsltSortFunc handler);
        !           129: void           xsltSetCtxtSortFunc             (xsltTransformContextPtr ctxt,
        !           130:                                                 xsltSortFunc handler);
        !           131: void           xsltDefaultSortFunction         (xsltTransformContextPtr ctxt,
        !           132:                                                 xmlNodePtr *sorts,
        !           133:                                                 int nbsorts);
1.1       paf       134: void           xsltDoSortFunction              (xsltTransformContextPtr ctxt,
1.2     ! paf       135:                                                 xmlNodePtr * sorts,
1.1       paf       136:                                                 int nbsorts);
1.2     ! paf       137: xmlXPathObjectPtr *xsltComputeSortResult       (xsltTransformContextPtr ctxt,
        !           138:                                                 xmlNodePtr sort);
1.1       paf       139: 
                    140: /*
1.2     ! paf       141:  * QNames handling.
1.1       paf       142:  */
                    143: 
                    144: const xmlChar * xsltGetQNameURI                        (xmlNodePtr node,
                    145:                                                 xmlChar **name);
                    146: 
                    147: /*
1.2     ! paf       148:  * Output, reuse libxml I/O buffers.
1.1       paf       149:  */
                    150: int            xsltSaveResultTo                (xmlOutputBufferPtr buf,
                    151:                                                 xmlDocPtr result,
                    152:                                                 xsltStylesheetPtr style);
                    153: int            xsltSaveResultToFilename        (const char *URI,
                    154:                                                 xmlDocPtr result,
                    155:                                                 xsltStylesheetPtr style,
                    156:                                                 int compression);
                    157: int            xsltSaveResultToFile            (FILE *file,
                    158:                                                 xmlDocPtr result,
                    159:                                                 xsltStylesheetPtr style);
                    160: int            xsltSaveResultToFd              (int fd,
                    161:                                                 xmlDocPtr result,
                    162:                                                 xsltStylesheetPtr style);
1.2     ! paf       163: int             xsltSaveResultToString          (xmlChar **doc_txt_ptr, 
        !           164:                                                  int * doc_txt_len, 
        !           165:                                                  xmlDocPtr result, 
        !           166:                                                  xsltStylesheetPtr style);
1.1       paf       167: 
                    168: /*
1.2     ! paf       169:  * Profiling.
1.1       paf       170:  */
                    171: void           xsltSaveProfiling               (xsltTransformContextPtr ctxt,
                    172:                                                 FILE *output);
1.2     ! paf       173: xmlDocPtr      xsltGetProfileInformation       (xsltTransformContextPtr ctxt);
1.1       paf       174: 
                    175: long           xsltTimestamp                   (void);
                    176: void           xsltCalibrateAdjust             (long delta);
                    177: 
1.2     ! paf       178: /**
        !           179:  * XSLT_TIMESTAMP_TICS_PER_SEC:
        !           180:  *
        !           181:  * Sampling precision for profiling
        !           182:  */
1.1       paf       183: #define XSLT_TIMESTAMP_TICS_PER_SEC 100000l
                    184: 
                    185: /*
1.2     ! paf       186:  * Hooks for the debugger.
1.1       paf       187:  */
                    188: 
                    189: typedef enum {
                    190:     XSLT_DEBUG_NONE = 0, /* no debugging allowed */
                    191:     XSLT_DEBUG_INIT,
                    192:     XSLT_DEBUG_STEP,
                    193:     XSLT_DEBUG_STEPOUT,
                    194:     XSLT_DEBUG_NEXT,
                    195:     XSLT_DEBUG_STOP,
                    196:     XSLT_DEBUG_CONT,
                    197:     XSLT_DEBUG_RUN,
                    198:     XSLT_DEBUG_RUN_RESTART,
                    199:     XSLT_DEBUG_QUIT
                    200: } xsltDebugStatusCodes;
                    201: 
                    202: LIBXSLT_PUBLIC extern int xslDebugStatus;
                    203: 
                    204: typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node,
                    205:                        xsltTemplatePtr templ, xsltTransformContextPtr ctxt);
                    206: typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source);
                    207: typedef void (*xsltDropCallCallback) (void);
                    208: 
                    209: int            xsltSetDebuggerCallbacks        (int no, void *block);
                    210: int            xslAddCall                      (xsltTemplatePtr templ,
                    211:                                                 xmlNodePtr source);
                    212: void           xslDropCall                     (void);
                    213: 
                    214: #ifdef __cplusplus
                    215: }
                    216: #endif
                    217: 
                    218: #endif /* __XML_XSLTUTILS_H__ */
1.2     ! paf       219: 
1.1       paf       220: 

E-mail: