Eneboo - Documentación para desarrolladores
src/libxslt/libxslt/xsltutils.h
Ir a la documentación de este archivo.
00001 /*
00002  * Summary: set of utilities for the XSLT engine
00003  * Description: interfaces for the utilities module of the XSLT engine.
00004  *              things like message handling, profiling, and other
00005  *              generally useful routines.
00006  *
00007  * Copy: See Copyright for the status of this software.
00008  *
00009  * Author: Daniel Veillard
00010  */
00011 
00012 #ifndef __XML_XSLTUTILS_H__
00013 #define __XML_XSLTUTILS_H__
00014 
00015 #include <libxslt/xsltconfig.h>
00016 #ifdef HAVE_STDARG_H
00017 #include <stdarg.h>
00018 #endif
00019 #include <libxml/xpath.h>
00020 #include <libxml/dict.h>
00021 #include <libxml/xmlerror.h>
00022 #include "xsltexports.h"
00023 #include "xsltInternals.h"
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00034 #define XSLT_TODO                                                       \
00035     xsltGenericError(xsltGenericErrorContext,                           \
00036             "Unimplemented block at %s:%d\n",                           \
00037             __FILE__, __LINE__);
00038 
00044 #define XSLT_STRANGE                                                    \
00045     xsltGenericError(xsltGenericErrorContext,                           \
00046             "Internal error at %s:%d\n",                                \
00047             __FILE__, __LINE__);
00048 
00054 #define IS_XSLT_ELEM(n)                                                 \
00055     (((n) != NULL) && ((n)->ns != NULL) &&                              \
00056      (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
00057 
00063 #define IS_XSLT_NAME(n, val)                                            \
00064     (xmlStrEqual((n)->name, (const xmlChar *) (val)))
00065 
00071 #define IS_XSLT_REAL_NODE(n)                                            \
00072     (((n) != NULL) &&                                                   \
00073      (((n)->type == XML_ELEMENT_NODE) ||                                \
00074       ((n)->type == XML_TEXT_NODE) ||                                   \
00075       ((n)->type == XML_CDATA_SECTION_NODE) ||                          \
00076       ((n)->type == XML_ATTRIBUTE_NODE) ||                              \
00077       ((n)->type == XML_DOCUMENT_NODE) ||                               \
00078       ((n)->type == XML_HTML_DOCUMENT_NODE) ||                          \
00079       ((n)->type == XML_COMMENT_NODE) ||                                \
00080       ((n)->type == XML_PI_NODE)))      
00081 
00082 /*
00083  * Our own version of namespaced atributes lookup.
00084  */
00085 XSLTPUBFUN xmlChar * XSLTCALL
00086                 xsltGetNsProp   (xmlNodePtr node,
00087                                  const xmlChar *name,
00088                                  const xmlChar *nameSpace);
00089 XSLTPUBFUN const xmlChar * XSLTCALL
00090                 xsltGetCNsProp  (xsltStylesheetPtr style,
00091                                  xmlNodePtr node,
00092                                  const xmlChar *name,
00093                                  const xmlChar *nameSpace);
00094 XSLTPUBFUN int XSLTCALL
00095                 xsltGetUTF8Char (const unsigned char *utf,
00096                                  int *len);
00097 
00098 /*
00099  * XSLT Debug Tracing Tracing Types
00100  */
00101 typedef enum {
00102         XSLT_TRACE_ALL =                -1,
00103         XSLT_TRACE_NONE =               0,
00104         XSLT_TRACE_COPY_TEXT =          1<<0,
00105         XSLT_TRACE_PROCESS_NODE =       1<<1,
00106         XSLT_TRACE_APPLY_TEMPLATE =     1<<2,
00107         XSLT_TRACE_COPY =               1<<3,
00108         XSLT_TRACE_COMMENT =            1<<4,
00109         XSLT_TRACE_PI =                 1<<5,
00110         XSLT_TRACE_COPY_OF =            1<<6,
00111         XSLT_TRACE_VALUE_OF =           1<<7,
00112         XSLT_TRACE_CALL_TEMPLATE =      1<<8,
00113         XSLT_TRACE_APPLY_TEMPLATES =    1<<9,
00114         XSLT_TRACE_CHOOSE =             1<<10,
00115         XSLT_TRACE_IF =                 1<<11,
00116         XSLT_TRACE_FOR_EACH =           1<<12,
00117         XSLT_TRACE_STRIP_SPACES =       1<<13,
00118         XSLT_TRACE_TEMPLATES =          1<<14,
00119         XSLT_TRACE_KEYS =               1<<15,
00120         XSLT_TRACE_VARIABLES =          1<<16
00121 } xsltDebugTraceCodes;
00122 
00128 #define XSLT_TRACE(ctxt,code,call)      \
00129         if (ctxt->traceCode && (*(ctxt->traceCode) & code)) \
00130             call
00131 
00132 XSLTPUBFUN void XSLTCALL
00133                 xsltDebugSetDefaultTrace(xsltDebugTraceCodes val);
00134 XSLTPUBFUN xsltDebugTraceCodes XSLTCALL
00135                 xsltDebugGetDefaultTrace(void);
00136 
00137 /*
00138  * XSLT specific error and debug reporting functions.
00139  */
00140 XSLTPUBVAR xmlGenericErrorFunc xsltGenericError;
00141 XSLTPUBVAR void *xsltGenericErrorContext;
00142 XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug;
00143 XSLTPUBVAR void *xsltGenericDebugContext;
00144 
00145 XSLTPUBFUN void XSLTCALL                
00146                 xsltPrintErrorContext           (xsltTransformContextPtr ctxt,
00147                                                  xsltStylesheetPtr style,
00148                                                  xmlNodePtr node);
00149 XSLTPUBFUN void XSLTCALL                
00150                 xsltMessage                     (xsltTransformContextPtr ctxt,
00151                                                  xmlNodePtr node,
00152                                                  xmlNodePtr inst);
00153 XSLTPUBFUN void XSLTCALL                
00154                 xsltSetGenericErrorFunc         (void *ctx,
00155                                                  xmlGenericErrorFunc handler);
00156 XSLTPUBFUN void XSLTCALL                
00157                 xsltSetGenericDebugFunc         (void *ctx,
00158                                                  xmlGenericErrorFunc handler);
00159 XSLTPUBFUN void XSLTCALL                
00160                 xsltSetTransformErrorFunc       (xsltTransformContextPtr ctxt,
00161                                                  void *ctx,
00162                                                  xmlGenericErrorFunc handler);
00163 XSLTPUBFUN void XSLTCALL                
00164                 xsltTransformError              (xsltTransformContextPtr ctxt,
00165                                                  xsltStylesheetPtr style,
00166                                                  xmlNodePtr node,
00167                                                  const char *msg,
00168                                                  ...);
00169 
00170 XSLTPUBFUN int XSLTCALL
00171                 xsltSetCtxtParseOptions         (xsltTransformContextPtr ctxt,
00172                                                  int options);
00173 /*
00174  * Sorting.
00175  */
00176 
00177 XSLTPUBFUN void XSLTCALL                
00178                 xsltDocumentSortFunction        (xmlNodeSetPtr list);
00179 XSLTPUBFUN void XSLTCALL                
00180                 xsltSetSortFunc                 (xsltSortFunc handler);
00181 XSLTPUBFUN void XSLTCALL                
00182                 xsltSetCtxtSortFunc             (xsltTransformContextPtr ctxt,
00183                                                  xsltSortFunc handler);
00184 XSLTPUBFUN void XSLTCALL                
00185                 xsltDefaultSortFunction         (xsltTransformContextPtr ctxt,
00186                                                  xmlNodePtr *sorts,
00187                                                  int nbsorts);
00188 XSLTPUBFUN void XSLTCALL                
00189                 xsltDoSortFunction              (xsltTransformContextPtr ctxt,
00190                                                  xmlNodePtr * sorts,
00191                                                  int nbsorts);
00192 XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL 
00193                 xsltComputeSortResult           (xsltTransformContextPtr ctxt,
00194                                                  xmlNodePtr sort);
00195 
00196 /*
00197  * QNames handling.
00198  */
00199 
00200 XSLTPUBFUN const xmlChar * XSLTCALL
00201                 xsltSplitQName                  (xmlDictPtr dict,
00202                                                  const xmlChar *name,
00203                                                  const xmlChar **prefix);
00204 XSLTPUBFUN const xmlChar * XSLTCALL 
00205                 xsltGetQNameURI                 (xmlNodePtr node,
00206                                                  xmlChar **name);
00207 
00208 XSLTPUBFUN const xmlChar * XSLTCALL
00209                 xsltGetQNameURI2                (xsltStylesheetPtr style,
00210                                                  xmlNodePtr node,
00211                                                  const xmlChar **name);
00212 
00213 /*
00214  * Output, reuse libxml I/O buffers.
00215  */
00216 XSLTPUBFUN int XSLTCALL         
00217                 xsltSaveResultTo                (xmlOutputBufferPtr buf,
00218                                                  xmlDocPtr result,
00219                                                  xsltStylesheetPtr style);
00220 XSLTPUBFUN int XSLTCALL         
00221                 xsltSaveResultToFilename        (const char *URI,
00222                                                  xmlDocPtr result,
00223                                                  xsltStylesheetPtr style,
00224                                                  int compression);
00225 XSLTPUBFUN int XSLTCALL         
00226                 xsltSaveResultToFile            (FILE *file,
00227                                                  xmlDocPtr result,
00228                                                  xsltStylesheetPtr style);
00229 XSLTPUBFUN int XSLTCALL         
00230                 xsltSaveResultToFd              (int fd,
00231                                                  xmlDocPtr result,
00232                                                  xsltStylesheetPtr style);
00233 XSLTPUBFUN int XSLTCALL             
00234                 xsltSaveResultToString          (xmlChar **doc_txt_ptr, 
00235                                                  int * doc_txt_len, 
00236                                                  xmlDocPtr result, 
00237                                                  xsltStylesheetPtr style);
00238 
00239 /*
00240  * XPath interface
00241  */
00242 XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
00243                 xsltXPathCompile                (xsltStylesheetPtr style,
00244                                                  const xmlChar *str);
00245 
00246 /*
00247  * Profiling.
00248  */
00249 XSLTPUBFUN void XSLTCALL                
00250                 xsltSaveProfiling               (xsltTransformContextPtr ctxt,
00251                                                  FILE *output);
00252 XSLTPUBFUN xmlDocPtr XSLTCALL   
00253                 xsltGetProfileInformation       (xsltTransformContextPtr ctxt);
00254 
00255 XSLTPUBFUN long XSLTCALL                
00256                 xsltTimestamp                   (void);
00257 XSLTPUBFUN void XSLTCALL                
00258                 xsltCalibrateAdjust             (long delta);
00259 
00265 #define XSLT_TIMESTAMP_TICS_PER_SEC 100000l
00266 
00267 /*
00268  * Hooks for the debugger.
00269  */
00270 
00271 typedef enum {
00272     XSLT_DEBUG_NONE = 0, /* no debugging allowed */
00273     XSLT_DEBUG_INIT,
00274     XSLT_DEBUG_STEP,
00275     XSLT_DEBUG_STEPOUT,
00276     XSLT_DEBUG_NEXT,
00277     XSLT_DEBUG_STOP,
00278     XSLT_DEBUG_CONT,
00279     XSLT_DEBUG_RUN,
00280     XSLT_DEBUG_RUN_RESTART,
00281     XSLT_DEBUG_QUIT
00282 } xsltDebugStatusCodes;
00283 
00284 XSLTPUBVAR int xslDebugStatus;
00285 
00286 typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node,
00287                         xsltTemplatePtr templ, xsltTransformContextPtr ctxt);
00288 typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source);
00289 typedef void (*xsltDropCallCallback) (void);
00290 
00291 XSLTPUBFUN void XSLTCALL
00292                 xsltSetDebuggerStatus           (int value);
00293 XSLTPUBFUN int XSLTCALL
00294                 xsltGetDebuggerStatus           (void);
00295 XSLTPUBFUN int XSLTCALL         
00296                 xsltSetDebuggerCallbacks        (int no, void *block);
00297 XSLTPUBFUN int XSLTCALL         
00298                 xslAddCall                      (xsltTemplatePtr templ,
00299                                                  xmlNodePtr source);
00300 XSLTPUBFUN void XSLTCALL                
00301                 xslDropCall                     (void);
00302 
00303 #ifdef __cplusplus
00304 }
00305 #endif
00306 
00307 #endif /* __XML_XSLTUTILS_H__ */
00308 
00309 
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'