eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot INSTALL configure.in dic/Makefile.am dic/... [cppdic]


From: eliot-dev
Subject: [Eliot-dev] eliot INSTALL configure.in dic/Makefile.am dic/... [cppdic]
Date: Thu, 06 Dec 2007 13:24:49 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Branch:         cppdic
Changes by:     Olivier Teulière <ipkiss>      07/12/06 13:24:49

Modified files:
        .              : INSTALL configure.in 
        dic            : Makefile.am compdic.cpp encoding.cpp header.cpp 
        utils          : Makefile.am 
        wxwin          : Makefile.am 

Log message:
         - Replacement of wcwidth(), which is not available on win32 (POSIX 
only)
         - Fixed win32 build
         - Documented in the win32 build instructions a work-around for a 
gettext bug
         - Fixed alignment issues in the extended header
         - compdic: Improved exception handling

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/INSTALL?cvsroot=eliot&only_with_tag=cppdic&r1=1.8.6.3&r2=1.8.6.4
http://cvs.savannah.gnu.org/viewcvs/eliot/configure.in?cvsroot=eliot&only_with_tag=cppdic&r1=1.19.2.9&r2=1.19.2.10
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/Makefile.am?cvsroot=eliot&only_with_tag=cppdic&r1=1.14.4.10&r2=1.14.4.11
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/compdic.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.12&r2=1.1.2.13
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/encoding.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.5&r2=1.1.2.6
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/header.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.13&r2=1.1.2.14
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/Makefile.am?cvsroot=eliot&only_with_tag=cppdic&r1=1.9.4.5&r2=1.9.4.6
http://cvs.savannah.gnu.org/viewcvs/eliot/wxwin/Makefile.am?cvsroot=eliot&only_with_tag=cppdic&r1=1.9.2.3&r2=1.9.2.4

Patches:
Index: INSTALL
===================================================================
RCS file: /cvsroot/eliot/eliot/INSTALL,v
retrieving revision 1.8.6.3
retrieving revision 1.8.6.4
diff -u -b -r1.8.6.3 -r1.8.6.4
--- INSTALL     30 Nov 2007 17:09:28 -0000      1.8.6.3
+++ INSTALL     6 Dec 2007 13:24:47 -0000       1.8.6.4
@@ -54,6 +54,13 @@
       (aussi bien sous Cygwin que sous GNU/Linux) :
             ./bootstrap
 
+    - à cause d'un bug de gettext, il faut appliquer un patch aux fichiers 
installés
+      dans intl/ :
+            - télécharger le patch ici (lien en haut à gauche) :
+              
http://www.koders.com/noncode/fid46DF595700FEB564B6EF45BFF55067F95DCF0420.aspx
+            - exécuter la commande suivante :
+              patch -p2 < gettext-win32.patch
+
     - avec Cygwin, configurer avec la ligne de commande suivante :
             CPPFLAGS=-I/path/to/installs/include 
LDFLAGS=-L/path/to/installs/lib \
             CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" \

Index: configure.in
===================================================================
RCS file: /cvsroot/eliot/eliot/configure.in,v
retrieving revision 1.19.2.9
retrieving revision 1.19.2.10
diff -u -b -r1.19.2.9 -r1.19.2.10
--- configure.in        5 Dec 2007 14:44:37 -0000       1.19.2.9
+++ configure.in        6 Dec 2007 13:24:48 -0000       1.19.2.10
@@ -106,6 +106,7 @@
 dnl Checks for library functions.
 dnl --------------------------------------------------------------
 AC_FUNC_MEMCMP
+AC_CHECK_FUNCS([wcwidth])
 
 dnl --------------------------------------------------------------
 dnl Checks for libraries.

Index: dic/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Makefile.am,v
retrieving revision 1.14.4.10
retrieving revision 1.14.4.11
diff -u -b -r1.14.4.10 -r1.14.4.11
--- dic/Makefile.am     5 Dec 2007 14:44:37 -0000       1.14.4.10
+++ dic/Makefile.am     6 Dec 2007 13:24:48 -0000       1.14.4.11
@@ -21,8 +21,7 @@
 localedir = $(datadir)/locale
 AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
 
-INCLUDES = -I$(top_srcdir) $(INCICONV)
-LDADD = @LIBINTL@
+INCLUDES = -I$(top_srcdir) -I../intl -I$(top_srcdir)/intl $(INCICONV)
 
 libdic_a_CFLAGS=
 libdic_a_YFLAGS=-d
@@ -76,13 +75,14 @@
 compdic_SOURCES=compdic.cpp \
        hashtable.h hashtable.cpp hashtable.i
 compdic_CPPFLAGS=$(AM_CPPFLAGS) @BOOST_CPPFLAGS@
-compdic_LDADD=libdic.a
+compdic_LDADD=libdic.a @LIBINTL@
 
 listdic_SOURCES=listdic.cpp
-listdic_LDADD=libdic.a
+listdic_LDADD=libdic.a @LIBINTL@
 
 #regexp_CFLAGS=-DDEBUG_RE
 regexp_SOURCES=regexpmain.cpp
-regexp_LDADD=libdic.a
+regexp_LDADD=libdic.a @LIBINTL@
 
 endif
+

Index: dic/compdic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/compdic.cpp,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -b -r1.1.2.12 -r1.1.2.13
--- dic/compdic.cpp     5 Dec 2007 14:44:37 -0000       1.1.2.12
+++ dic/compdic.cpp     6 Dec 2007 13:24:48 -0000       1.1.2.13
@@ -41,6 +41,8 @@
 #include <wctype.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <errno.h>
+#include <string.h>
 
 // For ntohl & Co.
 #ifdef WIN32
@@ -106,7 +108,10 @@
     iconv_close(handle);
     // Problem during encoding conversion?
     if (res == (size_t)(-1))
-        throw DicException("load_uncompressed: Error while interpreting 
UTF-8");
+    {
+        delete[] wide_buf;
+        throw DicException("load_uncompressed: " + string(strerror(errno)));
+    }
 
     // Update ioDicSize with the actual length of the wchar_t array
     ioDicSize -= outChars / sizeof(wchar_t);
@@ -170,7 +175,7 @@
         iconv_close(handle);
         // Problem during encoding conversion?
         if (res == (size_t)(-1))
-            throw DicException("readLetters: Error while interpreting UTF-8");
+            throw DicException("readLetters: " + string(strerror(errno)));
         if (outChars != sizeof(wchar_t) * (MAX_SIZE - 1))
         {
             ostringstream ss;
@@ -462,6 +467,8 @@
 
     int res;
     int option_index = 1;
+    try
+    {
     while ((res = getopt_long(argc, argv, short_options,
                               long_options, &option_index)) != -1)
     {
@@ -512,8 +519,6 @@
         exit(1);
     }
 
-    try
-    {
         clock_t startLoadTime = clock();
         // FIXME: not exception safe
         wchar_t *uncompressed = load_uncompressed(inFileName, dicsize);

Index: dic/encoding.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/encoding.cpp,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -b -r1.1.2.5 -r1.1.2.6
--- dic/encoding.cpp    4 Dec 2007 11:09:59 -0000       1.1.2.5
+++ dic/encoding.cpp    6 Dec 2007 13:24:48 -0000       1.1.2.6
@@ -24,11 +24,26 @@
  *  \date   2005
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <stdarg.h>
 #include <wchar.h>
 #include <wctype.h>
+
 #include "encoding.h"
+#include "dic_exception.h"
+
+
+#if !HAVE_WCWIDTH
+// wcwidth replacement (for win32 in particular)
+// Inspired from the gnulib package, without some of the refinements
+static inline int wcwidth(wchar_t c)
+{
+    // Assume all the printable characters have width 1
+    return c == 0 ? 0 : (iswprint(c) ? 1 : -1);
+}
+#endif
 
 
 int _wtoi(const wchar_t *iWStr)
@@ -134,8 +149,16 @@
 string padAndConvert(const wstring &iWstr, unsigned int iLength,
                      bool iLeftPad, char c)
 {
-    int width = wcswidth(iWstr.c_str(), iWstr.size());
-    if (width == -1 || (unsigned int)width >= iLength)
+    int width = 0;
+    for (unsigned int i = 0; i < iWstr.size(); ++i)
+    {
+        int n = wcwidth(iWstr[i]);
+        if (n == -1)
+            throw DicException("padAndConvert: non printable character");
+        width += n;
+    }
+
+    if ((unsigned int)width >= iLength)
         return convertToMb(iWstr);
     else
     {

Index: dic/header.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/header.cpp,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -b -r1.1.2.13 -r1.1.2.14
--- dic/header.cpp      5 Dec 2007 14:44:37 -0000       1.1.2.13
+++ dic/header.cpp      6 Dec 2007 13:24:48 -0000       1.1.2.14
@@ -23,6 +23,8 @@
 #include <sstream>
 #include <iostream>
 #include <iconv.h>
+#include <errno.h>
+#include <string.h>
 
 // For ntohl & Co.
 #ifdef WIN32
@@ -107,8 +109,9 @@
 };
 
 // Do not change these values, as they impact the size of the structure!
+// Note: they are chosen carefully to avoid alignment issues
 #define _MAX_USER_HOST_ 32
-#define _MAX_DIC_NAME_SIZE_ 32
+#define _MAX_DIC_NAME_SIZE_ 30
 #define _MAX_LETTERS_NB_ 63
 #define _MAX_LETTERS_SIZE_ 80
 
@@ -123,14 +126,22 @@
     // Size taken by the build information
     uint32_t userHostSize;
 
+    // --- we have a multiple of 64 bytes here
+
     // Compression algorithm (1 = DAWG, 2 = GADDAG)
     uint8_t algorithm;
+    // Variant used in the rules (XXX: currently unused)
+    uint8_t variant;
+
+    // --- we have a multiple of 64 bytes here
 
     // Dictionary official name and version (e.g.: ODS 5.0)
     char dicName[_MAX_DIC_NAME_SIZE_];
     // Size taken by the dictionary name
     uint32_t dicNameSize;
 
+    // --- we have a multiple of 64 bytes here
+
     // Letters used in the dictionary
     // We should have: nbLetters <= lettersSize <= _MAX_LETTERS_SIZE_
     // and:            nbLetters <= _MAX_LETTERS_NB_
@@ -141,6 +152,8 @@
     // Number of letters (XXX: in theory useless, but allows a sanity check)
     uint32_t nbLetters;
 
+    // --- we have a multiple of 64 bytes here
+
     // Points of the letters (indexed by their code)
     // The "+ 1" is there for struct alignment
     uint8_t points[_MAX_LETTERS_NB_ + 1];
@@ -151,7 +164,8 @@
     uint64_t vowels;
     // Bitfield indicating whether letters are consonants
     uint64_t consonants;
-    //@}
+
+    // --- we have a multiple of 64 bytes here
 };
 
 
@@ -497,7 +511,7 @@
     if (res == (size_t)(-1))
     {
         throw DicException("Header::readFromUTF8: iconv failed (" +
-                           iContext + ")");
+                           iContext + "): " + string(strerror(errno)));
     }
     // We finally have the letters as a wstring!
     oString = wstring(outbuf, iBufSize - outChars / sizeof(wchar_t));

Index: utils/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/Makefile.am,v
retrieving revision 1.9.4.5
retrieving revision 1.9.4.6
diff -u -b -r1.9.4.5 -r1.9.4.6
--- utils/Makefile.am   5 Dec 2007 14:44:38 -0000       1.9.4.5
+++ utils/Makefile.am   6 Dec 2007 13:24:48 -0000       1.9.4.6
@@ -19,14 +19,14 @@
 localedir = $(datadir)/locale
 AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
 
-INCLUDES = -I$(top_srcdir)/dic -I$(top_srcdir)/game -I$(top_srcdir)/intl
+INCLUDES = -I$(top_srcdir)/dic -I$(top_srcdir)/game -I../intl 
-I$(top_srcdir)/intl
 
 noinst_PROGRAMS =
 
 if BUILD_TEXT
 noinst_PROGRAMS += eliottxt
 eliottxt_SOURCES = game_io.h game_io.cpp eliottxt.cpp
-eliottxt_LDADD = $(top_builddir)/game/libgame.a $(top_builddir)/dic/libdic.a 
@LIBICONV@
+eliottxt_LDADD = $(top_builddir)/game/libgame.a $(top_builddir)/dic/libdic.a 
@LIBINTL@
 if HAS_READLINE
 eliottxt_LDADD += -lreadline
 endif

Index: wxwin/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/wxwin/Makefile.am,v
retrieving revision 1.9.2.3
retrieving revision 1.9.2.4
diff -u -b -r1.9.2.3 -r1.9.2.4
--- wxwin/Makefile.am   30 Nov 2007 17:09:29 -0000      1.9.2.3
+++ wxwin/Makefile.am   6 Dec 2007 13:24:49 -0000       1.9.2.4
@@ -36,7 +36,7 @@
     mainframe.cc mainframe.h  \
     main.cc ewx.h
 
-eliot_LDADD = @WX_LIBS@ ../game/libgame.a ../dic/libdic.a @LIBICONV@
+eliot_LDADD = @WX_LIBS@ ../game/libgame.a ../dic/libdic.a @LIBINTL@
 
 EXTRA_DIST = \
     eliot.xpm \




reply via email to

[Prev in Thread] Current Thread [Next in Thread]