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: Fri, 30 Nov 2007 17:09:29 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Branch:         cppdic
Changes by:     Olivier Teulière <ipkiss>      07/11/30 17:09:29

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

Log message:
         - Fixed some errors in INSTALL
         - Fixed win32 build
         - Handle endianness in the dictionary header (not yet in the rest of 
the dictionary)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/INSTALL?cvsroot=eliot&only_with_tag=cppdic&r1=1.8.6.2&r2=1.8.6.3
http://cvs.savannah.gnu.org/viewcvs/eliot/configure.in?cvsroot=eliot&only_with_tag=cppdic&r1=1.19.2.4&r2=1.19.2.5
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/Makefile.am?cvsroot=eliot&only_with_tag=cppdic&r1=1.14.4.7&r2=1.14.4.8
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/header.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.10&r2=1.1.2.11
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/Makefile.am?cvsroot=eliot&only_with_tag=cppdic&r1=1.9.4.1&r2=1.9.4.2
http://cvs.savannah.gnu.org/viewcvs/eliot/wxwin/Makefile.am?cvsroot=eliot&only_with_tag=cppdic&r1=1.9.2.2&r2=1.9.2.3

Patches:
Index: INSTALL
===================================================================
RCS file: /cvsroot/eliot/eliot/INSTALL,v
retrieving revision 1.8.6.2
retrieving revision 1.8.6.3
diff -u -b -r1.8.6.2 -r1.8.6.3
--- INSTALL     29 Nov 2007 19:09:56 -0000      1.8.6.2
+++ INSTALL     30 Nov 2007 17:09:28 -0000      1.8.6.3
@@ -55,9 +55,9 @@
             ./bootstrap
 
     - avec Cygwin, configurer avec la ligne de commande suivante :
-            CPPFLAGS=-I/path/to/installs/include 
LDFLAGS=-L/path/to/installs/lib
+            CPPFLAGS=-I/path/to/installs/include 
LDFLAGS=-L/path/to/installs/lib \
             CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" \
-            ./configure --with-wx-config=/path/to/wx-config \
+            ./configure --enable-wxwidgets --with-wx-config=/path/to/wx-config 
\
             --with-boost=/path/to/boost/installs
       en prenant soin de remplacer les différents chemins par les bonnes 
valeurs.
       Ensuite, un simple 'make' suffit pour terminer la compilation,
@@ -65,11 +65,10 @@
 
     - pour la cross-compilation depuis GNU/Linux, 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" \
+            CPPFLAGS=-I/path/to/installs/include 
LDFLAGS=-L/path/to/installs/lib \
             CC=i586-mingw32msvc-gcc CXX=i586-mingw32msvc-g++ \
             ./configure --host=i586-mingw32msvc --build=i386-linux \
-            --with-wx-config=/path/to/wx-config \
+            --enable-wxwidgets --with-wx-config=/path/to/wx-config \
             --with-boost=/path/to/installs
       en prenant soin de remplacer les différents chemins par les bonnes 
valeurs.
       Ensuite, un simple 'make' suffit pour terminer la compilation,

Index: configure.in
===================================================================
RCS file: /cvsroot/eliot/eliot/configure.in,v
retrieving revision 1.19.2.4
retrieving revision 1.19.2.5
diff -u -b -r1.19.2.4 -r1.19.2.5
--- configure.in        29 Nov 2007 19:09:56 -0000      1.19.2.4
+++ configure.in        30 Nov 2007 17:09:28 -0000      1.19.2.5
@@ -7,6 +7,8 @@
 AC_CONFIG_SRCDIR(wxwin/main.cc)
 AM_INIT_AUTOMAKE
 AM_CONFIG_HEADER(config.h)
+AC_CANONICAL_HOST
+AC_CANONICAL_BUILD
 AM_OPTIONS_WXCONFIG
 
 dnl --------------------------------------------------------------
@@ -164,6 +166,21 @@
 AC_DEFINE_UNQUOTED(ELIOT_COMPILE_HOST, "`hostname`", [host which ran 
configure])
 AC_DEFINE_UNQUOTED(ELIOT_COMPILE_DOMAIN, "`dnsdomainname 2>/dev/null || 
domainname 2>/dev/null || echo unknown`", [domain of the host which ran 
configure])
 
+dnl Check the operating system
+case "${host_os}" in
+    *mingw32* | *cygwin*)
+        SYS=mingw32
+        ;;
+    *)
+        dnl nothing to do
+        ;;
+esac
+
+if test "$SYS" = "mingw32"; then
+    # For ntohl, in particular
+    LIBS="${LIBS} -lws2_32"
+fi
+
 dnl --------------------------------------------------------------
 dnl Output
 dnl --------------------------------------------------------------

Index: dic/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Makefile.am,v
retrieving revision 1.14.4.7
retrieving revision 1.14.4.8
diff -u -b -r1.14.4.7 -r1.14.4.8
--- dic/Makefile.am     29 Nov 2007 19:09:56 -0000      1.14.4.7
+++ dic/Makefile.am     30 Nov 2007 17:09:28 -0000      1.14.4.8
@@ -19,7 +19,7 @@
 noinst_LIBRARIES = libdic.a
 
 INCLUDES = -I$(top_srcdir) $(INCICONV)
-LIBS = $(LIBICONV)
+LIBS += $(LIBICONV)
 
 libdic_a_CFLAGS=
 libdic_a_YFLAGS=-d

Index: dic/header.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/header.cpp,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -b -r1.1.2.10 -r1.1.2.11
--- dic/header.cpp      29 Nov 2007 19:09:56 -0000      1.1.2.10
+++ dic/header.cpp      30 Nov 2007 17:09:28 -0000      1.1.2.11
@@ -17,10 +17,24 @@
 /* along with this program; if not, write to the Free Software               */
 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
*/
 
+#include "config.h"
+
 #include <string>
 #include <sstream>
 #include <iostream>
 
+// For ntohl & Co.
+#ifdef WIN32
+#   include <winsock2.h>
+#else
+#    if HAVE_NETINET_IN_H
+#       include <netinet/in.h>
+#    endif
+#    if HAVE_ARPA_INET_H
+#       include <arpa/inet.h>
+#    endif
+#endif
+
 #include "config.h"
 #include "header.h"
 #include "encoding.h"
@@ -46,6 +60,20 @@
 
     return r;
 }
+
+// Nothing to do on big-endian machines
+#   define ntohll(x) (x)
+#   define htonll(x) (x)
+#else
+static inline uint64_t htonll(uint64_t host64)
+{
+    return (((uint64_t)htonl((host64 << 32) >> 32)) << 32) | htonl(host64 >> 
32);
+}
+
+static inline uint64_t ntohll(uint64_t net64)
+{
+    return htonll(net64);
+}
 #endif
 
 
@@ -81,18 +109,16 @@
 #define _MAX_LETTERS_NB_ 63
 #define _MAX_LETTERS_SIZE_ 80
 
-/** Extension of the old format */
+/** Extension of the old format (used in version 1)*/
 struct Dict_header_ext
 {
-    // Build information
+    // Build information (XXX: currently only written, and not UTF-8 encoded)
     char compileUserHost[_USER_HOST_MAX_];
-    // Number of seconds since the Epoch
+    // Number of seconds since the Epoch (XXX: currently unused)
     uint64_t compileDate;
 
     // Compression algorithm (1 = DAWG, 2 = GADDAG)
     uint8_t algorithm;
-    // Endianness (XXX: currently unused)
-    char bigEndian;
 
     // Dictionary official name and version (e.g.: ODS 5.0)
     char dicName[_MAX_DIC_NAME_SIZE_];
@@ -234,6 +260,11 @@
     if (string(aHeader.ident) != _COMPIL_KEYWORD_)
         throw DicException("Header::read: incorrect header keyword; is it a 
dictionary file?");
 
+    m_version = aHeader.version;
+
+    // Handle endianness
+    if (m_version == 0)
+    {
 #if defined(WORDS_BIGENDIAN)
     aHeader.root       = swap4(aHeader.root);
     aHeader.nwords     = swap4(aHeader.nwords);
@@ -242,14 +273,22 @@
     aHeader.nodessaved = swap4(aHeader.nodessaved);
     aHeader.edgessaved = swap4(aHeader.edgessaved);
 #endif
-
     m_root = aHeader.root;
     m_nbWords = aHeader.nwords;
     m_nodesUsed = aHeader.nodesused;
     m_edgesUsed = aHeader.edgesused;
     m_nodesSaved = aHeader.nodessaved;
     m_edgesSaved = aHeader.edgessaved;
-    m_version = aHeader.version;
+    }
+    else
+    {
+        m_root = ntohl(aHeader.root);
+        m_nbWords = ntohl(aHeader.nwords);
+        m_nodesUsed = ntohl(aHeader.nodesused);
+        m_edgesUsed = ntohl(aHeader.edgesused);
+        m_nodesSaved = ntohl(aHeader.nodessaved);
+        m_edgesSaved = ntohl(aHeader.edgessaved);
+    }
 
     if (m_version == 0)
     {
@@ -300,6 +339,14 @@
         if (iStream.gcount() != sizeof(Dict_header_ext))
             throw DicException("Header::read: expected to read more bytes");
 
+        // Handle endianness in the extension
+        aHeaderExt.compileDate = ntohll(aHeaderExt.compileDate);
+        aHeaderExt.dicNameSize = ntohl(aHeaderExt.dicNameSize);
+        aHeaderExt.lettersSize = ntohl(aHeaderExt.lettersSize);
+        aHeaderExt.nbLetters = ntohl(aHeaderExt.nbLetters);
+        aHeaderExt.vowels = ntohll(aHeaderExt.vowels);
+        aHeaderExt.consonants = ntohll(aHeaderExt.consonants);
+
         if (aHeaderExt.algorithm == kDAWG)
             m_type = kDAWG;
         else if (aHeaderExt.algorithm == kGADDAG)
@@ -344,12 +391,12 @@
     strcpy(aHeader.ident, _COMPIL_KEYWORD_);
     aHeader.version = m_version;
     aHeader.unused = 0;
-    aHeader.root = m_root;
-    aHeader.nwords = m_nbWords;
-    aHeader.nodesused = m_nodesUsed;
-    aHeader.edgesused = m_edgesUsed;
-    aHeader.nodessaved = m_nodesSaved;
-    aHeader.edgessaved = m_edgesSaved;
+    aHeader.root = htonl(m_root);
+    aHeader.nwords = htonl(m_nbWords);
+    aHeader.nodesused = htonl(m_nodesUsed);
+    aHeader.edgesused = htonl(m_edgesUsed);
+    aHeader.nodessaved = htonl(m_nodesSaved);
+    aHeader.edgessaved = htonl(m_edgesSaved);
 
     oStream.write((char*)&aHeader, sizeof(Dict_header_old));
     if (!oStream.good())
@@ -392,6 +439,14 @@
                 aHeaderExt.consonants |= 1 << i;
         }
 
+        // Handle endianness in the extension
+        aHeaderExt.compileDate = htonll(aHeaderExt.compileDate);
+        aHeaderExt.dicNameSize = htonl(aHeaderExt.dicNameSize);
+        aHeaderExt.lettersSize = htonl(aHeaderExt.lettersSize);
+        aHeaderExt.nbLetters = htonl(aHeaderExt.nbLetters);
+        aHeaderExt.vowels = htonll(aHeaderExt.vowels);
+        aHeaderExt.consonants = htonll(aHeaderExt.consonants);
+
         // Write the extension
         oStream.write((char*)&aHeaderExt, sizeof(Dict_header_ext));
         if (!oStream.good())

Index: utils/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/Makefile.am,v
retrieving revision 1.9.4.1
retrieving revision 1.9.4.2
diff -u -b -r1.9.4.1 -r1.9.4.2
--- utils/Makefile.am   29 Nov 2007 19:09:57 -0000      1.9.4.1
+++ utils/Makefile.am   30 Nov 2007 17:09:29 -0000      1.9.4.2
@@ -25,7 +25,7 @@
 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 
-lreadline
+eliottxt_LDADD = $(top_builddir)/game/libgame.a $(top_builddir)/dic/libdic.a 
-lreadline @LIBICONV@
 endif
 
 if BUILD_NCURSES

Index: wxwin/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/wxwin/Makefile.am,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -b -r1.9.2.2 -r1.9.2.3
--- wxwin/Makefile.am   11 Nov 2007 19:57:00 -0000      1.9.2.2
+++ wxwin/Makefile.am   30 Nov 2007 17:09:29 -0000      1.9.2.3
@@ -36,7 +36,7 @@
     mainframe.cc mainframe.h  \
     main.cc ewx.h
 
-eliot_LDADD = @WX_LIBS@ ../game/libgame.a ../dic/libdic.a
+eliot_LDADD = @WX_LIBS@ ../game/libgame.a ../dic/libdic.a @LIBICONV@
 
 EXTRA_DIST = \
     eliot.xpm \




reply via email to

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