libxslt r1476 - in trunk: . libxslt win32
- From: veillard svn gnome org
- To: svn-commits-list gnome org
- Subject: libxslt r1476 - in trunk: . libxslt win32
- Date: Tue, 3 Jun 2008 16:40:54 +0000 (UTC)
Author: veillard
Date: Tue Jun 3 16:40:54 2008
New Revision: 1476
URL: http://svn.gnome.org/viewvc/libxslt?rev=1476&view=rev
Log:
* configure.in libxslt/extra.c libxslt/Makefile.am libxslt/preproc.c
libxslt/xsltInternals.h libxslt/xsltlocale.c libxslt/xsltlocale.h
libxslt/xsltutils.c win32/Makefile.mingw win32/Makefile.msvc: patch
from Nick Wellnhofer adding xsl:sort lang support using the locale
support from the C library.
Daniel
Modified:
trunk/ChangeLog
trunk/config.h.in
trunk/configure.in
trunk/libxslt/Makefile.am
trunk/libxslt/extra.c
trunk/libxslt/preproc.c
trunk/libxslt/xsltInternals.h
trunk/libxslt/xsltutils.c
trunk/win32/Makefile.mingw
trunk/win32/Makefile.msvc
Modified: trunk/config.h.in
==============================================================================
--- trunk/config.h.in (original)
+++ trunk/config.h.in Tue Jun 3 16:40:54 2008
@@ -123,6 +123,9 @@
/* Define to 1 if you have the `vsprintf' function. */
#undef HAVE_VSPRINTF
+/* Have working xlocale.h */
+#undef HAVE_XLOCALE_H
+
/* Define to 1 if you have the `_stat' function. */
#undef HAVE__STAT
@@ -150,6 +153,11 @@
/* Version number of package */
#undef VERSION
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+
/* Using the Win32 Socket implementation */
#undef _WINSOCKAPI_
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Tue Jun 3 16:40:54 2008
@@ -3,6 +3,7 @@
AC_INIT(libxslt/xslt.c)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_HOST
+AC_GNU_SOURCE
dnl
dnl libxslt is the main part of the package
@@ -105,6 +106,48 @@
AC_STDC_HEADERS
AM_PROG_LIBTOOL
+AC_MSG_CHECKING([for working xlocale.h])
+AC_TRY_RUN(
+[
+#include <locale.h>
+#include <xlocale.h>
+#include <string.h>
+#include <stdlib.h>
+
+#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 2
+#define locale_t __locale_t
+#define newlocale __newlocale
+#define freelocale __freelocale
+#define strxfrm_l __strxfrm_l
+#define LC_COLLATE_MASK (1 << LC_COLLATE)
+#endif
+
+int main()
+{
+ locale_t locale;
+ const char *src[2] = { "\xc3\x84rger", "Zeppelin" };
+ char *dst[2];
+ size_t len, r;
+ int i;
+
+ locale = newlocale(LC_COLLATE_MASK, "en_US.utf8", NULL);
+ if (locale == NULL) exit(1);
+ for (i=0; i<2; ++i) {
+ len = strxfrm_l(NULL, src[i], 0, locale) + 1;
+ dst[i] = malloc(len);
+ if(dst[i] == NULL) exit(1);
+ r = strxfrm_l(dst[i], src[i], len, locale);
+ if(r >= len) exit(1);
+ }
+ if (strcmp(dst[0], dst[1]) >= 0) exit(1);
+
+ exit(0);
+}
+],
+ [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_XLOCALE_H, 1, [Have working xlocale.h])],
+ [AC_MSG_RESULT(no)]
+)
+
dnl
dnl Math detection
dnl
Modified: trunk/libxslt/Makefile.am
==============================================================================
--- trunk/libxslt/Makefile.am (original)
+++ trunk/libxslt/Makefile.am Tue Jun 3 16:40:54 2008
@@ -24,11 +24,13 @@
security.h \
xsltInternals.h \
xsltconfig.h \
- xsltexports.h
+ xsltexports.h \
+ xsltlocale.h
libxslt_la_SOURCES = \
attrvt.c \
xslt.c \
+ xsltlocale.c \
xsltutils.c \
pattern.c \
templates.c \
Modified: trunk/libxslt/extra.c
==============================================================================
--- trunk/libxslt/extra.c (original)
+++ trunk/libxslt/extra.c Tue Jun 3 16:40:54 2008
@@ -15,7 +15,6 @@
#include <string.h>
#ifdef HAVE_TIME_H
-#define __USE_XOPEN
#include <time.h>
#endif
#ifdef HAVE_STDLIB_H
Modified: trunk/libxslt/preproc.c
==============================================================================
--- trunk/libxslt/preproc.c (original)
+++ trunk/libxslt/preproc.c Tue Jun 3 16:40:54 2008
@@ -391,6 +391,8 @@
break;
case XSLT_FUNC_SORT: {
xsltStyleItemSortPtr item = (xsltStyleItemSortPtr) comp;
+ if (item->locale != NULL)
+ xsltFreeLocale(item->locale);
if (item->comp != NULL)
xmlXPathFreeCompExpr(item->comp);
}
@@ -487,6 +489,8 @@
break;
}
#else
+ if (comp->locale != NULL)
+ xsltFreeLocale(comp->locale);
if (comp->comp != NULL)
xmlXPathFreeCompExpr(comp->comp);
if (comp->nsList != NULL)
@@ -728,6 +732,12 @@
comp->lang = xsltEvalStaticAttrValueTemplate(style, inst,
(const xmlChar *)"lang",
NULL, &comp->has_lang);
+ if (comp->lang != NULL) {
+ comp->locale = xsltNewLocale(comp->lang);
+ }
+ else {
+ comp->locale = NULL;
+ }
comp->select = xsltGetCNsProp(style, inst,(const xmlChar *)"select", XSLT_NAMESPACE);
if (comp->select == NULL) {
Modified: trunk/libxslt/xsltInternals.h
==============================================================================
--- trunk/libxslt/xsltInternals.h (original)
+++ trunk/libxslt/xsltInternals.h Tue Jun 3 16:40:54 2008
@@ -21,6 +21,7 @@
#include <libxml/xmlstring.h>
#include <libxslt/xslt.h>
#include "xsltexports.h"
+#include "xsltlocale.h"
#include "numbersInternals.h"
#ifdef __cplusplus
@@ -1045,6 +1046,7 @@
int descending; /* sort */
const xmlChar *lang; /* sort */
int has_lang; /* sort */
+ xsltLocale locale; /* sort */
const xmlChar *case_order; /* sort */
int lower_first; /* sort */
@@ -1381,6 +1383,7 @@
int descending; /* sort */
const xmlChar *lang; /* sort */
int has_lang; /* sort */
+ xsltLocale locale; /* sort */
const xmlChar *case_order; /* sort */
int lower_first; /* sort */
Modified: trunk/libxslt/xsltutils.c
==============================================================================
--- trunk/libxslt/xsltutils.c (original)
+++ trunk/libxslt/xsltutils.c Tue Jun 3 16:40:54 2008
@@ -1039,6 +1039,12 @@
}
} else {
if (res->type == XPATH_STRING) {
+ if (comp->locale != NULL) {
+ xmlChar *str = res->stringval;
+ res->stringval = (xmlChar *) xsltStrxfrm(comp->locale, str);
+ xmlFree(str);
+ }
+
results[i] = res;
} else {
#ifdef WITH_XSLT_DEBUG_PROCESS
@@ -1191,6 +1197,10 @@
results[j + incr]->floatval)
tst = 1;
else tst = -1;
+ } else if(comp->locale != NULL) {
+ tst = xsltLocaleStrcmp(
+ (xsltLocaleChar *) results[j]->stringval,
+ (xsltLocaleChar *) results[j + incr]->stringval);
} else {
tst = xmlStrcmp(results[j]->stringval,
results[j + incr]->stringval);
@@ -1245,6 +1255,10 @@
res[j + incr]->floatval)
tst = 1;
else tst = -1;
+ } else if(comp->locale != NULL) {
+ tst = xsltLocaleStrcmp(
+ (xsltLocaleChar *) res[j]->stringval,
+ (xsltLocaleChar *) res[j + incr]->stringval);
} else {
tst = xmlStrcmp(res[j]->stringval,
res[j + incr]->stringval);
Modified: trunk/win32/Makefile.mingw
==============================================================================
--- trunk/win32/Makefile.mingw (original)
+++ trunk/win32/Makefile.mingw Tue Jun 3 16:40:54 2008
@@ -87,6 +87,7 @@
$(XSLT_INTDIR)/transform.o\
$(XSLT_INTDIR)/variables.o\
$(XSLT_INTDIR)/xslt.o\
+ $(XSLT_INTDIR)/xsltlocale.o\
$(XSLT_INTDIR)/xsltutils.o
XSLT_SRCS = $(subst .o,.c,$(subst $(XSLT_INTDIR),$(XSLT_SRCDIR),$(XSLT_OBJS)))
@@ -107,6 +108,7 @@
$(XSLT_INTDIR_A)/transform.o\
$(XSLT_INTDIR_A)/variables.o\
$(XSLT_INTDIR_A)/xslt.o\
+ $(XSLT_INTDIR_A)/xsltlocale.o\
$(XSLT_INTDIR_A)/xsltutils.o
# Libexslt object files.
Modified: trunk/win32/Makefile.msvc
==============================================================================
--- trunk/win32/Makefile.msvc (original)
+++ trunk/win32/Makefile.msvc Tue Jun 3 16:40:54 2008
@@ -53,6 +53,7 @@
CC = cl.exe
CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /W3 $(CRUNTIME) /D "_REENTRANT"
CFLAGS = $(CFLAGS) /I$(BASEDIR) /I$(XSLT_SRCDIR) /I$(INCPREFIX)
+CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
# The linker and its options.
LD = link.exe
@@ -90,6 +91,7 @@
$(XSLT_INTDIR)\transform.obj\
$(XSLT_INTDIR)\variables.obj\
$(XSLT_INTDIR)\xslt.obj\
+ $(XSLT_INTDIR)\xsltlocale.obj\
$(XSLT_INTDIR)\xsltutils.obj\
$(XSLT_INTDIR)\attrvt.obj
@@ -110,6 +112,7 @@
$(XSLT_INTDIR_A)\transform.obj\
$(XSLT_INTDIR_A)\variables.obj\
$(XSLT_INTDIR_A)\xslt.obj\
+ $(XSLT_INTDIR_A)\xsltlocale.obj\
$(XSLT_INTDIR_A)\xsltutils.obj\
$(XSLT_INTDIR_A)\attrvt.obj
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]