Kouhei Sutou
kous****@users*****
2006年 11月 24日 (金) 11:27:51 JST
Index: tomoe/lib/Makefile.am diff -u tomoe/lib/Makefile.am:1.35 tomoe/lib/Makefile.am:1.36 --- tomoe/lib/Makefile.am:1.35 Wed Nov 22 18:04:47 2006 +++ tomoe/lib/Makefile.am Fri Nov 24 11:27:51 2006 @@ -28,7 +28,7 @@ -DTOMOEDATADIR=\""$(datadir)"/$(PACKAGE)\" \ -DRECOGNIZERDIR=\""$(recognizerdir)"\" -INCLUDES = $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS) $(GLIB_CFLAGS) +INCLUDES = $(LIBXML_CFLAGS) $(GLIB_CFLAGS) tomoe_public_h_sources = \ tomoe.h \ @@ -84,7 +84,7 @@ libtomoe_la_LD_ADD = \ -lm -libtomoe_la_LIBADD = $(LIBXML_LIBS) $(LIBXSLT_LIBS) $(GLIB_LIBS) +libtomoe_la_LIBADD = $(LIBXML_LIBS) $(GLIB_LIBS) Index: tomoe/lib/tomoe-dict.c diff -u tomoe/lib/tomoe-dict.c:1.69 tomoe/lib/tomoe-dict.c:1.70 --- tomoe/lib/tomoe-dict.c:1.69 Thu Nov 23 23:09:36 2006 +++ tomoe/lib/tomoe-dict.c Fri Nov 24 11:27:51 2006 @@ -21,7 +21,7 @@ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA * - * $Id: tomoe-dict.c,v 1.69 2006/11/23 14:09:36 kous Exp $ + * $Id: tomoe-dict.c,v 1.70 2006/11/24 02:27:51 kous Exp $ */ #include <stdio.h> @@ -29,10 +29,6 @@ #include <string.h> #include <libxml/xmlreader.h> #include <math.h> -#include <libxslt/xslt.h> -#include <libxslt/xsltInternals.h> -#include <libxslt/transform.h> -#include <libxslt/xsltutils.h> #include <glib.h> #include <glib/gi18n.h> @@ -95,11 +91,8 @@ TomoeChar* lttr); static void parse_strokelist (xmlNodePtr node, TomoeChar* lttr); -static int check_dict_xsl (const char* filename); static void parse_tomoe_dict (TomoeDict* t_dict, xmlNodePtr root); -static void parse_alien_dict (TomoeDict* t_dict, - const char* filename); static gint letter_compare_func (gconstpointer a, gconstpointer b); @@ -171,6 +164,7 @@ { TomoeDict* dict; TomoeDictPrivate *priv; + xmlDocPtr doc; if (!filename && !*filename) return NULL; @@ -180,19 +174,11 @@ NULL); priv = TOMOE_DICT_GET_PRIVATE (dict); - if (0 == check_dict_xsl (filename)) { - /* native tomoe dictionary */ - xmlDocPtr doc = xmlParseFile (filename); - - if (doc) - parse_tomoe_dict (dict, xmlDocGetRootElement (doc)); - - xmlFreeDoc (doc); - } - else /* non native dictionary */ - parse_alien_dict (dict, filename); + doc = xmlParseFile (filename); + if (doc) + parse_tomoe_dict (dict, xmlDocGetRootElement (doc)); + xmlFreeDoc (doc); - xsltCleanupGlobals (); xmlCleanupParser (); if (priv->letters) { @@ -632,27 +618,6 @@ } } -static int -check_dict_xsl (const char* filename) -{ - char* xslname = NULL; - int len; - FILE* f; - - if (!(xslname = strdup(filename))) return 0; - if ((len = strlen(xslname)) < 3) return 0; - - xslname[len - 2] = 's'; /* xml > xsl */ - - f = fopen(xslname, "r"); - free(xslname); - if (!f) - return 0; /* no xsl available */ - fclose(f); - - return 1; -} - static void parse_tomoe_dict (TomoeDict* dict, xmlNodePtr root) { @@ -690,36 +655,6 @@ } } -static void -parse_alien_dict (TomoeDict* dict, const char* filename) -{ - char* xslname = strdup (filename); - int len; - xsltStylesheetPtr cur = NULL; - xmlDocPtr doc, res; - const char* param[1]; - param[0] = NULL; - - if (!xslname) return; - if ((len = strlen (xslname)) < 3) return; - xslname[len - 2] = 's'; /* xml > xsl */ - - xmlSubstituteEntitiesDefault (1); - xmlLoadExtDtdDefaultValue = 1; - cur = xsltParseStylesheetFile (BAD_CAST xslname); - doc = xmlParseFile (filename); - /* translate to native */ - res = xsltApplyStylesheet (cur, doc, param); - - /* load native dictionary */ - parse_tomoe_dict (dict, xmlDocGetRootElement (res)); - - xsltFreeStylesheet (cur); - xmlFreeDoc (res); - xmlFreeDoc (doc); - -} - static gint letter_compare_func (gconstpointer a, gconstpointer b) {