ReactOS  0.4.13-dev-650-g34bf247
extensions.c File Reference
#include "precomp.h"
#include <libxml/list.h>
Include dependency graph for extensions.c:

Go to the source code of this file.

Classes

struct  _xsltExtDef
 
struct  _xsltExtModule
 
struct  _xsltExtData
 
struct  _xsltExtElement
 
struct  _xsltInitExtCtxt
 

Typedefs

typedef struct _xsltExtDef xsltExtDef
 
typedef xsltExtDefxsltExtDefPtr
 
typedef struct _xsltExtModule xsltExtModule
 
typedef xsltExtModulexsltExtModulePtr
 
typedef struct _xsltExtData xsltExtData
 
typedef xsltExtDataxsltExtDataPtr
 
typedef struct _xsltExtElement xsltExtElement
 
typedef xsltExtElementxsltExtElementPtr
 

Functions

static xsltExtDefPtr xsltNewExtDef (const xmlChar *prefix, const xmlChar *URI)
 
static void xsltFreeExtDef (xsltExtDefPtr extensiond)
 
static void xsltFreeExtDefList (xsltExtDefPtr extensiond)
 
static xsltExtModulePtr xsltNewExtModule (xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc)
 
static void xsltFreeExtModule (xsltExtModulePtr ext)
 
static void xsltFreeExtModuleEntry (void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
 
static xsltExtDataPtr xsltNewExtData (xsltExtModulePtr extModule, void *extData)
 
static void xsltFreeExtData (xsltExtDataPtr ext)
 
static void xsltFreeExtDataEntry (void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
 
static xsltExtElementPtr xsltNewExtElement (xsltPreComputeFunction precomp, xsltTransformFunction transform)
 
static void xsltFreeExtElement (xsltExtElementPtr ext)
 
static void xsltFreeExtElementEntry (void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
 
static int xsltExtModuleRegisterDynamic (const xmlChar *URI ATTRIBUTE_UNUSED)
 
void xsltFreeExts (xsltStylesheetPtr style)
 
int xsltRegisterExtPrefix (xsltStylesheetPtr style, const xmlChar *prefix, const xmlChar *URI)
 
: the function name

xsltUnregisterExtModuleFunction:

@URI: the function namespace URI

Unregisters an extension module function

Returns 0 if successful, -1 in case of error.

int xsltRegisterExtModuleFunction (const xmlChar *name, const xmlChar *URI, xmlXPathFunction function)
 
xmlXPathFunction xsltExtModuleFunctionLookup (const xmlChar *name, const xmlChar *URI)
 
int xsltUnregisterExtModuleFunction (const xmlChar *name, const xmlChar *URI)
 
static void xsltUnregisterAllExtModuleFunction (void)
 
static void xsltFreeElemPreComp (xsltElemPreCompPtr comp)
 
xsltElemPreCompPtr xsltNewElemPreComp (xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
 
void xsltInitElemPreComp (xsltElemPreCompPtr comp, xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function, xsltElemPreCompDeallocator freeFunc)
 
xsltElemPreCompPtr xsltPreComputeExtModuleElement (xsltStylesheetPtr style, xmlNodePtr inst)
 
: the element name

xsltUnregisterExtModuleElement:

@URI: the element namespace URI

Unregisters an extension module element

Returns 0 if successful, -1 in case of error.

int xsltRegisterExtModuleElement (const xmlChar *name, const xmlChar *URI, xsltPreComputeFunction precomp, xsltTransformFunction transform)
 
xsltTransformFunction xsltExtElementLookup (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI)
 
xsltTransformFunction xsltExtModuleElementLookup (const xmlChar *name, const xmlChar *URI)
 
xsltPreComputeFunction xsltExtModuleElementPreComputeLookup (const xmlChar *name, const xmlChar *URI)
 
int xsltUnregisterExtModuleElement (const xmlChar *name, const xmlChar *URI)
 
static void xsltUnregisterAllExtModuleElement (void)
 

Variables

static xmlHashTablePtr xsltExtensionsHash = NULL
 
static xmlHashTablePtr xsltFunctionsHash = NULL
 
static xmlHashTablePtr xsltElementsHash = NULL
 
static xmlHashTablePtr xsltTopLevelsHash = NULL
 
static xmlHashTablePtr xsltModuleHash = NULL
 
static xmlMutexPtr xsltExtMutex = NULL
 

: the name of the element

xsltRegisterExtElement: @ctxt: an XSLT transformation context

@URI: the URI associated to the element @function: the actual implementation which should be called

Registers an extension element

Returns 0 in case of success, -1 in case of failure

typedef struct _xsltInitExtCtxt xsltInitExtCtxt
 
int xsltRegisterExtFunction (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, xmlXPathFunction function)
 
int xsltRegisterExtElement (xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, xsltTransformFunction function)
 
void xsltFreeCtxtExts (xsltTransformContextPtr ctxt)
 
static xsltExtDataPtr xsltStyleInitializeStylesheetModule (xsltStylesheetPtr style, const xmlChar *URI)
 
voidxsltStyleGetExtData (xsltStylesheetPtr style, const xmlChar *URI)
 
voidxsltGetExtData (xsltTransformContextPtr ctxt, const xmlChar *URI)
 
static void xsltInitCtxtExt (void *payload, void *data, const xmlChar *URI)
 
int xsltInitCtxtExts (xsltTransformContextPtr ctxt)
 
static void xsltShutdownCtxtExt (void *payload, void *vctxt, const xmlChar *URI)
 
void xsltShutdownCtxtExts (xsltTransformContextPtr ctxt)
 
static void xsltShutdownExt (void *payload, void *vctxt, const xmlChar *URI)
 
void xsltShutdownExts (xsltStylesheetPtr style)
 
int xsltCheckExtPrefix (xsltStylesheetPtr style, const xmlChar *URI)
 
int xsltCheckExtURI (xsltStylesheetPtr style, const xmlChar *URI)
 
int xsltRegisterExtModuleFull (const xmlChar *URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc)
 
int xsltRegisterExtModule (const xmlChar *URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc)
 
int xsltUnregisterExtModule (const xmlChar *URI)
 
static void xsltUnregisterAllExtModules (void)
 
xsltTransformContextPtr xsltXPathGetTransformContext (xmlXPathParserContextPtr ctxt)
 

: the top-level element name

xsltUnregisterExtModuleTopLevel:

@URI: the top-level element namespace URI

Unregisters an extension module top-level element

Returns 0 if successful, -1 in case of error.

static xmlChartestData = NULL
 
static xmlChartestStyleData = NULL
 
int xsltRegisterExtModuleTopLevel (const xmlChar *name, const xmlChar *URI, xsltTopLevelFunction function)
 
xsltTopLevelFunction xsltExtModuleTopLevelLookup (const xmlChar *name, const xmlChar *URI)
 
int xsltUnregisterExtModuleTopLevel (const xmlChar *name, const xmlChar *URI)
 
static void xsltUnregisterAllExtModuleTopLevel (void)
 
xmlHashTablePtr xsltGetExtInfo (xsltStylesheetPtr style, const xmlChar *URI)
 
static void xsltExtFunctionTest (xmlXPathParserContextPtr ctxt, int nargs ATTRIBUTE_UNUSED)
 
static xsltElemPreCompPtr xsltExtElementPreCompTest (xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
 
static void xsltExtElementTest (xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
 
static voidxsltExtInitTest (xsltTransformContextPtr ctxt, const xmlChar *URI)
 
static void xsltExtShutdownTest (xsltTransformContextPtr ctxt, const xmlChar *URI, void *data)
 
static voidxsltExtStyleInitTest (xsltStylesheetPtr style ATTRIBUTE_UNUSED, const xmlChar *URI)
 
static void xsltExtStyleShutdownTest (xsltStylesheetPtr style ATTRIBUTE_UNUSED, const xmlChar *URI, void *data)
 
void xsltRegisterTestModule (void)
 
static void xsltHashScannerModuleFree (void *payload ATTRIBUTE_UNUSED, void *data ATTRIBUTE_UNUSED, const xmlChar *name ATTRIBUTE_UNUSED)
 
void xsltInitGlobals (void)
 
void xsltCleanupGlobals (void)
 
static void xsltDebugDumpExtensionsCallback (void *function ATTRIBUTE_UNUSED, void *data, const xmlChar *name, const xmlChar *URI, const xmlChar *not_used ATTRIBUTE_UNUSED)
 
static void xsltDebugDumpExtModulesCallback (void *function ATTRIBUTE_UNUSED, void *data, const xmlChar *URI, const xmlChar *not_used ATTRIBUTE_UNUSED, const xmlChar *not_used2 ATTRIBUTE_UNUSED)
 
void xsltDebugDumpExtensions (FILE *output)
 

Typedef Documentation

◆ xsltExtData

Definition at line 53 of file extensions.c.

◆ xsltExtDataPtr

Definition at line 54 of file extensions.c.

◆ xsltExtDef

Definition at line 35 of file extensions.c.

◆ xsltExtDefPtr

Definition at line 36 of file extensions.c.

◆ xsltExtElement

Definition at line 60 of file extensions.c.

◆ xsltExtElementPtr

Definition at line 61 of file extensions.c.

◆ xsltExtModule

Definition at line 44 of file extensions.c.

◆ xsltExtModulePtr

Definition at line 45 of file extensions.c.

◆ xsltInitExtCtxt

Definition at line 922 of file extensions.c.

Function Documentation

◆ xsltCheckExtPrefix()

int xsltCheckExtPrefix ( xsltStylesheetPtr  style,
const xmlChar URI 
)

xsltCheckExtPrefix: @style: the stylesheet @URI: the namespace prefix (possibly NULL)

Check if the given prefix is one of the declared extensions. This is intended to be called only at compile-time. Called by: xsltGetInheritedNsList() (xslt.c) xsltParseTemplateContent (xslt.c)

Returns 1 if this is an extension, 0 otherwise

Definition at line 1158 of file extensions.c.

1159 {
1160 #ifdef XSLT_REFACTORED
1161  if ((style == NULL) || (style->compCtxt == NULL) ||
1162  (XSLT_CCTXT(style)->inode == NULL) ||
1163  (XSLT_CCTXT(style)->inode->extElemNs == NULL))
1164  return (0);
1165  /*
1166  * Lookup the extension namespaces registered
1167  * at the current node in the stylesheet's tree.
1168  */
1169  if (XSLT_CCTXT(style)->inode->extElemNs != NULL) {
1170  int i;
1171  xsltPointerListPtr list = XSLT_CCTXT(style)->inode->extElemNs;
1172 
1173  for (i = 0; i < list->number; i++) {
1174  if (xmlStrEqual((const xmlChar *) list->items[i],
1175  URI))
1176  {
1177  return(1);
1178  }
1179  }
1180  }
1181 #else
1182  xsltExtDefPtr cur;
1183 
1184  if ((style == NULL) || (style->nsDefs == NULL))
1185  return (0);
1186  if (URI == NULL)
1187  URI = BAD_CAST "#default";
1188  cur = (xsltExtDefPtr) style->nsDefs;
1189  while (cur != NULL) {
1190  /*
1191  * NOTE: This was change to work on namespace names rather
1192  * than namespace prefixes. This fixes bug #339583.
1193  * TODO: Consider renaming the field "prefix" of xsltExtDef
1194  * to "href".
1195  */
1196  if (xmlStrEqual(URI, cur->prefix))
1197  return (1);
1198  cur = cur->next;
1199  }
1200 #endif
1201  return (0);
1202 }
xsltExtDef * xsltExtDefPtr
Definition: extensions.c:36
xmlChar * prefix
Definition: extensions.c:39
Definition: fs.h:78
while(1)
Definition: macro.lex.yy.c:740
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct _xsltExtDef * next
Definition: extensions.c:38
smooth NULL
Definition: ftsmooth.c:416
#define BAD_CAST
Definition: xmlstring.h:35
unsigned char xmlChar
Definition: xmlstring.h:28
Definition: _list.h:228
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93

Referenced by xsltGetInheritedNsList(), and xsltParseTemplateContent().

◆ xsltCheckExtURI()

int xsltCheckExtURI ( xsltStylesheetPtr  style,
const xmlChar URI 
)

xsltCheckExtURI: @style: the stylesheet @URI: the namespace URI (possibly NULL)

Check if the given prefix is one of the declared extensions. This is intended to be called only at compile-time. Called by: xsltPrecomputeStylesheet() (xslt.c) xsltParseTemplateContent (xslt.c)

Returns 1 if this is an extension, 0 otherwise

Definition at line 1218 of file extensions.c.

1219 {
1220  xsltExtDefPtr cur;
1221 
1222  if ((style == NULL) || (style->nsDefs == NULL))
1223  return (0);
1224  if (URI == NULL)
1225  return (0);
1226  cur = (xsltExtDefPtr) style->nsDefs;
1227  while (cur != NULL) {
1228  if (xmlStrEqual(URI, cur->URI))
1229  return (1);
1230  cur = cur->next;
1231  }
1232  return (0);
1233 }
xsltExtDef * xsltExtDefPtr
Definition: extensions.c:36
xmlChar * URI
Definition: extensions.c:40
while(1)
Definition: macro.lex.yy.c:740
struct _xsltExtDef * next
Definition: extensions.c:38
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93

Referenced by xsltPreprocessStylesheet().

◆ xsltCleanupGlobals()

void xsltCleanupGlobals ( void  )

xsltCleanupGlobals:

Unregister all global variables set up by the XSLT library

Definition at line 2276 of file extensions.c.

2277 {
2282 
2284  /* cleanup dynamic module hash */
2285  if (NULL != xsltModuleHash) {
2288  xsltModuleHash = NULL;
2289  }
2291 
2293  xsltExtMutex = NULL;
2294  xsltFreeLocales();
2295  xsltUninit();
2296 }
XMLPUBFUN void XMLCALL xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data)
Definition: hash.c:857
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
static void xsltHashScannerModuleFree(void *payload ATTRIBUTE_UNUSED, void *data ATTRIBUTE_UNUSED, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:2248
void xsltUninit(void)
Definition: xslt.c:217
void xsltFreeLocales(void)
Definition: xsltlocale.c:63
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
static void xsltUnregisterAllExtModules(void)
Definition: extensions.c:1341
smooth NULL
Definition: ftsmooth.c:416
static xmlHashTablePtr xsltModuleHash
Definition: extensions.c:71
static void xsltUnregisterAllExtModuleFunction(void)
Definition: extensions.c:1476
static void xsltUnregisterAllExtModuleTopLevel(void)
Definition: extensions.c:1915
XMLPUBFUN void XMLCALL xmlFreeMutex(xmlMutexPtr tok)
Definition: threads.c:206
static void xsltUnregisterAllExtModuleElement(void)
Definition: extensions.c:1804

◆ xsltDebugDumpExtensions()

void xsltDebugDumpExtensions ( FILE output)

xsltDebugDumpExtensions: @output: the FILE * for the output, if NULL stdout is used

Dumps a list of the registered XSLT extension functions and elements

Definition at line 2329 of file extensions.c.

2330 {
2331  if (output == NULL)
2332  output = stdout;
2333  fprintf(output,
2334  "Registered XSLT Extensions\n--------------------------\n");
2335  if (!xsltFunctionsHash)
2336  fprintf(output, "No registered extension functions\n");
2337  else {
2338  fprintf(output, "Registered Extension Functions:\n");
2341  output);
2343  }
2344  if (!xsltElementsHash)
2345  fprintf(output, "\nNo registered extension elements\n");
2346  else {
2347  fprintf(output, "\nRegistered Extension Elements:\n");
2350  output);
2352  }
2353  if (!xsltExtensionsHash)
2354  fprintf(output, "\nNo registered extension modules\n");
2355  else {
2356  fprintf(output, "\nRegistered Extension Modules:\n");
2359  output);
2361  }
2362 
2363 }
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:67
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static void xsltDebugDumpExtModulesCallback(void *function ATTRIBUTE_UNUSED, void *data, const xmlChar *URI, const xmlChar *not_used ATTRIBUTE_UNUSED, const xmlChar *not_used2 ATTRIBUTE_UNUSED)
Definition: extensions.c:2311
FILE * stdout
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data)
Definition: hash.c:873
static void xsltDebugDumpExtensionsCallback(void *function ATTRIBUTE_UNUSED, void *data, const xmlChar *name, const xmlChar *URI, const xmlChar *not_used ATTRIBUTE_UNUSED)
Definition: extensions.c:2299
static xmlHashTablePtr xsltFunctionsHash
Definition: extensions.c:68
static xmlHashTablePtr xsltElementsHash
Definition: extensions.c:69

◆ xsltDebugDumpExtensionsCallback()

static void xsltDebugDumpExtensionsCallback ( void *function  ATTRIBUTE_UNUSED,
void data,
const xmlChar name,
const xmlChar URI,
const xmlChar *not_used  ATTRIBUTE_UNUSED 
)
static

Definition at line 2299 of file extensions.c.

2303 {
2304  FILE *output = (FILE *) data;
2305  if (!name || !URI)
2306  return;
2307  fprintf(output, "{%s}%s\n", URI, name);
2308 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: name.c:36

Referenced by xsltDebugDumpExtensions().

◆ xsltDebugDumpExtModulesCallback()

static void xsltDebugDumpExtModulesCallback ( void *function  ATTRIBUTE_UNUSED,
void data,
const xmlChar URI,
const xmlChar *not_used  ATTRIBUTE_UNUSED,
const xmlChar *not_used2  ATTRIBUTE_UNUSED 
)
static

Definition at line 2311 of file extensions.c.

2315 {
2316  FILE *output = (FILE *) data;
2317  if (!URI)
2318  return;
2319  fprintf(output, "%s\n", URI);
2320 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by xsltDebugDumpExtensions().

◆ xsltExtElementLookup()

xsltTransformFunction xsltExtElementLookup ( xsltTransformContextPtr  ctxt,
const xmlChar name,
const xmlChar URI 
)

Definition at line 1668 of file extensions.c.

1670 {
1672 
1673  if ((name == NULL) || (URI == NULL))
1674  return (NULL);
1675 
1676  if ((ctxt != NULL) && (ctxt->extElements != NULL)) {
1678  if (ret != NULL) {
1679  return(ret);
1680  }
1681  }
1682 
1684 
1685  return (ret);
1686 }
void(* xsltTransformFunction)(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp)
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
xsltTransformFunction xsltExtModuleElementLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1698
smooth NULL
Definition: ftsmooth.c:416
xmlHashTablePtr extElements
int ret
#define XML_CAST_FPTR(fptr)
Definition: hash.h:56
Definition: name.c:36

Referenced by xsltApplySequenceConstructor(), and xsltElementAvailableFunction().

◆ xsltExtElementPreCompTest()

static xsltElemPreCompPtr xsltExtElementPreCompTest ( xsltStylesheetPtr  style,
xmlNodePtr  inst,
xsltTransformFunction  function 
)
static

xsltExtElementPreCompTest: @style: the stylesheet @inst: the instruction in the stylesheet

Process a libxslt:test node

Definition at line 2027 of file extensions.c.

2029 {
2031 
2032  if (style == NULL) {
2033  xsltTransformError(NULL, NULL, inst,
2034  "xsltExtElementTest: no transformation context\n");
2035  return (NULL);
2036  }
2037  if (testStyleData == NULL) {
2039  "xsltExtElementPreCompTest: not initialized,"
2040  " calling xsltStyleGetExtData\n");
2042  if (testStyleData == NULL) {
2043  xsltTransformError(NULL, style, inst,
2044  "xsltExtElementPreCompTest: not initialized\n");
2045  if (style != NULL)
2046  style->errors++;
2047  return (NULL);
2048  }
2049  }
2050  if (inst == NULL) {
2051  xsltTransformError(NULL, style, inst,
2052  "xsltExtElementPreCompTest: no instruction\n");
2053  if (style != NULL)
2054  style->errors++;
2055  return (NULL);
2056  }
2057  ret = xsltNewElemPreComp(style, inst, function);
2058  return (ret);
2059 }
xsltElemPreCompPtr xsltNewElemPreComp(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
Definition: extensions.c:1503
void * xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:756
#define XSLT_DEFAULT_URL
Definition: xslt.h:39
static xmlChar * testStyleData
Definition: extensions.c:1967
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
Arabic default style
Definition: afstyles.h:93

Referenced by xsltRegisterTestModule().

◆ xsltExtElementTest()

static void xsltExtElementTest ( xsltTransformContextPtr  ctxt,
xmlNodePtr  node,
xmlNodePtr  inst,
xsltElemPreCompPtr comp  ATTRIBUTE_UNUSED 
)
static

xsltExtElementTest: @ctxt: an XSLT processing context @node: The current node @inst: the instruction in the stylesheet @comp: precomputed information

Process a libxslt:test node

Definition at line 2071 of file extensions.c.

2074 {
2075  xmlNodePtr commentNode;
2076 
2077  if (testData == NULL) {
2079  "xsltExtElementTest: not initialized,"
2080  " calling xsltGetExtData\n");
2081  xsltGetExtData(ctxt, (const xmlChar *) XSLT_DEFAULT_URL);
2082  if (testData == NULL) {
2083  xsltTransformError(ctxt, NULL, inst,
2084  "xsltExtElementTest: not initialized\n");
2085  return;
2086  }
2087  }
2088  if (ctxt == NULL) {
2089  xsltTransformError(ctxt, NULL, inst,
2090  "xsltExtElementTest: no transformation context\n");
2091  return;
2092  }
2093  if (node == NULL) {
2094  xsltTransformError(ctxt, NULL, inst,
2095  "xsltExtElementTest: no current node\n");
2096  return;
2097  }
2098  if (inst == NULL) {
2099  xsltTransformError(ctxt, NULL, inst,
2100  "xsltExtElementTest: no instruction\n");
2101  return;
2102  }
2103  if (ctxt->insert == NULL) {
2104  xsltTransformError(ctxt, NULL, inst,
2105  "xsltExtElementTest: no insertion point\n");
2106  return;
2107  }
2108  commentNode = xmlNewComment((const xmlChar *)
2109  "libxslt:test element test worked");
2110  xmlAddChild(ctxt->insert, commentNode);
2111 }
#define XSLT_DEFAULT_URL
Definition: xslt.h:39
smooth NULL
Definition: ftsmooth.c:416
void * xsltGetExtData(xsltTransformContextPtr ctxt, const xmlChar *URI)
Definition: extensions.c:862
void * xsltGenericDebugContext
Definition: xsltutils.c:549
XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
Definition: tree.h:489
XMLPUBFUN xmlNodePtr XMLCALL xmlNewComment(const xmlChar *content)
unsigned char xmlChar
Definition: xmlstring.h:28
static xmlChar * testData
Definition: extensions.c:1966
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
Definition: dlist.c:348

Referenced by xsltRegisterTestModule().

◆ xsltExtFunctionTest()

static void xsltExtFunctionTest ( xmlXPathParserContextPtr  ctxt,
int nargs  ATTRIBUTE_UNUSED 
)
static

xsltExtFunctionTest: @ctxt: the XPath Parser context @nargs: the number of arguments

function libxslt:test() for testing the extensions support.

Definition at line 1977 of file extensions.c.

1979 {
1981  void *data = NULL;
1982 
1983  tctxt = xsltXPathGetTransformContext(ctxt);
1984 
1985  if (testData == NULL) {
1987  "xsltExtFunctionTest: not initialized,"
1988  " calling xsltGetExtData\n");
1989  data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
1990  if (data == NULL) {
1991  xsltTransformError(tctxt, NULL, NULL,
1992  "xsltExtElementTest: not initialized\n");
1993  return;
1994  }
1995  }
1996  if (tctxt == NULL) {
1998  "xsltExtFunctionTest: failed to get the transformation context\n");
1999  return;
2000  }
2001  if (data == NULL)
2002  data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
2003  if (data == NULL) {
2005  "xsltExtFunctionTest: failed to get module data\n");
2006  return;
2007  }
2008  if (data != testData) {
2010  "xsltExtFunctionTest: got wrong module data\n");
2011  return;
2012  }
2013 #ifdef WITH_XSLT_DEBUG_FUNCTION
2015  "libxslt:test() called with %d args\n", nargs);
2016 #endif
2017 }
#define XSLT_DEFAULT_URL
Definition: xslt.h:39
smooth NULL
Definition: ftsmooth.c:416
void * xsltGetExtData(xsltTransformContextPtr ctxt, const xmlChar *URI)
Definition: extensions.c:862
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned char xmlChar
Definition: xmlstring.h:28
xsltTransformContextPtr xsltXPathGetTransformContext(xmlXPathParserContextPtr ctxt)
Definition: extensions.c:1367
static xmlChar * testData
Definition: extensions.c:1966
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678

Referenced by xsltRegisterTestModule().

◆ xsltExtInitTest()

static void* xsltExtInitTest ( xsltTransformContextPtr  ctxt,
const xmlChar URI 
)
static

xsltExtInitTest: @ctxt: an XSLT transformation context @URI: the namespace URI for the extension

A function called at initialization time of an XSLT extension module

Returns a pointer to the module specific data for this transformation

Definition at line 2123 of file extensions.c.

2124 {
2125  if (testStyleData == NULL) {
2127  "xsltExtInitTest: not initialized,"
2128  " calling xsltStyleGetExtData\n");
2129  testStyleData = xsltStyleGetExtData(ctxt->style, URI);
2130  if (testStyleData == NULL) {
2131  xsltTransformError(ctxt, NULL, NULL,
2132  "xsltExtInitTest: not initialized\n");
2133  return (NULL);
2134  }
2135  }
2136  if (testData != NULL) {
2137  xsltTransformError(ctxt, NULL, NULL,
2138  "xsltExtInitTest: already initialized\n");
2139  return (NULL);
2140  }
2141  testData = (void *) "test data";
2143  "Registered test module : %s\n", URI);
2144  return (testData);
2145 }
void * xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:756
static xmlChar * testStyleData
Definition: extensions.c:1967
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
void * xsltGenericErrorContext
Definition: xsltutils.c:503
xsltStylesheetPtr style
static xmlChar * testData
Definition: extensions.c:1966
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678

Referenced by xsltRegisterTestModule().

◆ xsltExtModuleElementLookup()

xsltTransformFunction xsltExtModuleElementLookup ( const xmlChar name,
const xmlChar URI 
)

Definition at line 1698 of file extensions.c.

1699 {
1701 
1702  if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
1703  return (NULL);
1704 
1706 
1708 
1710 
1711  /*
1712  * if function lookup fails, attempt a dynamic load on
1713  * supported platforms
1714  */
1715  if (NULL == ext) {
1716  if (!xsltExtModuleRegisterDynamic(URI)) {
1718 
1721 
1723  }
1724  }
1725 
1726  if (ext == NULL)
1727  return (NULL);
1728  return (ext->transform);
1729 }
xsltExtElement * xsltExtElementPtr
Definition: extensions.c:61
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
static int xsltExtModuleRegisterDynamic(const xmlChar *URI ATTRIBUTE_UNUSED)
Definition: extensions.c:459
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
Definition: name.c:36
static xmlHashTablePtr xsltElementsHash
Definition: extensions.c:69

Referenced by xsltExtElementLookup().

◆ xsltExtModuleElementPreComputeLookup()

xsltPreComputeFunction xsltExtModuleElementPreComputeLookup ( const xmlChar name,
const xmlChar URI 
)

Definition at line 1741 of file extensions.c.

1743 {
1745 
1746  if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
1747  return (NULL);
1748 
1750 
1752 
1754 
1755  if (ext == NULL) {
1756  if (!xsltExtModuleRegisterDynamic(URI)) {
1758 
1761 
1763  }
1764  }
1765 
1766  if (ext == NULL)
1767  return (NULL);
1768  return (ext->precomp);
1769 }
xsltExtElement * xsltExtElementPtr
Definition: extensions.c:61
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
static int xsltExtModuleRegisterDynamic(const xmlChar *URI ATTRIBUTE_UNUSED)
Definition: extensions.c:459
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
Definition: name.c:36
static xmlHashTablePtr xsltElementsHash
Definition: extensions.c:69

◆ xsltExtModuleFunctionLookup()

xmlXPathFunction xsltExtModuleFunctionLookup ( const xmlChar name,
const xmlChar URI 
)

Definition at line 1416 of file extensions.c.

1417 {
1418  xmlXPathFunction ret;
1419 
1420  if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL))
1421  return (NULL);
1422 
1424 
1426 
1428 
1429  /* if lookup fails, attempt a dynamic load on supported platforms */
1430  if (NULL == ret) {
1431  if (!xsltExtModuleRegisterDynamic(URI)) {
1433 
1434  XML_CAST_FPTR(ret) =
1436 
1438  }
1439  }
1440 
1441  return ret;
1442 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
static int xsltExtModuleRegisterDynamic(const xmlChar *URI ATTRIBUTE_UNUSED)
Definition: extensions.c:459
smooth NULL
Definition: ftsmooth.c:416
int ret
static xmlHashTablePtr xsltFunctionsHash
Definition: extensions.c:68
#define XML_CAST_FPTR(fptr)
Definition: hash.h:56
Definition: name.c:36

Referenced by xsltXPathFunctionLookup().

◆ xsltExtModuleRegisterDynamic()

static int xsltExtModuleRegisterDynamic ( const xmlChar *URI  ATTRIBUTE_UNUSED)
static

◆ xsltExtModuleTopLevelLookup()

xsltTopLevelFunction xsltExtModuleTopLevelLookup ( const xmlChar name,
const xmlChar URI 
)

Definition at line 1856 of file extensions.c.

1857 {
1859 
1860  if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL))
1861  return (NULL);
1862 
1864 
1866 
1868 
1869  /* if lookup fails, attempt a dynamic load on supported platforms */
1870  if (NULL == ret) {
1871  if (!xsltExtModuleRegisterDynamic(URI)) {
1873 
1875 
1877  }
1878  }
1879 
1880  return (ret);
1881 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
static int xsltExtModuleRegisterDynamic(const xmlChar *URI ATTRIBUTE_UNUSED)
Definition: extensions.c:459
smooth NULL
Definition: ftsmooth.c:416
int ret
static xmlHashTablePtr xsltTopLevelsHash
Definition: extensions.c:70
void(* xsltTopLevelFunction)(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: extensions.h:183
#define XML_CAST_FPTR(fptr)
Definition: hash.h:56
Definition: name.c:36

Referenced by xsltParseStylesheetTop().

◆ xsltExtShutdownTest()

static void xsltExtShutdownTest ( xsltTransformContextPtr  ctxt,
const xmlChar URI,
void data 
)
static

xsltExtShutdownTest: @ctxt: an XSLT transformation context @URI: the namespace URI for the extension @data: the data associated to this module

A function called at shutdown time of an XSLT extension module

Definition at line 2157 of file extensions.c.

2159 {
2160  if (testData == NULL) {
2161  xsltTransformError(ctxt, NULL, NULL,
2162  "xsltExtShutdownTest: not initialized\n");
2163  return;
2164  }
2165  if (data != testData) {
2166  xsltTransformError(ctxt, NULL, NULL,
2167  "xsltExtShutdownTest: wrong data\n");
2168  }
2169  testData = NULL;
2171  "Unregistered test module : %s\n", URI);
2172 }
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static xmlChar * testData
Definition: extensions.c:1966
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678

Referenced by xsltRegisterTestModule().

◆ xsltExtStyleInitTest()

static void* xsltExtStyleInitTest ( xsltStylesheetPtr style  ATTRIBUTE_UNUSED,
const xmlChar URI 
)
static

xsltExtStyleInitTest: @style: an XSLT stylesheet @URI: the namespace URI for the extension

A function called at initialization time of an XSLT extension module

Returns a pointer to the module specific data for this transformation

Definition at line 2184 of file extensions.c.

2186 {
2187  if (testStyleData != NULL) {
2189  "xsltExtInitTest: already initialized\n");
2190  return (NULL);
2191  }
2192  testStyleData = (void *) "test data";
2194  "Registered test module : %s\n", URI);
2195  return (testStyleData);
2196 }
static xmlChar * testStyleData
Definition: extensions.c:1967
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678

Referenced by xsltRegisterTestModule().

◆ xsltExtStyleShutdownTest()

static void xsltExtStyleShutdownTest ( xsltStylesheetPtr style  ATTRIBUTE_UNUSED,
const xmlChar URI,
void data 
)
static

xsltExtStyleShutdownTest: @style: an XSLT stylesheet @URI: the namespace URI for the extension @data: the data associated to this module

A function called at shutdown time of an XSLT extension module

Definition at line 2208 of file extensions.c.

2210 {
2211  if (testStyleData == NULL) {
2213  "xsltExtShutdownTest: not initialized\n");
2214  return;
2215  }
2216  if (data != testStyleData) {
2218  "xsltExtShutdownTest: wrong data\n");
2219  }
2220  testStyleData = NULL;
2222  "Unregistered test module : %s\n", URI);
2223 }
static xmlChar * testStyleData
Definition: extensions.c:1967
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void * xsltGenericErrorContext
Definition: xsltutils.c:503
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678

Referenced by xsltRegisterTestModule().

◆ xsltFreeCtxtExts()

void xsltFreeCtxtExts ( xsltTransformContextPtr  ctxt)

xsltFreeCtxtExts: @ctxt: an XSLT transformation context

Free the XSLT extension data

Definition at line 642 of file extensions.c.

643 {
644  if (ctxt->extElements != NULL)
645  xmlHashFree(ctxt->extElements, NULL);
646  if (ctxt->extFunctions != NULL)
647  xmlHashFree(ctxt->extFunctions, NULL);
648 }
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
xmlHashTablePtr extFunctions
smooth NULL
Definition: ftsmooth.c:416
xmlHashTablePtr extElements

Referenced by xsltFreeTransformContext().

◆ xsltFreeElemPreComp()

static void xsltFreeElemPreComp ( xsltElemPreCompPtr  comp)
static

Definition at line 1488 of file extensions.c.

1488  {
1489  xmlFree(comp);
1490 }
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250

Referenced by xsltNewElemPreComp().

◆ xsltFreeExtData()

static void xsltFreeExtData ( xsltExtDataPtr  ext)
static

xsltFreeExtData: @ext: an XSLT extension module data wrapper

Free up the memory allocated by @ext

Definition at line 229 of file extensions.c.

230 {
231  if (ext == NULL)
232  return;
233  xmlFree(ext);
234 }
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250

Referenced by xsltFreeExtDataEntry(), xsltGetExtData(), xsltInitCtxtExt(), and xsltStyleInitializeStylesheetModule().

◆ xsltFreeExtDataEntry()

static void xsltFreeExtDataEntry ( void payload,
const xmlChar *name  ATTRIBUTE_UNUSED 
)
static

Definition at line 237 of file extensions.c.

237  {
238  xsltFreeExtData((xsltExtDataPtr) payload);
239 }
static void xsltFreeExtData(xsltExtDataPtr ext)
Definition: extensions.c:229

Referenced by xsltShutdownCtxtExts(), and xsltShutdownExts().

◆ xsltFreeExtDef()

static void xsltFreeExtDef ( xsltExtDefPtr  extensiond)
static

xsltFreeExtDef: @extensiond: an XSLT extension definition

Free up the memory allocated by @extensiond

Definition at line 115 of file extensions.c.

116 {
117  if (extensiond == NULL)
118  return;
119  if (extensiond->prefix != NULL)
120  xmlFree(extensiond->prefix);
121  if (extensiond->URI != NULL)
122  xmlFree(extensiond->URI);
123  xmlFree(extensiond);
124 }
xmlChar * prefix
Definition: extensions.c:39
xmlChar * URI
Definition: extensions.c:40
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250

Referenced by xsltFreeExtDefList().

◆ xsltFreeExtDefList()

static void xsltFreeExtDefList ( xsltExtDefPtr  extensiond)
static

xsltFreeExtDefList: @extensiond: an XSLT extension definition list

Free up the memory allocated by all the elements of @extensiond

Definition at line 133 of file extensions.c.

134 {
135  xsltExtDefPtr cur;
136 
137  while (extensiond != NULL) {
138  cur = extensiond;
139  extensiond = extensiond->next;
140  xsltFreeExtDef(cur);
141  }
142 }
static void xsltFreeExtDef(xsltExtDefPtr extensiond)
Definition: extensions.c:115
struct _xsltExtDef * next
Definition: extensions.c:38
smooth NULL
Definition: ftsmooth.c:416

Referenced by xsltFreeExts().

◆ xsltFreeExtElement()

static void xsltFreeExtElement ( xsltExtElementPtr  ext)
static

xsltFreeExtElement: @ext: an XSLT extension element

Frees up the memory allocated by @ext

Definition at line 278 of file extensions.c.

279 {
280  if (ext == NULL)
281  return;
282  xmlFree(ext);
283 }
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250

Referenced by xsltFreeExtElementEntry().

◆ xsltFreeExtElementEntry()

static void xsltFreeExtElementEntry ( void payload,
const xmlChar *name  ATTRIBUTE_UNUSED 
)
static

Definition at line 286 of file extensions.c.

286  {
288 }
static void xsltFreeExtElement(xsltExtElementPtr ext)
Definition: extensions.c:278

Referenced by xsltRegisterExtModuleElement(), xsltUnregisterAllExtModuleElement(), and xsltUnregisterExtModuleElement().

◆ xsltFreeExtModule()

static void xsltFreeExtModule ( xsltExtModulePtr  ext)
static

xsltFreeExtModule: @ext: an XSLT extension module

Free up the memory allocated by @ext

Definition at line 183 of file extensions.c.

184 {
185  if (ext == NULL)
186  return;
187  xmlFree(ext);
188 }
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250

Referenced by xsltFreeExtModuleEntry().

◆ xsltFreeExtModuleEntry()

static void xsltFreeExtModuleEntry ( void payload,
const xmlChar *name  ATTRIBUTE_UNUSED 
)
static

Definition at line 191 of file extensions.c.

191  {
193 }
static void xsltFreeExtModule(xsltExtModulePtr ext)
Definition: extensions.c:183

Referenced by xsltUnregisterAllExtModules(), and xsltUnregisterExtModule().

◆ xsltFreeExts()

void xsltFreeExts ( xsltStylesheetPtr  style)

xsltFreeExts: @style: an XSLT stylesheet

Free up the memory used by XSLT extensions in a stylesheet

Definition at line 479 of file extensions.c.

480 {
481  if (style->nsDefs != NULL)
483 }
static void xsltFreeExtDefList(xsltExtDefPtr extensiond)
Definition: extensions.c:133
smooth NULL
Definition: ftsmooth.c:416
Arabic default style
Definition: afstyles.h:93

Referenced by xsltFreeStylesheet().

◆ xsltGetExtData()

void* xsltGetExtData ( xsltTransformContextPtr  ctxt,
const xmlChar URI 
)

xsltGetExtData: @ctxt: an XSLT transformation context @URI: the URI associated to the exension module

Retrieve the data associated to the extension module in this given transformation.

Returns the pointer or NULL if not present

Definition at line 862 of file extensions.c.

863 {
865 
866  if ((ctxt == NULL) || (URI == NULL))
867  return (NULL);
868  if (ctxt->extInfos == NULL) {
869  ctxt->extInfos = xmlHashCreate(10);
870  if (ctxt->extInfos == NULL)
871  return (NULL);
872  data = NULL;
873  } else {
874  data = (xsltExtDataPtr) xmlHashLookup(ctxt->extInfos, URI);
875  }
876  if (data == NULL) {
877  void *extData;
879 
881 
883 
885 
886  if (module == NULL) {
887 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
889  "Not registered extension module: %s\n", URI);
890 #endif
891  return (NULL);
892  } else {
893  if (module->initFunc == NULL)
894  return (NULL);
895 
896 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
898  "Initializing module: %s\n", URI);
899 #endif
900 
901  extData = module->initFunc(ctxt, URI);
902  if (extData == NULL)
903  return (NULL);
904 
905  data = xsltNewExtData(module, extData);
906  if (data == NULL)
907  return (NULL);
908  if (xmlHashAddEntry(ctxt->extInfos, URI, (void *) data) < 0) {
910  "Failed to register module data: %s\n",
911  URI);
912  if (module->shutdownFunc)
913  module->shutdownFunc(ctxt, URI, extData);
915  return (NULL);
916  }
917  }
918  }
919  return (data->extData);
920 }
xsltExtData * xsltExtDataPtr
Definition: extensions.c:54
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:67
HMODULE module
Definition: main.cpp:47
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
XMLPUBFUN int XMLCALL xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata)
Definition: hash.c:387
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
static xsltExtDataPtr xsltNewExtData(xsltExtModulePtr extModule, void *extData)
Definition: extensions.c:205
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
static void xsltFreeExtData(xsltExtDataPtr ext)
Definition: extensions.c:229
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
xmlHashTablePtr extInfos

Referenced by xsltExtElementTest(), and xsltExtFunctionTest().

◆ xsltGetExtInfo()

xmlHashTablePtr xsltGetExtInfo ( xsltStylesheetPtr  style,
const xmlChar URI 
)

xsltGetExtInfo: @style: pointer to a stylesheet @URI: the namespace URI desired

looks up URI in extInfos of the stylesheet

returns a pointer to the hash table if found, else NULL

Definition at line 1935 of file extensions.c.

1936 {
1938 
1939  /*
1940  * TODO: Why do we have a return type of xmlHashTablePtr?
1941  * Is the user-allocated data for extension modules expected
1942  * to be a xmlHashTablePtr only? Or is this intended for
1943  * the EXSLT module only?
1944  */
1945 
1946  if (style != NULL && style->extInfos != NULL) {
1947  data = xmlHashLookup(style->extInfos, URI);
1948  if (data != NULL && data->extData != NULL)
1949  return data->extData;
1950  }
1951  return NULL;
1952 }
smooth NULL
Definition: ftsmooth.c:416
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
Arabic default style
Definition: afstyles.h:93

◆ xsltHashScannerModuleFree()

static void xsltHashScannerModuleFree ( void *payload  ATTRIBUTE_UNUSED,
void *data  ATTRIBUTE_UNUSED,
const xmlChar *name  ATTRIBUTE_UNUSED 
)
static

Definition at line 2248 of file extensions.c.

2251 {
2252 #ifdef WITH_MODULES
2253  xmlModuleClose(payload);
2254 #endif
2255 }

Referenced by xsltCleanupGlobals().

◆ xsltInitCtxtExt()

static void xsltInitCtxtExt ( void payload,
void data,
const xmlChar URI 
)
static

xsltInitCtxtExt: @styleData: the registered stylesheet data for the module @ctxt: the XSLT transformation context + the return value @URI: the extension URI

Initializes an extension module

Definition at line 937 of file extensions.c.

938 {
939  xsltExtDataPtr styleData = (xsltExtDataPtr) payload;
942  xsltExtDataPtr ctxtData;
943  void *extData;
944 
945  if ((styleData == NULL) || (ctxt == NULL) || (URI == NULL) ||
946  (ctxt->ret == -1)) {
947 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
949  "xsltInitCtxtExt: NULL param or error\n");
950 #endif
951  return;
952  }
953  module = styleData->extModule;
954  if ((module == NULL) || (module->initFunc == NULL)) {
955 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
957  "xsltInitCtxtExt: no module or no initFunc\n");
958 #endif
959  return;
960  }
961 
962  ctxtData = (xsltExtDataPtr) xmlHashLookup(ctxt->ctxt->extInfos, URI);
963  if (ctxtData != NULL) {
964 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
966  "xsltInitCtxtExt: already initialized\n");
967 #endif
968  return;
969  }
970 
971  extData = module->initFunc(ctxt->ctxt, URI);
972  if (extData == NULL) {
973 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
975  "xsltInitCtxtExt: no extData\n");
976 #endif
977  }
978  ctxtData = xsltNewExtData(module, extData);
979  if (ctxtData == NULL) {
980  ctxt->ret = -1;
981  return;
982  }
983 
984  if (ctxt->ctxt->extInfos == NULL)
985  ctxt->ctxt->extInfos = xmlHashCreate(10);
986  if (ctxt->ctxt->extInfos == NULL) {
987  ctxt->ret = -1;
988  return;
989  }
990 
991  if (xmlHashAddEntry(ctxt->ctxt->extInfos, URI, ctxtData) < 0) {
993  "Failed to register module data: %s\n", URI);
994  if (module->shutdownFunc)
995  module->shutdownFunc(ctxt->ctxt, URI, extData);
996  xsltFreeExtData(ctxtData);
997  ctxt->ret = -1;
998  return;
999  }
1000 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
1001  xsltGenericDebug(xsltGenericDebugContext, "Registered module %s\n",
1002  URI);
1003 #endif
1004  ctxt->ret++;
1005 }
xsltExtData * xsltExtDataPtr
Definition: extensions.c:54
HMODULE module
Definition: main.cpp:47
XMLPUBFUN int XMLCALL xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata)
Definition: hash.c:387
xsltExtModulePtr extModule
Definition: extensions.c:56
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
void * xsltGenericErrorContext
Definition: xsltutils.c:503
static xsltExtDataPtr xsltNewExtData(xsltExtModulePtr extModule, void *extData)
Definition: extensions.c:205
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
static void xsltFreeExtData(xsltExtDataPtr ext)
Definition: extensions.c:229
xmlHashTablePtr extInfos
xsltTransformContextPtr ctxt
Definition: extensions.c:924

Referenced by xsltInitCtxtExts().

◆ xsltInitCtxtExts()

int xsltInitCtxtExts ( xsltTransformContextPtr  ctxt)

xsltInitCtxtExts: @ctxt: an XSLT transformation context

Initialize the set of modules with registered stylesheet data

Returns the number of modules initialized or -1 in case of error

Definition at line 1016 of file extensions.c.

1017 {
1019  xsltInitExtCtxt ctx;
1020 
1021  if (ctxt == NULL)
1022  return (-1);
1023 
1024  style = ctxt->style;
1025  if (style == NULL)
1026  return (-1);
1027 
1028  ctx.ctxt = ctxt;
1029  ctx.ret = 0;
1030 
1031  while (style != NULL) {
1032  if (style->extInfos != NULL) {
1033  xmlHashScan(style->extInfos, xsltInitCtxtExt, &ctx);
1034  if (ctx.ret == -1)
1035  return (-1);
1036  }
1038  }
1039 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
1040  xsltGenericDebug(xsltGenericDebugContext, "Registered %d modules\n",
1041  ctx.ret);
1042 #endif
1043  return (ctx.ret);
1044 }
XMLPUBFUN void XMLCALL xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data)
Definition: hash.c:857
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:250
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
static void xsltInitCtxtExt(void *payload, void *data, const xmlChar *URI)
Definition: extensions.c:937
xsltStylesheetPtr style
Arabic default style
Definition: afstyles.h:93
xsltTransformContextPtr ctxt
Definition: extensions.c:924

Referenced by xsltNewTransformContext().

◆ xsltInitElemPreComp()

void xsltInitElemPreComp ( xsltElemPreCompPtr  comp,
xsltStylesheetPtr  style,
xmlNodePtr  inst,
xsltTransformFunction  function,
xsltElemPreCompDeallocator  freeFunc 
)

xsltInitElemPreComp: @comp: an xsltElemPreComp (or generally a derived structure) @style: the XSLT stylesheet @inst: the element node @function: the transform function @freeFunc: the @comp deallocator

Initializes an existing xsltElemPreComp structure. This is usefull when extending an xsltElemPreComp to store precomputed data. This function MUST be called on any extension element precomputed data struct.

Definition at line 1535 of file extensions.c.

1538 {
1539  comp->type = XSLT_FUNC_EXTENSION;
1540  comp->func = function;
1541  comp->inst = inst;
1542  comp->free = freeFunc;
1543 
1544  comp->next = style->preComps;
1545  style->preComps = comp;
1546 }
xsltStyleType type
xsltTransformFunction func
xsltElemPreCompDeallocator free
Arabic default style
Definition: afstyles.h:93
xsltElemPreCompPtr next

Referenced by xsltNewElemPreComp().

◆ xsltInitGlobals()

void xsltInitGlobals ( void  )

xsltInitGlobals:

Initialize the global variables for extensions

Definition at line 2263 of file extensions.c.

2264 {
2265  if (xsltExtMutex == NULL) {
2267  }
2268 }
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN xmlMutexPtr XMLCALL xmlNewMutex(void)
Definition: threads.c:177

Referenced by xsltApplyStylesheetInternal(), xsltLoadStylesheetPI(), xsltNewSecurityPrefs(), xsltNewTransformContext(), xsltParseStylesheetDoc(), xsltParseStylesheetFile(), xsltParseStylesheetProcess(), xsltRegisterTestModule(), and xsltSetSecurityPrefs().

◆ xsltNewElemPreComp()

xsltElemPreCompPtr xsltNewElemPreComp ( xsltStylesheetPtr  style,
xmlNodePtr  inst,
xsltTransformFunction  function 
)

xsltNewElemPreComp: @style: the XSLT stylesheet @inst: the element node @function: the transform function

Creates and initializes an xsltElemPreComp

Returns the new and initialized xsltElemPreComp

Definition at line 1503 of file extensions.c.

1505 {
1506  xsltElemPreCompPtr cur;
1507 
1508  cur = (xsltElemPreCompPtr) xmlMalloc(sizeof(xsltElemPreComp));
1509  if (cur == NULL) {
1511  "xsltNewExtElement : malloc failed\n");
1512  return (NULL);
1513  }
1514  memset(cur, 0, sizeof(xsltElemPreComp));
1515 
1516  xsltInitElemPreComp(cur, style, inst, function, xsltFreeElemPreComp);
1517 
1518  return (cur);
1519 }
smooth NULL
Definition: ftsmooth.c:416
void xsltInitElemPreComp(xsltElemPreCompPtr comp, xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function, xsltElemPreCompDeallocator freeFunc)
Definition: extensions.c:1535
xsltElemPreComp * xsltElemPreCompPtr
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
static void xsltFreeElemPreComp(xsltElemPreCompPtr comp)
Definition: extensions.c:1488
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
Arabic default style
Definition: afstyles.h:93
#define memset(x, y, z)
Definition: compat.h:39

Referenced by xsltExtElementPreCompTest(), and xsltPreComputeExtModuleElement().

◆ xsltNewExtData()

static xsltExtDataPtr xsltNewExtData ( xsltExtModulePtr  extModule,
void extData 
)
static

xsltNewExtData: @extModule: the module @extData: the associated data

Create a new XSLT extension module data wrapper

Returns the newly allocated xsltExtDataPtr or NULL in case of error

Definition at line 205 of file extensions.c.

206 {
207  xsltExtDataPtr cur;
208 
209  if (extModule == NULL)
210  return (NULL);
211  cur = (xsltExtDataPtr) xmlMalloc(sizeof(xsltExtData));
212  if (cur == NULL) {
214  "xsltNewExtData : malloc failed\n");
215  return (NULL);
216  }
217  cur->extModule = extModule;
218  cur->extData = extData;
219  return (cur);
220 }
xsltExtData * xsltExtDataPtr
Definition: extensions.c:54
xsltExtModulePtr extModule
Definition: extensions.c:56
smooth NULL
Definition: ftsmooth.c:416
void * extData
Definition: extensions.c:57
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678

Referenced by xsltGetExtData(), xsltInitCtxtExt(), and xsltStyleInitializeStylesheetModule().

◆ xsltNewExtDef()

static xsltExtDefPtr xsltNewExtDef ( const xmlChar prefix,
const xmlChar URI 
)
static

xsltNewExtDef: @prefix: the extension prefix @URI: the namespace URI

Create a new XSLT ExtDef

Returns the newly allocated xsltExtDefPtr or NULL in case of error

Definition at line 90 of file extensions.c.

91 {
92  xsltExtDefPtr cur;
93 
94  cur = (xsltExtDefPtr) xmlMalloc(sizeof(xsltExtDef));
95  if (cur == NULL) {
97  "xsltNewExtDef : malloc failed\n");
98  return (NULL);
99  }
100  memset(cur, 0, sizeof(xsltExtDef));
101  if (prefix != NULL)
102  cur->prefix = xmlStrdup(prefix);
103  if (URI != NULL)
104  cur->URI = xmlStrdup(URI);
105  return (cur);
106 }
xsltExtDef * xsltExtDefPtr
Definition: extensions.c:36
xmlChar * prefix
Definition: extensions.c:39
xmlChar * URI
Definition: extensions.c:40
smooth NULL
Definition: ftsmooth.c:416
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
#define memset(x, y, z)
Definition: compat.h:39
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66

Referenced by xsltRegisterExtPrefix().

◆ xsltNewExtElement()

static xsltExtElementPtr xsltNewExtElement ( xsltPreComputeFunction  precomp,
xsltTransformFunction  transform 
)
static

xsltNewExtElement: @precomp: the pre-computation function @transform: the transformation function

Create a new XSLT extension element

Returns the newly allocated xsltExtElementPtr or NULL in case of error

Definition at line 252 of file extensions.c.

254 {
255  xsltExtElementPtr cur;
256 
257  if (transform == NULL)
258  return (NULL);
259 
260  cur = (xsltExtElementPtr) xmlMalloc(sizeof(xsltExtElement));
261  if (cur == NULL) {
263  "xsltNewExtElement : malloc failed\n");
264  return (NULL);
265  }
266  cur->precomp = precomp;
267  cur->transform = transform;
268  return (cur);
269 }
xsltExtElement * xsltExtElementPtr
Definition: extensions.c:61
xsltTransformFunction transform
Definition: extensions.c:64
smooth NULL
Definition: ftsmooth.c:416
xsltPreComputeFunction precomp
Definition: extensions.c:63
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
GLuint GLenum GLenum transform
Definition: glext.h:9407
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678

Referenced by xsltRegisterExtModuleElement().

◆ xsltNewExtModule()

static xsltExtModulePtr xsltNewExtModule ( xsltExtInitFunction  initFunc,
xsltExtShutdownFunction  shutdownFunc,
xsltStyleExtInitFunction  styleInitFunc,
xsltStyleExtShutdownFunction  styleShutdownFunc 
)
static

xsltNewExtModule: @initFunc: the module initialization function @shutdownFunc: the module shutdown function @styleInitFunc: the stylesheet module data allocator function @styleShutdownFunc: the stylesheet module data free function

Create a new XSLT extension module

Returns the newly allocated xsltExtModulePtr or NULL in case of error

Definition at line 156 of file extensions.c.

160 {
161  xsltExtModulePtr cur;
162 
163  cur = (xsltExtModulePtr) xmlMalloc(sizeof(xsltExtModule));
164  if (cur == NULL) {
166  "xsltNewExtModule : malloc failed\n");
167  return (NULL);
168  }
169  cur->initFunc = initFunc;
170  cur->shutdownFunc = shutdownFunc;
171  cur->styleInitFunc = styleInitFunc;
172  cur->styleShutdownFunc = styleShutdownFunc;
173  return (cur);
174 }
xsltExtInitFunction initFunc
Definition: extensions.c:47
xsltStyleExtInitFunction styleInitFunc
Definition: extensions.c:49
smooth NULL
Definition: ftsmooth.c:416
xsltExtShutdownFunction shutdownFunc
Definition: extensions.c:48
xsltStyleExtShutdownFunction styleShutdownFunc
Definition: extensions.c:50
xsltExtModule * xsltExtModulePtr
Definition: extensions.c:45
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678

Referenced by xsltRegisterExtModuleFull().

◆ xsltPreComputeExtModuleElement()

xsltElemPreCompPtr xsltPreComputeExtModuleElement ( xsltStylesheetPtr  style,
xmlNodePtr  inst 
)

xsltPreComputeExtModuleElement: @style: the stylesheet @inst: the element node

Precomputes an extension module element

Returns the precomputed data

Definition at line 1558 of file extensions.c.

1559 {
1561  xsltElemPreCompPtr comp = NULL;
1562 
1563  if ((style == NULL) || (inst == NULL) ||
1564  (inst->type != XML_ELEMENT_NODE) || (inst->ns == NULL))
1565  return (NULL);
1566 
1568 
1570  xmlHashLookup2(xsltElementsHash, inst->name, inst->ns->href);
1571 
1573 
1574  /*
1575  * EXT TODO: Now what?
1576  */
1577  if (ext == NULL)
1578  return (NULL);
1579 
1580  if (ext->precomp != NULL) {
1581  /*
1582  * REVISIT TODO: Check if the text below is correct.
1583  * This will return a xsltElemPreComp structure or NULL.
1584  * 1) If the the author of the extension needs a
1585  * custom structure to hold the specific values of
1586  * this extension, he will derive a structure based on
1587  * xsltElemPreComp; thus we obviously *cannot* refactor
1588  * the xsltElemPreComp structure, since all already derived
1589  * user-defined strucures will break.
1590  * Example: For the extension xsl:document,
1591  * in xsltDocumentComp() (preproc.c), the structure
1592  * xsltStyleItemDocument is allocated, filled with
1593  * specific values and returned.
1594  * 2) If the author needs no values to be stored in
1595  * this structure, then he'll return NULL;
1596  */
1597  comp = ext->precomp(style, inst, ext->transform);
1598  }
1599  if (comp == NULL) {
1600  /*
1601  * Default creation of a xsltElemPreComp structure, if
1602  * the author of this extension did not create a custom
1603  * structure.
1604  */
1605  comp = xsltNewElemPreComp(style, inst, ext->transform);
1606  }
1607 
1608  return (comp);
1609 }
xsltElemPreCompPtr xsltNewElemPreComp(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
Definition: extensions.c:1503
const xmlChar * name
Definition: tree.h:492
xsltExtElement * xsltExtElementPtr
Definition: extensions.c:61
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:474
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
xmlElementType type
Definition: tree.h:491
xmlNs * ns
Definition: tree.h:501
Arabic default style
Definition: afstyles.h:93
const xmlChar * href
Definition: tree.h:392
static xmlHashTablePtr xsltElementsHash
Definition: extensions.c:69

Referenced by xsltStylePreCompute().

◆ xsltRegisterExtElement()

int xsltRegisterExtElement ( xsltTransformContextPtr  ctxt,
const xmlChar name,
const xmlChar URI,
xsltTransformFunction  function 
)

Definition at line 621 of file extensions.c.

623 {
624  if ((ctxt == NULL) || (name == NULL) ||
625  (URI == NULL) || (function == NULL))
626  return (-1);
627  if (ctxt->extElements == NULL)
628  ctxt->extElements = xmlHashCreate(10);
629  if (ctxt->extElements == NULL)
630  return (-1);
631  return (xmlHashAddEntry2
632  (ctxt->extElements, name, URI, XML_CAST_FPTR(function)));
633 }
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:404
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
xmlHashTablePtr extElements
#define XML_CAST_FPTR(fptr)
Definition: hash.h:56
Definition: name.c:36

Referenced by xsltRegisterAllElement().

◆ xsltRegisterExtFunction()

int xsltRegisterExtFunction ( xsltTransformContextPtr  ctxt,
const xmlChar name,
const xmlChar URI,
xmlXPathFunction  function 
)

Definition at line 587 of file extensions.c.

589 {
590  int ret;
591 
592  if ((ctxt == NULL) || (name == NULL) ||
593  (URI == NULL) || (function == NULL))
594  return (-1);
595  if (ctxt->xpathCtxt != NULL) {
596  xmlXPathRegisterFuncNS(ctxt->xpathCtxt, name, URI, function);
597  }
598  if (ctxt->extFunctions == NULL)
599  ctxt->extFunctions = xmlHashCreate(10);
600  if (ctxt->extFunctions == NULL)
601  return (-1);
602 
603  ret = xmlHashAddEntry2(ctxt->extFunctions, name, URI,
604  XML_CAST_FPTR(function));
605 
606  return(ret);
607 }
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:404
xmlHashTablePtr extFunctions
smooth NULL
Definition: ftsmooth.c:416
xmlXPathContextPtr xpathCtxt
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
int ret
#define XML_CAST_FPTR(fptr)
Definition: hash.h:56
Definition: name.c:36

◆ xsltRegisterExtModule()

int xsltRegisterExtModule ( const xmlChar URI,
xsltExtInitFunction  initFunc,
xsltExtShutdownFunction  shutdownFunc 
)

xsltRegisterExtModule: @URI: URI associated to this module @initFunc: the module initialization function @shutdownFunc: the module shutdown function

Register an XSLT extension module to the library.

Returns 0 if sucessful, -1 in case of error

Definition at line 1300 of file extensions.c.

1303 {
1304  return xsltRegisterExtModuleFull(URI, initFunc, shutdownFunc,
1305  NULL, NULL);
1306 }
smooth NULL
Definition: ftsmooth.c:416
int xsltRegisterExtModuleFull(const xmlChar *URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc)
Definition: extensions.c:1248

◆ xsltRegisterExtModuleElement()

int xsltRegisterExtModuleElement ( const xmlChar name,
const xmlChar URI,
xsltPreComputeFunction  precomp,
xsltTransformFunction  transform 
)

Definition at line 1623 of file extensions.c.

1626 {
1627  int ret = 0;
1628 
1630 
1631  if ((name == NULL) || (URI == NULL) || (transform == NULL))
1632  return (-1);
1633 
1634  if (xsltElementsHash == NULL)
1636  if (xsltElementsHash == NULL)
1637  return (-1);
1638 
1640 
1641  ext = xsltNewExtElement(precomp, transform);
1642  if (ext == NULL) {
1643  ret = -1;
1644  goto done;
1645  }
1646 
1647  xmlHashUpdateEntry2(xsltElementsHash, name, URI, (void *) ext,
1649 
1650 done:
1652 
1653  return (ret);
1654 }
static xsltExtElementPtr xsltNewExtElement(xsltPreComputeFunction precomp, xsltTransformFunction transform)
Definition: extensions.c:252
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
static void xsltFreeExtElementEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:286
int ret
XMLPUBFUN int XMLCALL xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator f)
Definition: hash.c:443
Definition: name.c:36
GLuint GLenum GLenum transform
Definition: glext.h:9407
static xmlHashTablePtr xsltElementsHash
Definition: extensions.c:69

Referenced by xsltRegisterAllExtras(), and xsltRegisterTestModule().

◆ xsltRegisterExtModuleFull()

int xsltRegisterExtModuleFull ( const xmlChar URI,
xsltExtInitFunction  initFunc,
xsltExtShutdownFunction  shutdownFunc,
xsltStyleExtInitFunction  styleInitFunc,
xsltStyleExtShutdownFunction  styleShutdownFunc 
)

xsltRegisterExtModuleFull: @URI: URI associated to this module @initFunc: the module initialization function @shutdownFunc: the module shutdown function @styleInitFunc: the module initialization function @styleShutdownFunc: the module shutdown function

Register an XSLT extension module to the library.

Returns 0 if sucessful, -1 in case of error

Definition at line 1248 of file extensions.c.

1253 {
1254  int ret;
1256 
1257  if ((URI == NULL) || (initFunc == NULL))
1258  return (-1);
1259  if (xsltExtensionsHash == NULL)
1261 
1262  if (xsltExtensionsHash == NULL)
1263  return (-1);
1264 
1266 
1268  if (module != NULL) {
1269  if ((module->initFunc == initFunc) &&
1270  (module->shutdownFunc == shutdownFunc))
1271  ret = 0;
1272  else
1273  ret = -1;
1274  goto done;
1275  }
1276  module = xsltNewExtModule(initFunc, shutdownFunc,
1277  styleInitFunc, styleShutdownFunc);
1278  if (module == NULL) {
1279  ret = -1;
1280  goto done;
1281  }
1282  ret = xmlHashAddEntry(xsltExtensionsHash, URI, (void *) module);
1283 
1284 done:
1286  return (ret);
1287 }
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:67
HMODULE module
Definition: main.cpp:47
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
XMLPUBFUN int XMLCALL xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata)
Definition: hash.c:387
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
int ret
static xsltExtModulePtr xsltNewExtModule(xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc)
Definition: extensions.c:156
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459

Referenced by xsltRegisterExtModule(), and xsltRegisterTestModule().

◆ xsltRegisterExtModuleFunction()

int xsltRegisterExtModuleFunction ( const xmlChar name,
const xmlChar URI,
xmlXPathFunction  function 
)

Definition at line 1385 of file extensions.c.

1387 {
1388  if ((name == NULL) || (URI == NULL) || (function == NULL))
1389  return (-1);
1390 
1391  if (xsltFunctionsHash == NULL)
1393  if (xsltFunctionsHash == NULL)
1394  return (-1);
1395 
1397 
1399  XML_CAST_FPTR(function), NULL);
1400 
1402 
1403  return (0);
1404 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
XMLPUBFUN int XMLCALL xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator f)
Definition: hash.c:443
static xmlHashTablePtr xsltFunctionsHash
Definition: extensions.c:68
#define XML_CAST_FPTR(fptr)
Definition: hash.h:56
Definition: name.c:36

Referenced by xsltRegisterAllExtras(), and xsltRegisterTestModule().

◆ xsltRegisterExtModuleTopLevel()

int xsltRegisterExtModuleTopLevel ( const xmlChar name,
const xmlChar URI,
xsltTopLevelFunction  function 
)

Definition at line 1825 of file extensions.c.

1827 {
1828  if ((name == NULL) || (URI == NULL) || (function == NULL))
1829  return (-1);
1830 
1831  if (xsltTopLevelsHash == NULL)
1833  if (xsltTopLevelsHash == NULL)
1834  return (-1);
1835 
1837 
1839  XML_CAST_FPTR(function), NULL);
1840 
1842 
1843  return (0);
1844 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
static xmlHashTablePtr xsltTopLevelsHash
Definition: extensions.c:70
XMLPUBFUN int XMLCALL xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator f)
Definition: hash.c:443
#define XML_CAST_FPTR(fptr)
Definition: hash.h:56
Definition: name.c:36

◆ xsltRegisterExtPrefix()

int xsltRegisterExtPrefix ( xsltStylesheetPtr  style,
const xmlChar prefix,
const xmlChar URI 
)

xsltRegisterExtPrefix: @style: an XSLT stylesheet @prefix: the prefix used (optional) @URI: the URI associated to the extension

Registers an extension namespace This is called from xslt.c during compile-time. The given prefix is not needed. Called by: xsltParseExtElemPrefixes() (new function) xsltRegisterExtPrefix() (old function)

Returns 0 in case of success, 1 if the @URI was already registered as an extension namespace and -1 in case of failure

Definition at line 503 of file extensions.c.

505 {
506  xsltExtDefPtr def, ret;
507 
508  if ((style == NULL) || (URI == NULL))
509  return (-1);
510 
511 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
513  "Registering extension namespace '%s'.\n", URI);
514 #endif
515  def = (xsltExtDefPtr) style->nsDefs;
516 #ifdef XSLT_REFACTORED
517  /*
518  * The extension is associated with a namespace name.
519  */
520  while (def != NULL) {
521  if (xmlStrEqual(URI, def->URI))
522  return (1);
523  def = def->next;
524  }
525 #else
526  while (def != NULL) {
527  if (xmlStrEqual(prefix, def->prefix))
528  return (-1);
529  def = def->next;
530  }
531 #endif
532  ret = xsltNewExtDef(prefix, URI);
533  if (ret == NULL)
534  return (-1);
535  ret->next = (xsltExtDefPtr) style->nsDefs;
536  style->nsDefs = ret;
537 
538  /*
539  * check whether there is an extension module with a stylesheet
540  * initialization function.
541  */
542 #ifdef XSLT_REFACTORED
543  /*
544  * Don't initialize modules based on specified namespaces via
545  * the attribute "[xsl:]extension-element-prefixes".
546  */
547 #else
548  if (xsltExtensionsHash != NULL) {
550 
554  if (NULL == module) {
555  if (!xsltExtModuleRegisterDynamic(URI)) {
559  }
560  }
561  if (module != NULL) {
563  }
564  }
565 #endif
566  return (0);
567 }
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:67
HMODULE module
Definition: main.cpp:47
void * xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:756
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
xsltExtDef * xsltExtDefPtr
Definition: extensions.c:36
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
xmlChar * prefix
Definition: extensions.c:39
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
xmlChar * URI
Definition: extensions.c:40
while(1)
Definition: macro.lex.yy.c:740
static int xsltExtModuleRegisterDynamic(const xmlChar *URI ATTRIBUTE_UNUSED)
Definition: extensions.c:459
struct _xsltExtDef * next
Definition: extensions.c:38
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
if(!(yy_init))
Definition: macro.lex.yy.c:714
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
int ret
static xsltExtDefPtr xsltNewExtDef(const xmlChar *prefix, const xmlChar *URI)
Definition: extensions.c:90
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:157
Arabic default style
Definition: afstyles.h:93

Referenced by xsltParseStylesheetExtPrefix().

◆ xsltRegisterTestModule()

void xsltRegisterTestModule ( void  )

xsltRegisterTestModule:

Registers the test module

Definition at line 2231 of file extensions.c.

2232 {
2233  xsltInitGlobals();
2238  xsltRegisterExtModuleFunction((const xmlChar *) "test",
2239  (const xmlChar *) XSLT_DEFAULT_URL,
2241  xsltRegisterExtModuleElement((const xmlChar *) "test",
2242  (const xmlChar *) XSLT_DEFAULT_URL,
2245 }
static xsltElemPreCompPtr xsltExtElementPreCompTest(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
Definition: extensions.c:2027
static void xsltExtShutdownTest(xsltTransformContextPtr ctxt, const xmlChar *URI, void *data)
Definition: extensions.c:2157
#define XSLT_DEFAULT_URL
Definition: xslt.h:39
static void xsltExtStyleShutdownTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, const xmlChar *URI, void *data)
Definition: extensions.c:2208
static void * xsltExtStyleInitTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, const xmlChar *URI)
Definition: extensions.c:2184
int xsltRegisterExtModuleFunction(const xmlChar *name, const xmlChar *URI, xmlXPathFunction function)
Definition: extensions.c:1385
unsigned char xmlChar
Definition: xmlstring.h:28
static void xsltExtElementTest(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
Definition: extensions.c:2071
static void * xsltExtInitTest(xsltTransformContextPtr ctxt, const xmlChar *URI)
Definition: extensions.c:2123
static void xsltExtFunctionTest(xmlXPathParserContextPtr ctxt, int nargs ATTRIBUTE_UNUSED)
Definition: extensions.c:1977
int xsltRegisterExtModuleFull(const xmlChar *URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc)
Definition: extensions.c:1248
void xsltInitGlobals(void)
Definition: extensions.c:2263
int xsltRegisterExtModuleElement(const xmlChar *name, const xmlChar *URI, xsltPreComputeFunction precomp, xsltTransformFunction transform)
Definition: extensions.c:1623

◆ xsltShutdownCtxtExt()

static void xsltShutdownCtxtExt ( void payload,
void vctxt,
const xmlChar URI 
)
static

xsltShutdownCtxtExt: @data: the registered data for the module @ctxt: the XSLT transformation context @URI: the extension URI

Shutdown an extension module loaded

Definition at line 1055 of file extensions.c.

1056 {
1057  xsltExtDataPtr data = (xsltExtDataPtr) payload;
1060 
1061  if ((data == NULL) || (ctxt == NULL) || (URI == NULL))
1062  return;
1063  module = data->extModule;
1064  if ((module == NULL) || (module->shutdownFunc == NULL))
1065  return;
1066 
1067 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
1069  "Shutting down module : %s\n", URI);
1070 #endif
1071  module->shutdownFunc(ctxt, URI, data->extData);
1072 }
xsltExtData * xsltExtDataPtr
Definition: extensions.c:54
HMODULE module
Definition: main.cpp:47
xsltTransformContext * xsltTransformContextPtr
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by xsltShutdownCtxtExts().

◆ xsltShutdownCtxtExts()

void xsltShutdownCtxtExts ( xsltTransformContextPtr  ctxt)

xsltShutdownCtxtExts: @ctxt: an XSLT transformation context

Shutdown the set of modules loaded

Definition at line 1081 of file extensions.c.

1082 {
1083  if (ctxt == NULL)
1084  return;
1085  if (ctxt->extInfos == NULL)
1086  return;
1089  ctxt->extInfos = NULL;
1090 }
XMLPUBFUN void XMLCALL xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data)
Definition: hash.c:857
static void xsltShutdownCtxtExt(void *payload, void *vctxt, const xmlChar *URI)
Definition: extensions.c:1055
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
smooth NULL
Definition: ftsmooth.c:416
static void xsltFreeExtDataEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:237
xmlHashTablePtr extInfos

Referenced by xsltApplyStylesheetInternal(), and xsltFreeTransformContext().

◆ xsltShutdownExt()

static void xsltShutdownExt ( void payload,
void vctxt,
const xmlChar URI 
)
static

xsltShutdownExt: @data: the registered data for the module @ctxt: the XSLT stylesheet @URI: the extension URI

Shutdown an extension module loaded

Definition at line 1101 of file extensions.c.

1102 {
1103  xsltExtDataPtr data = (xsltExtDataPtr) payload;
1106 
1107  if ((data == NULL) || (style == NULL) || (URI == NULL))
1108  return;
1109  module = data->extModule;
1110  if ((module == NULL) || (module->styleShutdownFunc == NULL))
1111  return;
1112 
1113 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
1115  "Shutting down module : %s\n", URI);
1116 #endif
1117  module->styleShutdownFunc(style, URI, data->extData);
1118  /*
1119  * Don't remove the entry from the hash table here, since
1120  * this will produce segfaults - this fixes bug #340624.
1121  *
1122  * xmlHashRemoveEntry(style->extInfos, URI, xsltFreeExtDataEntry);
1123  */
1124 }
xsltExtData * xsltExtDataPtr
Definition: extensions.c:54
HMODULE module
Definition: main.cpp:47
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Arabic default style
Definition: afstyles.h:93
xsltStylesheet * xsltStylesheetPtr

Referenced by xsltShutdownExts().

◆ xsltShutdownExts()

void xsltShutdownExts ( xsltStylesheetPtr  style)

xsltShutdownExts: @style: an XSLT stylesheet

Shutdown the set of modules loaded

Definition at line 1133 of file extensions.c.

1134 {
1135  if (style == NULL)
1136  return;
1137  if (style->extInfos == NULL)
1138  return;
1139  xmlHashScan(style->extInfos, xsltShutdownExt, style);
1141  style->extInfos = NULL;
1142 }
XMLPUBFUN void XMLCALL xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data)
Definition: hash.c:857
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
smooth NULL
Definition: ftsmooth.c:416
static void xsltShutdownExt(void *payload, void *vctxt, const xmlChar *URI)
Definition: extensions.c:1101
static void xsltFreeExtDataEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:237
Arabic default style
Definition: afstyles.h:93

Referenced by xsltFreeStylesheet().

◆ xsltStyleGetExtData()

void* xsltStyleGetExtData ( xsltStylesheetPtr  style,
const xmlChar URI 
)

xsltStyleGetExtData: @style: an XSLT stylesheet @URI: the URI associated to the exension module

Retrieve the data associated to the extension module in this given stylesheet. Called by: xsltRegisterExtPrefix(), ( xsltExtElementPreCompTest(), xsltExtInitTest )

Returns the pointer or NULL if not present

Definition at line 756 of file extensions.c.

757 {
758  xsltExtDataPtr dataContainer = NULL;
759  xsltStylesheetPtr tmpStyle;
760 
761  if ((style == NULL) || (URI == NULL) ||
763  return (NULL);
764 
765 
766 #ifdef XSLT_REFACTORED
767  /*
768  * This is intended for global storage, so only the main
769  * stylesheet will hold the data.
770  */
771  tmpStyle = style;
772  while (tmpStyle->parent != NULL)
773  tmpStyle = tmpStyle->parent;
774  if (tmpStyle->extInfos != NULL) {
775  dataContainer =
776  (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
777  if (dataContainer != NULL) {
778  /*
779  * The module was already initialized in the context
780  * of this stylesheet; just return the user-data that
781  * comes with it.
782  */
783  return(dataContainer->extData);
784  }
785  }
786 #else
787  /*
788  * Old behaviour.
789  */
790  tmpStyle = style;
791  while (tmpStyle != NULL) {
792  if (tmpStyle->extInfos != NULL) {
793  dataContainer =
794  (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
795  if (dataContainer != NULL) {
796  return(dataContainer->extData);
797  }
798  }
799  tmpStyle = xsltNextImport(tmpStyle);
800  }
801  tmpStyle = style;
802 #endif
803 
804  dataContainer =
806  if (dataContainer != NULL)
807  return (dataContainer->extData);
808  return(NULL);
809 }
xsltExtData * xsltExtDataPtr
Definition: extensions.c:54
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:67
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:250
xmlHashTablePtr extInfos
struct _xsltStylesheet * parent
smooth NULL
Definition: ftsmooth.c:416
void * extData
Definition: extensions.c:57
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
Arabic default style
Definition: afstyles.h:93
static xsltExtDataPtr xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:663

Referenced by xsltExtElementPreCompTest(), xsltExtInitTest(), and xsltRegisterExtPrefix().

◆ xsltStyleInitializeStylesheetModule()

static xsltExtDataPtr xsltStyleInitializeStylesheetModule ( xsltStylesheetPtr  style,
const xmlChar URI 
)
static

xsltStyleGetStylesheetExtData: @style: an XSLT stylesheet @URI: the URI associated to the exension module

Fires the compile-time initialization callback of an extension module and returns a container holding the user-data (retrieved via the callback).

Returns the create module-data container or NULL if such a module was not registered.

Definition at line 663 of file extensions.c.

665 {
666  xsltExtDataPtr dataContainer;
667  void *userData = NULL;
669 
670  if ((style == NULL) || (URI == NULL))
671  return(NULL);
672 
673  if (xsltExtensionsHash == NULL) {
674 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
676  "Not registered extension module: %s\n", URI);
677 #endif
678  return(NULL);
679  }
680 
682 
684 
686 
687  if (module == NULL) {
688 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
690  "Not registered extension module: %s\n", URI);
691 #endif
692  return (NULL);
693  }
694  /*
695  * The specified module was registered so initialize it.
696  */
697  if (style->extInfos == NULL) {
698  style->extInfos = xmlHashCreate(10);
699  if (style->extInfos == NULL)
700  return (NULL);
701  }
702  /*
703  * Fire the initialization callback if available.
704  */
705  if (module->styleInitFunc == NULL) {
706 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
708  "Initializing module with *no* callback: %s\n", URI);
709 #endif
710  } else {
711 #ifdef WITH_XSLT_DEBUG_EXTENSIONS
713  "Initializing module with callback: %s\n", URI);
714 #endif
715  /*
716  * Fire the initialization callback.
717  */
718  userData = module->styleInitFunc(style, URI);
719  }
720  /*
721  * Store the user-data in the context of the given stylesheet.
722  */
723  dataContainer = xsltNewExtData(module, userData);
724  if (dataContainer == NULL)
725  return (NULL);
726 
727  if (xmlHashAddEntry(style->extInfos, URI,
728  (void *) dataContainer) < 0)
729  {
731  "Failed to register module '%s'.\n", URI);
732  style->errors++;
733  if (module->styleShutdownFunc)
734  module->styleShutdownFunc(style, URI, userData);
735  xsltFreeExtData(dataContainer);
736  return (NULL);
737  }
738 
739  return(dataContainer);
740 }
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:67
HMODULE module
Definition: main.cpp:47
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
XMLPUBFUN int XMLCALL xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata)
Definition: hash.c:387
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
void * xsltGenericDebugContext
Definition: xsltutils.c:549
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:174
static xsltExtDataPtr xsltNewExtData(xsltExtModulePtr extModule, void *extData)
Definition: extensions.c:205
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:459
static void xsltFreeExtData(xsltExtDataPtr ext)
Definition: extensions.c:229
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
Arabic default style
Definition: afstyles.h:93

Referenced by xsltStyleGetExtData().

◆ xsltUnregisterAllExtModuleElement()

static void xsltUnregisterAllExtModuleElement ( void  )
static

xsltUnregisterAllExtModuleElement:

Unregisters all extension module element

Definition at line 1804 of file extensions.c.

1805 {
1807 
1810 
1812 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
smooth NULL
Definition: ftsmooth.c:416
static void xsltFreeExtElementEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:286
static xmlHashTablePtr xsltElementsHash
Definition: extensions.c:69

Referenced by xsltCleanupGlobals().

◆ xsltUnregisterAllExtModuleFunction()

static void xsltUnregisterAllExtModuleFunction ( void  )
static

xsltUnregisterAllExtModuleFunction:

Unregisters all extension module function

Definition at line 1476 of file extensions.c.

1477 {
1479 
1482 
1484 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
smooth NULL
Definition: ftsmooth.c:416
static xmlHashTablePtr xsltFunctionsHash
Definition: extensions.c:68

Referenced by xsltCleanupGlobals().

◆ xsltUnregisterAllExtModules()

static void xsltUnregisterAllExtModules ( void  )
static

xsltUnregisterAllExtModules:

Unregister all the XSLT extension module from the library.

Definition at line 1341 of file extensions.c.

1342 {
1343  if (xsltExtensionsHash == NULL)
1344  return;
1345 
1347 
1350 
1352 }
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:67
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
smooth NULL
Definition: ftsmooth.c:416
static void xsltFreeExtModuleEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:191

Referenced by xsltCleanupGlobals().

◆ xsltUnregisterAllExtModuleTopLevel()

static void xsltUnregisterAllExtModuleTopLevel ( void  )
static

xsltUnregisterAllExtModuleTopLevel:

Unregisters all extension module function

Definition at line 1915 of file extensions.c.

1916 {
1918 
1921 
1923 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:320
smooth NULL
Definition: ftsmooth.c:416
static xmlHashTablePtr xsltTopLevelsHash
Definition: extensions.c:70

Referenced by xsltCleanupGlobals().

◆ xsltUnregisterExtModule()

int xsltUnregisterExtModule ( const xmlChar URI)

xsltUnregisterExtModule: @URI: URI associated to this module

Unregister an XSLT extension module from the library.

Returns 0 if sucessful, -1 in case of error

Definition at line 1317 of file extensions.c.

1318 {
1319  int ret;
1320 
1321  if (URI == NULL)
1322  return (-1);
1323  if (xsltExtensionsHash == NULL)
1324  return (-1);
1325 
1327 
1329 
1331 
1332  return (ret);
1333 }
XMLPUBFUN int XMLCALL xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, xmlHashDeallocator f)
Definition: hash.c:1050
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:67
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
static void xsltFreeExtModuleEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:191
int ret

◆ xsltUnregisterExtModuleElement()

int xsltUnregisterExtModuleElement ( const xmlChar name,
const xmlChar URI 
)

Definition at line 1781 of file extensions.c.

1782 {
1783  int ret;
1784 
1785  if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
1786  return (-1);
1787 
1789 
1792 
1794 
1795  return(ret);
1796 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f)
Definition: hash.c:1069
static void xsltFreeExtElementEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:286
int ret
Definition: name.c:36
static xmlHashTablePtr xsltElementsHash
Definition: extensions.c:69

◆ xsltUnregisterExtModuleFunction()

int xsltUnregisterExtModuleFunction ( const xmlChar name,
const xmlChar URI 
)

Definition at line 1454 of file extensions.c.

1455 {
1456  int ret;
1457 
1458  if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL))
1459  return (-1);
1460 
1462 
1464 
1466 
1467  return(ret);
1468 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f)
Definition: hash.c:1069
int ret
static xmlHashTablePtr xsltFunctionsHash
Definition: extensions.c:68
Definition: name.c:36

◆ xsltUnregisterExtModuleTopLevel()

int xsltUnregisterExtModuleTopLevel ( const xmlChar name,
const xmlChar URI 
)

Definition at line 1893 of file extensions.c.

1894 {
1895  int ret;
1896 
1897  if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL))
1898  return (-1);
1899 
1901 
1903 
1905 
1906  return(ret);
1907 }
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:257
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:229
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f)
Definition: hash.c:1069
int ret
static xmlHashTablePtr xsltTopLevelsHash
Definition: extensions.c:70
Definition: name.c:36

◆ xsltXPathGetTransformContext()

xsltTransformContextPtr xsltXPathGetTransformContext ( xmlXPathParserContextPtr  ctxt)

xsltXPathGetTransformContext: @ctxt: an XPath transformation context

Provides the XSLT transformation context from the XPath transformation context. This is useful when an XPath function in the extension module is called by the XPath interpreter and that the XSLT context is needed for example to retrieve the associated data pertaining to this XSLT transformation.

Returns the XSLT transformation context or NULL in case of error.

Definition at line 1367 of file extensions.c.

1368 {
1369  if ((ctxt == NULL) || (ctxt->context == NULL))
1370  return (NULL);
1371  return (ctxt->context->extra);
1372 }
smooth NULL
Definition: ftsmooth.c:416

Referenced by xsltCurrentFunction(), xsltDocumentFunction(), xsltDocumentFunctionLoadDocument(), xsltElementAvailableFunction(), xsltExtFunctionTest(), xsltFormatNumberFunction(), xsltFunctionAvailableFunction(), xsltFunctionNodeSet(), xsltGenerateIdFunction(), xsltKeyFunction(), and xsltSystemPropertyFunction().

Variable Documentation

◆ testData

xmlChar* testData = NULL
static

◆ testStyleData

xmlChar* testStyleData = NULL
static

◆ xsltElementsHash

◆ xsltExtensionsHash

◆ xsltExtMutex

◆ xsltFunctionsHash

◆ xsltModuleHash

xmlHashTablePtr xsltModuleHash = NULL
static

Definition at line 71 of file extensions.c.

Referenced by xsltCleanupGlobals().

◆ xsltTopLevelsHash