changeset 2168:caaf4b1a8487 trunk

[svn] - allow user to choose a regex library between gnu (default), oniguruma, pcre (experimental); oniguruma and pcre support utf-8 encoding
author giacomo
date Mon, 18 Dec 2006 13:11:23 -0800
parents 92f063d73948
children 0934eeabc0ed
files ChangeLog audacious/Makefile audacious/mainwin.c audacious/playlist.c configure.ac mk/rules.mk.in
diffstat 6 files changed, 127 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 18 11:59:00 2006 -0800
+++ b/ChangeLog	Mon Dec 18 13:11:23 2006 -0800
@@ -1,3 +1,38 @@
+2006-12-18 19:59:00 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [3339]
+  - run update-po
+  - update welsh translation: 408 translated messages, 33 untranslated messages.
+  
+  trunk/po/audacious.pot |  547 +++++-----
+  trunk/po/br.po         |  615 ++++++-----
+  trunk/po/cs.po         |  721 ++++++++-----
+  trunk/po/cy.po         | 2629 +++++++------------------------------------------
+  trunk/po/de.po         |  736 ++++++++-----
+  trunk/po/el.po         |  729 ++++++++-----
+  trunk/po/es.po         |  728 ++++++++-----
+  trunk/po/fi.po         |  758 ++++++++------
+  trunk/po/fr.po         |  718 ++++++++-----
+  trunk/po/hi.po         |  721 ++++++++-----
+  trunk/po/hu.po         |  728 ++++++++-----
+  trunk/po/it.po         |  724 ++++++++-----
+  trunk/po/ja.po         |  727 ++++++++-----
+  trunk/po/ka.po         |  719 ++++++++-----
+  trunk/po/ko.po         |  713 ++++++++-----
+  trunk/po/lt.po         |  723 ++++++++-----
+  trunk/po/mk.po         |  723 ++++++++-----
+  trunk/po/nl.po         |  731 ++++++++-----
+  trunk/po/pl.po         |  731 ++++++++-----
+  trunk/po/pt_BR.po      |  713 ++++++++-----
+  trunk/po/ro.po         |  688 +++++++-----
+  trunk/po/ru.po         |  723 ++++++++-----
+  trunk/po/sk.po         |  713 ++++++++-----
+  trunk/po/sv.po         |  718 ++++++++-----
+  trunk/po/uk.po         |  722 ++++++++-----
+  trunk/po/zh_CN.po      |  723 ++++++++-----
+  trunk/po/zh_TW.po      |  721 ++++++++-----
+  27 files changed, 11726 insertions(+), 9416 deletions(-)
+
+
 2006-12-18 18:57:11 +0000  William Pitcock <nenolod@nenolod.net>
   revision [3337]
   - voiceprint fixes from Troels Bang Jensen.
--- a/audacious/Makefile	Mon Dec 18 11:59:00 2006 -0800
+++ b/audacious/Makefile	Mon Dec 18 13:11:23 2006 -0800
@@ -16,6 +16,7 @@
 	$(CHARDET_LIBS) \
 	$(GTK_LIBS)      \
 	$(LIBGLADE_LIBS) \
+	$(REGEX_LIBS)    \
 	./widgets/libwidgets.a
 
 CFLAGS += \
@@ -23,6 +24,7 @@
 	$(LIBGLADE_CFLAGS) \
 	$(BEEP_DEFINES)    \
 	$(ARCH_DEFINES)    \
+	$(REGEX_CFLAGS)    \
 	-D_AUDACIOUS_CORE \
 	-I..    \
 	-I../intl
--- a/audacious/mainwin.c	Mon Dec 18 11:59:00 2006 -0800
+++ b/audacious/mainwin.c	Mon Dec 18 13:11:23 2006 -0800
@@ -42,7 +42,14 @@
 #include <X11/Xlib.h>
 
 #include <sys/types.h>
-#include <regex.h>
+
+#if defined(USE_REGEX_ONIGURUMA)
+  #include <onigposix.h>
+#elif defined(USE_REGEX_PCRE)
+  #include <pcreposix.h>
+#else
+  #include <regex.h>
+#endif
 
 #include "widgets/widgetcore.h"
 #include "mainwin.h"
@@ -1959,7 +1966,11 @@
     while ( words[++i] != NULL )
     {
         regex_t *regex = g_malloc(sizeof(regex_t));
+    #if defined(USE_REGEX_PCRE)
+        if ( regcomp( regex , words[i] , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 )
+    #else
         if ( regcomp( regex , words[i] , REG_NOSUB | REG_ICASE ) == 0 )
+    #endif
             regex_list = g_slist_append( regex_list , regex );
     }
 
@@ -2072,6 +2083,12 @@
         return;
     }
 
+    #if defined(USE_REGEX_ONIGURUMA)
+    /* set encoding for Oniguruma regex to UTF-8 */
+    reg_set_encoding( REG_POSIX_ENCODING_UTF8 );
+    onig_set_default_syntax( ONIG_SYNTAX_POSIX_BASIC );
+    #endif
+
     mainwin_jtf = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     gtk_window_set_type_hint(GTK_WINDOW(mainwin_jtf),
                              GDK_WINDOW_TYPE_HINT_DIALOG);
--- a/audacious/playlist.c	Mon Dec 18 11:59:00 2006 -0800
+++ b/audacious/playlist.c	Mon Dec 18 13:11:23 2006 -0800
@@ -38,7 +38,14 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/errno.h>
-#include <regex.h>
+
+#if defined(USE_REGEX_ONIGURUMA)
+  #include <onigposix.h>
+#elif defined(USE_REGEX_PCRE)
+  #include <pcreposix.h>
+#else
+  #include <regex.h>
+#endif
 
 #include "input.h"
 #include "main.h"
@@ -2715,6 +2722,12 @@
     gboolean is_first_search = TRUE;
     gint num_of_entries_found = 0;
 
+    #if defined(USE_REGEX_ONIGURUMA)
+    /* set encoding for Oniguruma regex to UTF-8 */
+    reg_set_encoding( REG_POSIX_ENCODING_UTF8 );
+    onig_set_default_syntax( ONIG_SYNTAX_POSIX_BASIC );
+    #endif
+
     PLAYLIST_LOCK(playlist->mutex);
 
     if ( tuple->track_name != NULL )
@@ -2722,7 +2735,11 @@
         /* match by track_name */
         const gchar *regex_pattern = tuple->track_name;
         regex_t regex;
+    #if defined(USE_REGEX_PCRE)
+        if ( regcomp( &regex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 )
+    #else
         if ( regcomp( &regex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 )
+    #endif
         {
             GList *tfound_list = NULL;
             if ( is_first_search == TRUE ) entry_list = playlist->entries;
@@ -2748,7 +2765,11 @@
         /* match by album_name */
         const gchar *regex_pattern = tuple->album_name;
         regex_t regex;
+    #if defined(USE_REGEX_PCRE)
+        if ( regcomp( &regex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 )
+    #else
         if ( regcomp( &regex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 )
+    #endif
         {
             GList *tfound_list = NULL;
             if ( is_first_search == TRUE ) entry_list = playlist->entries;
@@ -2774,7 +2795,11 @@
         /* match by performer */
         const gchar *regex_pattern = tuple->performer;
         regex_t regex;
+    #if defined(USE_REGEX_PCRE)
+        if ( regcomp( &regex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 )
+    #else
         if ( regcomp( &regex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 )
+    #endif
         {
             GList *tfound_list = NULL;
             if ( is_first_search == TRUE ) entry_list = playlist->entries;
@@ -2800,7 +2825,11 @@
         /* match by file_name */
         const gchar *regex_pattern = tuple->file_name;
         regex_t regex;
+    #if defined(USE_REGEX_PCRE)
+        if ( regcomp( &regex , regex_pattern , REG_NOSUB | REG_ICASE | REG_UTF8 ) == 0 )
+    #else
         if ( regcomp( &regex , regex_pattern , REG_NOSUB | REG_ICASE ) == 0 )
+    #endif
         {
             GList *tfound_list = NULL;
             if ( is_first_search == TRUE ) entry_list = playlist->entries;
--- a/configure.ac	Mon Dec 18 11:59:00 2006 -0800
+++ b/configure.ac	Mon Dec 18 13:11:23 2006 -0800
@@ -189,6 +189,46 @@
 AC_SUBST(CHARDET_LIBS)
 AC_SUBST(SUBDIR_GUESS)
 
+dnl regex support (gnu/oniguruma/pcre)
+dnl ========================
+REGEX_LIBS=
+REGEX_CFLAGS=
+AC_ARG_WITH(regexlib,
+[
+  --with-regexlib[[=gnu/oniguruma/pcre]]   use the chosen regex library (default: gnu)
+],
+[case "${withval}" in
+  gnu)
+    AC_DEFINE(USE_REGEX_GNU,[1],[If this macro is defined, use GNU regex library.])
+    ;;
+  pcre)
+    PKG_CHECK_MODULES(LIBPCRE, [libpcre >= 6.7],
+        [
+          AC_DEFINE(USE_REGEX_PCRE,[1],[If this macro is defined, use PCRE regex library.])
+          REGEX_LIBS="-lpcreposix $LIBPCRE_LIBS"
+          REGEX_CFLAGS=$LIBPCRE_CFLAGS
+        ],
+        [AC_MSG_ERROR([Cannot find PCRE])]
+    )
+    ;;
+  oniguruma)
+    AC_CHECK_LIB( onig , onig_new ,
+        [
+          AC_DEFINE(USE_REGEX_ONIGURUMA,[1],[If this macro is defined, use Oniguruma regex library.])
+          REGEX_LIBS=['-lonig']
+        ],
+        [AC_MSG_ERROR([Cannot find Oniguruma])]
+    )
+    ;;
+  *)
+    AC_DEFINE(USE_REGEX_GNU,[1],[If this macro is defined, use GNU regex library.])
+    ;;
+esac],AC_DEFINE(USE_REGEX_GNU,[1],[If this macro is defined, use GNU regex library.]))
+
+AC_SUBST(REGEX_LIBS)
+AC_SUBST(REGEX_CFLAGS)
+
+
 dnl GConf support
 
 AC_ARG_ENABLE( gconf,
--- a/mk/rules.mk.in	Mon Dec 18 11:59:00 2006 -0800
+++ b/mk/rules.mk.in	Mon Dec 18 13:11:23 2006 -0800
@@ -234,6 +234,8 @@
 PLUGIN_LDFLAGS ?= @PLUGIN_LDFLAGS@
 POSUB ?= @POSUB@
 RANLIB ?= @RANLIB@
+REGEX_CFLAGS ?= @REGEX_CFLAGS@
+REGEX_LIBS ?= @REGEX_LIBS@
 RESID_LDADD ?= @RESID_LDADD@
 SAMPLERATE_CFLAGS ?= @SAMPLERATE_CFLAGS@
 SAMPLERATE_LIBS ?= @SAMPLERATE_LIBS@