| OLD | NEW |
| 1 /* | 1 /* |
| 2 * extensions.c: Implemetation of the extensions support | 2 * extensions.c: Implemetation of the extensions support |
| 3 * | 3 * |
| 4 * Reference: | 4 * Reference: |
| 5 * http://www.w3.org/TR/1999/REC-xslt-19991116 | 5 * http://www.w3.org/TR/1999/REC-xslt-19991116 |
| 6 * | 6 * |
| 7 * See Copyright for the status of this software. | 7 * See Copyright for the status of this software. |
| 8 * | 8 * |
| 9 * daniel@veillard.com | 9 * daniel@veillard.com |
| 10 */ | 10 */ |
| (...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 * | 1615 * |
| 1616 * Registers an extension module element. | 1616 * Registers an extension module element. |
| 1617 * | 1617 * |
| 1618 * Returns 0 if successful, -1 in case of error. | 1618 * Returns 0 if successful, -1 in case of error. |
| 1619 */ | 1619 */ |
| 1620 int | 1620 int |
| 1621 xsltRegisterExtModuleElement(const xmlChar * name, const xmlChar * URI, | 1621 xsltRegisterExtModuleElement(const xmlChar * name, const xmlChar * URI, |
| 1622 xsltPreComputeFunction precomp, | 1622 xsltPreComputeFunction precomp, |
| 1623 xsltTransformFunction transform) | 1623 xsltTransformFunction transform) |
| 1624 { | 1624 { |
| 1625 int ret; | 1625 int ret = 0; |
| 1626 | 1626 |
| 1627 xsltExtElementPtr ext; | 1627 xsltExtElementPtr ext; |
| 1628 | 1628 |
| 1629 if ((name == NULL) || (URI == NULL) || (transform == NULL)) | 1629 if ((name == NULL) || (URI == NULL) || (transform == NULL)) |
| 1630 return (-1); | 1630 return (-1); |
| 1631 | 1631 |
| 1632 if (xsltElementsHash == NULL) | 1632 if (xsltElementsHash == NULL) |
| 1633 xsltElementsHash = xmlHashCreate(10); | 1633 xsltElementsHash = xmlHashCreate(10); |
| 1634 if (xsltElementsHash == NULL) | 1634 if (xsltElementsHash == NULL) |
| 1635 return (-1); | 1635 return (-1); |
| 1636 | 1636 |
| 1637 xmlMutexLock(xsltExtMutex); | 1637 xmlMutexLock(xsltExtMutex); |
| 1638 | 1638 |
| 1639 ext = xsltNewExtElement(precomp, transform); | 1639 ext = xsltNewExtElement(precomp, transform); |
| 1640 if (ext == NULL) { | 1640 if (ext == NULL) { |
| 1641 ret = -1; | 1641 ret = -1; |
| 1642 goto done; | 1642 goto done; |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 xmlHashUpdateEntry2(xsltElementsHash, name, URI, (void *) ext, | 1645 xmlHashUpdateEntry2(xsltElementsHash, name, URI, (void *) ext, |
| 1646 (xmlHashDeallocator) xsltFreeExtElement); | 1646 (xmlHashDeallocator) xsltFreeExtElement); |
| 1647 | 1647 |
| 1648 done: | 1648 done: |
| 1649 xmlMutexUnlock(xsltExtMutex); | 1649 xmlMutexUnlock(xsltExtMutex); |
| 1650 | 1650 |
| 1651 return (0); | 1651 return (ret); |
| 1652 } | 1652 } |
| 1653 | 1653 |
| 1654 /** | 1654 /** |
| 1655 * xsltExtElementLookup: | 1655 * xsltExtElementLookup: |
| 1656 * @ctxt: an XSLT process context | 1656 * @ctxt: an XSLT process context |
| 1657 * @name: the element name | 1657 * @name: the element name |
| 1658 * @URI: the element namespace URI | 1658 * @URI: the element namespace URI |
| 1659 * | 1659 * |
| 1660 * Looks up an extension element. @ctxt can be NULL to search only in | 1660 * Looks up an extension element. @ctxt can be NULL to search only in |
| 1661 * module elements. | 1661 * module elements. |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2353 else { | 2353 else { |
| 2354 fprintf(output, "\nRegistered Extension Modules:\n"); | 2354 fprintf(output, "\nRegistered Extension Modules:\n"); |
| 2355 xmlMutexLock(xsltExtMutex); | 2355 xmlMutexLock(xsltExtMutex); |
| 2356 xmlHashScanFull(xsltExtensionsHash, | 2356 xmlHashScanFull(xsltExtensionsHash, |
| 2357 (xmlHashScannerFull) | 2357 (xmlHashScannerFull) |
| 2358 xsltDebugDumpExtModulesCallback, output); | 2358 xsltDebugDumpExtModulesCallback, output); |
| 2359 xmlMutexUnlock(xsltExtMutex); | 2359 xmlMutexUnlock(xsltExtMutex); |
| 2360 } | 2360 } |
| 2361 | 2361 |
| 2362 } | 2362 } |
| OLD | NEW |