[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot configure.in dic/Makefile.am dic/compdic.... [cppdic]
From: |
eliot-dev |
Subject: |
[Eliot-dev] eliot configure.in dic/Makefile.am dic/compdic.... [cppdic] |
Date: |
Wed, 05 Dec 2007 14:44:38 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Branch: cppdic
Changes by: Olivier Teulière <ipkiss> 07/12/05 14:44:38
Modified files:
. : configure.in
dic : Makefile.am compdic.cpp header.cpp listdic.cpp
regexpmain.cpp
m4 : .cvsignore
po : .cvsignore
utils : Makefile.am ncurses.cpp
Log message:
- Ugraded gettext to version 0.16.1
- Updated .cvsignore files
- Internationalization of the dic/ binaries
- French translation
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/configure.in?cvsroot=eliot&only_with_tag=cppdic&r1=1.19.2.8&r2=1.19.2.9
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/Makefile.am?cvsroot=eliot&only_with_tag=cppdic&r1=1.14.4.9&r2=1.14.4.10
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/compdic.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.11&r2=1.1.2.12
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/header.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/listdic.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.8&r2=1.1.2.9
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/regexpmain.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.4&r2=1.1.2.5
http://cvs.savannah.gnu.org/viewcvs/eliot/m4/.cvsignore?cvsroot=eliot&only_with_tag=cppdic&r1=1.1&r2=1.1.6.1
http://cvs.savannah.gnu.org/viewcvs/eliot/po/.cvsignore?cvsroot=eliot&only_with_tag=cppdic&r1=1.1&r2=1.1.6.1
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/Makefile.am?cvsroot=eliot&only_with_tag=cppdic&r1=1.9.4.4&r2=1.9.4.5
http://cvs.savannah.gnu.org/viewcvs/eliot/utils/ncurses.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.22.2.5&r2=1.22.2.6
Patches:
Index: configure.in
===================================================================
RCS file: /cvsroot/eliot/eliot/configure.in,v
retrieving revision 1.19.2.8
retrieving revision 1.19.2.9
diff -u -b -r1.19.2.8 -r1.19.2.9
--- configure.in 4 Dec 2007 11:09:58 -0000 1.19.2.8
+++ configure.in 5 Dec 2007 14:44:37 -0000 1.19.2.9
@@ -16,6 +16,8 @@
dnl --------------------------------------------------------------
AC_PROG_INSTALL
AC_PROG_CC
+dnl Needed for gettext
+AC_GNU_SOURCE
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_PROG_RANLIB
@@ -149,7 +151,7 @@
AM_CONDITIONAL([BUILD_TEXT], [test "${enable_text}" != "no"])
dnl Internationalization macros
-AM_GNU_GETTEXT_VERSION(0.11.5)
+AM_GNU_GETTEXT_VERSION(0.16.1)
AM_GNU_GETTEXT
dnl Iconv
Index: dic/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Makefile.am,v
retrieving revision 1.14.4.9
retrieving revision 1.14.4.10
diff -u -b -r1.14.4.9 -r1.14.4.10
--- dic/Makefile.am 5 Dec 2007 10:35:59 -0000 1.14.4.9
+++ dic/Makefile.am 5 Dec 2007 14:44:37 -0000 1.14.4.10
@@ -18,8 +18,11 @@
noinst_LIBRARIES = libdic.a
+localedir = $(datadir)/locale
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
+
INCLUDES = -I$(top_srcdir) $(INCICONV)
-LIBS += $(LIBICONV)
+LDADD = @LIBINTL@
libdic_a_CFLAGS=
libdic_a_YFLAGS=-d
@@ -72,7 +75,7 @@
compdic_SOURCES=compdic.cpp \
hashtable.h hashtable.cpp hashtable.i
address@hidden@
+compdic_CPPFLAGS=$(AM_CPPFLAGS) @BOOST_CPPFLAGS@
compdic_LDADD=libdic.a
listdic_SOURCES=listdic.cpp
Index: dic/compdic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/compdic.cpp,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -b -r1.1.2.11 -r1.1.2.12
--- dic/compdic.cpp 3 Dec 2007 17:27:33 -0000 1.1.2.11
+++ dic/compdic.cpp 5 Dec 2007 14:44:37 -0000 1.1.2.12
@@ -54,6 +54,13 @@
# endif
#endif
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(String) gettext(String)
+#else
+# define _(String) String
+#endif
+
#include "hashtable.h"
#include "encoding.h"
#include "header.h"
@@ -395,34 +402,44 @@
void printUsage(const string &iBinaryName)
{
cout << "Usage: " << iBinaryName << " [options]" << endl
- << "Mandatory options:" << endl
- << " -d, --dicname <string> Set the dictionary name and version" <<
endl
- << " -l, --letters <string> Path to the file containing the letters
(see below)" << endl
- << " -i, --input <string> Path to the uncompressed dictionary
file" << endl
- << " -o, --output <string Path to the generated compressed
dictionary file" << endl
- << "Other options:" << endl
- << " -h, --help Print this help and exit" << endl
- << "Example:" << endl
- << " " << iBinaryName << " -d 'ODS 5.0' -l letters -i list -o
ods5.dawg" << endl
+ << _("Mandatory options:") << endl
+ << _(" -d, --dicname <string> Set the dictionary name and version")
<< endl
+ << _(" -l, --letters <string> Path to the file containing the
letters (see below)") << endl
+ << _(" -i, --input <string> Path to the uncompressed dictionary
file (encoded in UTF-8)") << endl
+ << _(" -o, --output <string Path to the generated compressed
dictionary file") << endl
+ << _("Other options:") << endl
+ << _(" -h, --help Print this help and exit") << endl
+ << _("Example:") << endl
+ << " " << iBinaryName << _(" -d 'ODS 5.0' -l letters.txt -i ods5.txt
-o ods5.dawg") << endl
<< endl
- << "The file containing the letters (--letters switch) must be UTF-8
encoded." << endl
- << "Each line corresponds to one letter, and must contains 5 fields
separated with " << endl
- << "one or more space(s). " << endl
- << " - 1st field: the letter itself" << endl
- << " - 2nd field: the points of the letter" << endl
- << " - 3rd field: the frequency of the letter (how many letters of
this kind in the game)" << endl
- << " - 4th field: 1 if the letter is considered as a vowel in
Scrabble game, 0 otherwise" << endl
- << " - 5th field: 1 if the letter is considered as a consonant in
Scrabble game, 0 otherwise" << endl
- << "Example for french:" << endl
- << "A 1 9 1 0" << endl
- << "B 3 2 0 1" << endl
- << "etc." << endl;
+ << _("The file containing the letters (--letters switch) must be
UTF-8 encoded.") << endl
+ << _("Each line corresponds to one letter, and must contain 5 fields
separated with ") << endl
+ << _("one or more space(s).") << endl
+ << _(" - 1st field: the letter itself") << endl
+ << _(" - 2nd field: the points of the letter") << endl
+ << _(" - 3rd field: the frequency of the letter (how many letters of
this kind in the game)") << endl
+ << _(" - 4th field: 1 if the letter is considered as a vowel in
Scrabble game, 0 otherwise") << endl
+ << _(" - 5th field: 1 if the letter is considered as a consonant in
Scrabble game, 0 otherwise") << endl
+ << _("Example for french:") << endl
+ << _("A 1 9 1 0") << endl
+ << _("[...]") << endl
+ << _("Z 10 1 0 1") << endl
+ << _("? 0 2 1 1") << endl;
}
int main(int argc, char* argv[])
{
+#if HAVE_SETLOCALE
+ // Set locale via LC_ALL
setlocale(LC_ALL, "");
+#endif
+
+#if ENABLE_NLS
+ // Set the message domain
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
static const struct option long_options[] =
{
@@ -475,7 +492,7 @@
// Check mandatory options
if (!found_d || !found_l || !found_i || !found_o)
{
- cerr << "A mandatory option is missing" << endl;
+ cerr << _("A mandatory option is missing") << endl;
printUsage(argv[0]);
exit(1);
}
@@ -483,7 +500,7 @@
struct stat stat_buf;
if (stat(inFileName.c_str(), &stat_buf) < 0)
{
- cerr << "Cannot stat uncompressed dictionary " << inFileName << endl;
+ cerr << _("Cannot stat uncompressed dictionary ") << inFileName <<
endl;
exit(1);
}
unsigned int dicsize = (unsigned int)stat_buf.st_size;
@@ -491,7 +508,7 @@
ofstream outfile(outFileName.c_str(), ios::out | ios::binary | ios::trunc);
if (!outfile.is_open())
{
- cerr << "Cannot open output file " << outFileName << endl;
+ cerr << _("Cannot open output file ") << outFileName << endl;
exit(1);
}
@@ -541,10 +558,10 @@
delete[] uncompressed;
outfile.close();
- printf(" Load time: %.3f s\n", 1.0 * (endLoadTime - startLoadTime) /
CLOCKS_PER_SEC);
- printf(" Compression time: %.3f s\n", 1.0 * (endBuildTime -
startBuildTime) / CLOCKS_PER_SEC);
+ printf(_(" Load time: %.3f s\n"), 1.0 * (endLoadTime - startLoadTime)
/ CLOCKS_PER_SEC);
+ printf(_(" Compression time: %.3f s\n"), 1.0 * (endBuildTime -
startBuildTime) / CLOCKS_PER_SEC);
#ifdef CHECK_RECURSION
- printf(" Maximum recursion level reached: %d\n", max_rec);
+ printf(_(" Maximum recursion level reached: %d\n"), max_rec);
#endif
return 0;
}
Index: dic/header.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/header.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/header.cpp 4 Dec 2007 11:09:59 -0000 1.1.2.12
+++ dic/header.cpp 5 Dec 2007 14:44:37 -0000 1.1.2.13
@@ -22,6 +22,7 @@
#include <string>
#include <sstream>
#include <iostream>
+#include <iconv.h>
// For ntohl & Co.
#ifdef WIN32
@@ -35,11 +36,16 @@
# endif
#endif
-#include "config.h"
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(String) gettext(String)
+#else
+# define _(String) String
+#endif
+
#include "header.h"
#include "encoding.h"
#include "dic_exception.h"
-#include <iconv.h>
// Note: swap4 is duplicated in dic.cpp
@@ -297,8 +303,8 @@
if (m_version == 0)
{
m_compressDate = 0;
- m_userHost = convertToWc("Unknown (old format)");
- m_dicName = convertToWc("Unknown (old format)");
+ m_userHost = convertToWc(_("Unknown (old format)"));
+ m_dicName = convertToWc(_("Unknown (old format)"));
// In version 0, the letters, points, frequency,
// vowels and consonants were hard-coded...
@@ -528,29 +534,29 @@
void Header::print() const
{
- printf("dictionary name: %s\n", convertToMb(m_dicName).c_str());
- printf("dictionary type: %s\n", m_type == kDAWG ? "DAWG" : "GADDAG");
+ printf(_("dictionary name: %s\n"), convertToMb(m_dicName).c_str());
if (m_version)
{
char buf[50];
strftime(buf, sizeof(buf), "%c", gmtime(&m_compressDate));
- printf("compressed on: %s\n", buf);
+ printf(_("compressed on: %s\n"), buf);
}
else
{
- printf("compressed on: Unknown date (old format)\n");
+ printf(_("compressed on: Unknown date (old format)\n"));
}
- printf("compressed using a binary compiled by: %ls\n", m_userHost.c_str());
- printf("letters: %ls\n", m_letters.c_str());
- printf("number of letters: %d\n", m_letters.size());
- printf("number of words: %d\n", m_nbWords);
- printf("header size: %u bytes\n", sizeof(Dict_header_old) +
+ printf(_("compressed using a binary compiled by: %ls\n"),
m_userHost.c_str());
+ printf(_("dictionary type: %s\n"), m_type == kDAWG ? "DAWG" : "GADDAG");
+ printf(_("letters: %ls\n"), m_letters.c_str());
+ printf(_("number of letters: %d\n"), m_letters.size());
+ printf(_("number of words: %d\n"), m_nbWords);
+ printf(_("header size: %u bytes\n"), sizeof(Dict_header_old) +
m_version ? sizeof(Dict_header_ext) : 0);
- printf("root: %d (edge)\n", m_root);
- printf("nodes: %d used + %d saved\n", m_nodesUsed, m_nodesSaved);
- printf("edges: %d used + %d saved\n", m_edgesUsed, m_edgesSaved);
+ printf(_("root: %d (edge)\n"), m_root);
+ printf(_("nodes: %d used + %d saved\n"), m_nodesUsed, m_nodesSaved);
+ printf(_("edges: %d used + %d saved\n"), m_edgesUsed, m_edgesSaved);
printf("===============================================\n");
- printf("letter | points | frequency | vowel | consonant\n");
+ printf(_("letter | points | frequency | vowel | consonant\n"));
printf("-------+--------+-----------+-------+----------\n");
for (unsigned int i = 0; i < m_letters.size(); ++i)
{
Index: dic/listdic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/listdic.cpp,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -b -r1.1.2.8 -r1.1.2.9
--- dic/listdic.cpp 4 Dec 2007 11:09:59 -0000 1.1.2.8
+++ dic/listdic.cpp 5 Dec 2007 14:44:37 -0000 1.1.2.9
@@ -24,6 +24,8 @@
* \date 1999
*/
+#include "config.h"
+
#include <fstream>
#include <iostream>
#include <string.h>
@@ -31,6 +33,13 @@
#include <stdio.h>
#include <stddef.h>
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(String) gettext(String)
+#else
+# define _(String) String
+#endif
+
#include "header.h"
#include "encoding.h"
#include "dic_internals.h"
@@ -88,8 +97,8 @@
template <typename DAWG_EDGE>
void print_dic_hex(const Dictionary &iDic)
{
- printf("offs binary structure\n");
- printf("---- -------- | ------------------\n");
+ printf(_("offset binary | structure\n"));
+ printf("------ -------- | --------------------\n");
for (unsigned int i = 0; i < (iDic.getHeader().getNbEdgesUsed() + 1); i++)
print_node_hex<DAWG_EDGE>(iDic, i);
}
@@ -97,17 +106,26 @@
void usage(const string &iName)
{
- printf("usage: %s [-a|-h|-d|-l] dictionary\n", iName.c_str());
- printf(" -a: print all\n");
- printf(" -h: print header\n");
- printf(" -d: print dic in hex\n");
- printf(" -l: print dic word list\n");
+ printf(_("usage: %s [-a|-h|-l|-x] dictionary\n"), iName.c_str());
+ printf(_(" -a: print all\n"));
+ printf(_(" -h: print header\n"));
+ printf(_(" -l: print dictionary word list\n"));
+ printf(_(" -x: print dictionary in hex\n"));
}
int main(int argc, char *argv[])
{
+#if HAVE_SETLOCALE
+ // Set locale via LC_ALL
setlocale(LC_ALL, "");
+#endif
+
+#if ENABLE_NLS
+ // Set the message domain
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
int arg_count;
int option_print_all = 0;
@@ -128,8 +146,8 @@
{
case 'a': option_print_all = 1; break;
case 'h': option_print_header = 1; break;
- case 'd': option_print_dic_hex = 1; break;
case 'l': option_print_dic_list = 1; break;
+ case 'x': option_print_dic_hex = 1; break;
default: usage(argv[0]); exit(2); break;
}
arg_count++;
Index: dic/regexpmain.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/regexpmain.cpp,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -b -r1.1.2.4 -r1.1.2.5
--- dic/regexpmain.cpp 5 Dec 2007 10:36:00 -0000 1.1.2.4
+++ dic/regexpmain.cpp 5 Dec 2007 14:44:37 -0000 1.1.2.5
@@ -28,10 +28,16 @@
#include <exception>
#include <iostream>
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(String) gettext(String)
+#else
+# define _(String) String
+#endif
+
#include "dic.h"
#include "regexp.h"
#include "encoding.h"
@@ -89,21 +95,32 @@
/********************************************************/
/********************************************************/
/********************************************************/
-void usage(char* argv[])
+void usage(const char *iBinaryName)
{
- fprintf(stderr, "usage: %s dictionary\n", argv[0]);
- fprintf(stderr, " dictionary : path to dawg eliot dictionary\n");
+ cerr << _("usage: %s dictionary") << iBinaryName << endl;
+ cerr << _(" dictionary: path to eliot dawg dictionary") << endl;
}
+
int main(int argc, char* argv[])
{
- if (argc < 2)
+#if HAVE_SETLOCALE
+ // Set locale via LC_ALL
+ setlocale(LC_ALL, "");
+#endif
+
+#if ENABLE_NLS
+ // Set the message domain
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
+#endif
+
+ if (argc != 2)
{
- usage(argv);
+ usage(argv[0]);
return 0;
}
- setlocale(LC_ALL, "");
try
{
Dictionary dic(argv[1]);
@@ -114,9 +131,9 @@
struct search_RegE_list_t regList;
while (strcmp(er, ""))
{
- fprintf(stdout,
"**************************************************************\n");
- fprintf(stdout,
"**************************************************************\n");
- fprintf(stdout, "entrer une ER:\n");
+ cout <<
"**************************************************************" << endl;
+ cout <<
"**************************************************************" << endl;
+ cout << _("enter a regular expression:") << endl;
fgets(er, sizeof(er), stdin);
/* strip \n */
er[strlen(er) - 1] = '\0';
@@ -128,11 +145,11 @@
list<wstring> wordList;
dic.searchRegExp(convertToWc(er), wordList, ®List);
- fprintf(stdout, "résultat:\n");
+ cout << _("result:") << endl;
list<wstring>::const_iterator it;
for (it = wordList.begin(); it != wordList.end(); it++)
{
- fprintf(stderr, "%ls\n", it->c_str());
+ cerr << convertToMb(*it) << endl;
}
}
Index: m4/.cvsignore
===================================================================
RCS file: /cvsroot/eliot/eliot/m4/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -b -r1.1 -r1.1.6.1
--- m4/.cvsignore 27 Feb 2005 20:11:53 -0000 1.1
+++ m4/.cvsignore 5 Dec 2007 14:44:38 -0000 1.1.6.1
@@ -1,18 +1,30 @@
codeset.m4
gettext.m4
+glibc2.m4
glibc21.m4
iconv.m4
intdiv0.m4
+intl.m4
+intldir.m4
+intmax.m4
inttypes-pri.m4
-inttypes.m4
inttypes_h.m4
-isc-posix.m4
lcmessage.m4
lib-ld.m4
lib-link.m4
lib-prefix.m4
+lock.m4
+longdouble.m4
+longlong.m4
+nls.m4
+po.m4
+printf-posix.m4
progtest.m4
+size_max.m4
stdint_h.m4
uintmax_t.m4
ulonglong.m4
-
+visibility.m4
+wchar_t.m4
+wint_t.m4
+xsize.m4
Index: po/.cvsignore
===================================================================
RCS file: /cvsroot/eliot/eliot/po/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -b -r1.1 -r1.1.6.1
--- po/.cvsignore 6 Feb 2005 22:18:11 -0000 1.1
+++ po/.cvsignore 5 Dec 2007 14:44:38 -0000 1.1.6.1
@@ -1,6 +1,7 @@
Makefile
Makefile.in
Makefile.in.in
+Makevars.template
POTFILES
*.mo
*.gmo
@@ -8,3 +9,4 @@
*.sin
*.header
Rules-quot
+stamp-po
Index: utils/Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/Makefile.am,v
retrieving revision 1.9.4.4
retrieving revision 1.9.4.5
diff -u -b -r1.9.4.4 -r1.9.4.5
--- utils/Makefile.am 3 Dec 2007 17:27:33 -0000 1.9.4.4
+++ utils/Makefile.am 5 Dec 2007 14:44:38 -0000 1.9.4.5
@@ -16,7 +16,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-top_srcdir = @top_srcdir@
+localedir = $(datadir)/locale
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
INCLUDES = -I$(top_srcdir)/dic -I$(top_srcdir)/game -I$(top_srcdir)/intl
@@ -37,7 +38,3 @@
eliotcurses_LDADD = ../game/libgame.a ../dic/libdic.a -lncursesw @LIBINTL@
endif
-datadir = @datadir@
-localedir = $(datadir)/locale
-DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
-
Index: utils/ncurses.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/utils/ncurses.cpp,v
retrieving revision 1.22.2.5
retrieving revision 1.22.2.6
diff -u -b -r1.22.2.5 -r1.22.2.6
--- utils/ncurses.cpp 5 Dec 2007 10:36:00 -0000 1.22.2.5
+++ utils/ncurses.cpp 5 Dec 2007 14:44:38 -0000 1.22.2.6
@@ -826,7 +826,7 @@
int main(int argc, char ** argv)
{
-#ifdef HAVE_SETLOCALE
+#if HAVE_SETLOCALE
// Set locale via LC_ALL
setlocale(LC_ALL, "");
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot configure.in dic/Makefile.am dic/compdic.... [cppdic],
eliot-dev <=