source: trunk/third/libxslt/libxslt/xsltutils.h @ 18543

Revision 18543, 5.8 KB checked in by ghudson, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18542, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * xsltutils.h: interfaces for the utilities module of the XSLT engine.
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
23extern "C" {
24#endif
25
26/**
27 * XSLT_TODO:
28 *
29 * Macro to flag unimplemented blocks.
30 */
31#define XSLT_TODO                                                       \
32    xsltGenericError(xsltGenericErrorContext,                           \
33            "Unimplemented block at %s:%d\n",                           \
34            __FILE__, __LINE__);
35
36/**
37 * XSLT_STRANGE:
38 *
39 * Macro to flag that a problem was detected internally.
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 *
49 * Checks that the element pertains to XSLT namespace.
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 *
58 * Checks the value of an element in XSLT namespace.
59 */
60#define IS_XSLT_NAME(n, val)                                            \
61    (xmlStrEqual((n)->name, (const xmlChar *) (val)))
62
63/**
64 * IS_XSLT_REAL_NODE:
65 *
66 * Check that a node is a 'real' one: document, element, text or attribute.
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/*
88 * Our own version of namespaced atributes lookup.
89 */
90xmlChar *       xsltGetNsProp                   (xmlNodePtr node,
91                                                 const xmlChar *name,
92                                                 const xmlChar *nameSpace);
93int             xsltGetUTF8Char                 (const unsigned char *utf,
94                                                 int *len);
95
96/*
97 * XSLT specific error and debug reporting functions.
98 */
99LIBXSLT_PUBLIC extern xmlGenericErrorFunc xsltGenericError;
100LIBXSLT_PUBLIC extern void *xsltGenericErrorContext;
101LIBXSLT_PUBLIC extern xmlGenericErrorFunc xsltGenericDebug;
102LIBXSLT_PUBLIC extern void *xsltGenericDebugContext;
103
104void            xsltPrintErrorContext           (xsltTransformContextPtr ctxt,
105                                                 xsltStylesheetPtr style,
106                                                 xmlNodePtr node);
107void            xsltMessage                     (xsltTransformContextPtr ctxt,
108                                                 xmlNodePtr node,
109                                                 xmlNodePtr inst);
110void            xsltSetGenericErrorFunc         (void *ctx,
111                                                 xmlGenericErrorFunc handler);
112void            xsltSetGenericDebugFunc         (void *ctx,
113                                                 xmlGenericErrorFunc handler);
114void            xsltSetTransformErrorFunc       (xsltTransformContextPtr ctxt,
115                                                 void *ctx,
116                                                 xmlGenericErrorFunc handler);
117void            xsltTransformError              (xsltTransformContextPtr ctxt,
118                                                 xsltStylesheetPtr style,
119                                                 xmlNodePtr node,
120                                                 const char *msg,
121                                                 ...);
122
123/*
124 * Sorting.
125 */
126
127void            xsltDocumentSortFunction        (xmlNodeSetPtr list);
128void            xsltSetSortFunc                 (xsltSortFunc handler);
129void            xsltSetCtxtSortFunc             (xsltTransformContextPtr ctxt,
130                                                 xsltSortFunc handler);
131void            xsltDefaultSortFunction         (xsltTransformContextPtr ctxt,
132                                                 xmlNodePtr *sorts,
133                                                 int nbsorts);
134void            xsltDoSortFunction              (xsltTransformContextPtr ctxt,
135                                                 xmlNodePtr * sorts,
136                                                 int nbsorts);
137xmlXPathObjectPtr *xsltComputeSortResult        (xsltTransformContextPtr ctxt,
138                                                 xmlNodePtr sort);
139
140/*
141 * QNames handling.
142 */
143
144const xmlChar * xsltGetQNameURI                 (xmlNodePtr node,
145                                                 xmlChar **name);
146
147/*
148 * Output, reuse libxml I/O buffers.
149 */
150int             xsltSaveResultTo                (xmlOutputBufferPtr buf,
151                                                 xmlDocPtr result,
152                                                 xsltStylesheetPtr style);
153int             xsltSaveResultToFilename        (const char *URI,
154                                                 xmlDocPtr result,
155                                                 xsltStylesheetPtr style,
156                                                 int compression);
157int             xsltSaveResultToFile            (FILE *file,
158                                                 xmlDocPtr result,
159                                                 xsltStylesheetPtr style);
160int             xsltSaveResultToFd              (int fd,
161                                                 xmlDocPtr result,
162                                                 xsltStylesheetPtr style);
163int             xsltSaveResultToString          (xmlChar **doc_txt_ptr,
164                                                 int * doc_txt_len,
165                                                 xmlDocPtr result,
166                                                 xsltStylesheetPtr style);
167
168/*
169 * Profiling.
170 */
171void            xsltSaveProfiling               (xsltTransformContextPtr ctxt,
172                                                 FILE *output);
173xmlDocPtr       xsltGetProfileInformation       (xsltTransformContextPtr ctxt);
174
175long            xsltTimestamp                   (void);
176void            xsltCalibrateAdjust             (long delta);
177
178/**
179 * XSLT_TIMESTAMP_TICS_PER_SEC:
180 *
181 * Sampling precision for profiling
182 */
183#define XSLT_TIMESTAMP_TICS_PER_SEC 100000l
184
185/*
186 * Hooks for the debugger.
187 */
188
189typedef 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
202LIBXSLT_PUBLIC extern int xslDebugStatus;
203
204typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node,
205                        xsltTemplatePtr templ, xsltTransformContextPtr ctxt);
206typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source);
207typedef void (*xsltDropCallCallback) (void);
208
209int             xsltSetDebuggerCallbacks        (int no, void *block);
210int             xslAddCall                      (xsltTemplatePtr templ,
211                                                 xmlNodePtr source);
212void            xslDropCall                     (void);
213
214#ifdef __cplusplus
215}
216#endif
217
218#endif /* __XML_XSLTUTILS_H__ */
219
220
Note: See TracBrowser for help on using the repository browser.