From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.devel Subject: Re: i18n, gettext support Date: Thu, 02 Sep 2004 11:38:25 +0200 Organization: Jan at Appel Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <87r7pl9fji.fsf@peder.flower> References: <200408202226.10769.bruno@clisp.org> <87zn4ayn13.fsf@peder.flower> <200409012257.17504.bruno@clisp.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1094117957 1353 80.91.224.253 (2 Sep 2004 09:39:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 2 Sep 2004 09:39:17 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Sep 02 11:39:03 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C2o3a-0000vR-00 for ; Thu, 02 Sep 2004 11:39:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C2o8Y-0004ck-3A for guile-devel@m.gmane.org; Thu, 02 Sep 2004 05:44:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C2o8M-0004c6-KU for guile-devel@gnu.org; Thu, 02 Sep 2004 05:43:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C2o8K-0004ap-O5 for guile-devel@gnu.org; Thu, 02 Sep 2004 05:43:57 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C2o8K-0004aP-AL for guile-devel@gnu.org; Thu, 02 Sep 2004 05:43:56 -0400 Original-Received: from [194.109.24.34] (helo=smtp-vbr14.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1C2o3D-0000q4-Go for guile-devel@gnu.org; Thu, 02 Sep 2004 05:38:39 -0400 Original-Received: from peder.flower (appel.xs4all.nl [80.126.34.178]) by smtp-vbr14.xs4all.nl (8.12.11/8.12.11) with ESMTP id i829cWL7065732; Thu, 2 Sep 2004 11:38:33 +0200 (CEST) (envelope-from janneke@gnu.org) Original-Received: from localhost ([127.0.0.1] helo=peder.flower ident=janneke) by peder.flower with esmtp (Exim 4.34) id 1C2o30-0008S4-18; Thu, 02 Sep 2004 11:38:26 +0200 Original-To: Bruno Haible In-Reply-To: <200409012257.17504.bruno@clisp.org> (Bruno Haible's message of "Wed, 1 Sep 2004 22:57:17 +0200") User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) X-Virus-Scanned: by XS4ALL Virus Scanner X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:4069 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:4069 --=-=-= Bruno Haible writes: > Thanks; this is a good start. The patch is not complete however: it > implements only half of the proposed API; I have implemented the minimal functionality; the biggest hurdle is probably getting this included (I can hardly imagine how a software in 2004 could still lack gettext -- and be widely used). > the autoconf text for libintl is broken; and the use of gettext.h is > useless since gettext.h should never be installed in public > directories. Thanks, these should be fixed, see attached. > I'll send an updated patch tomorrow. Great. Jan. --=-=-= Content-Disposition: attachment; filename=guile-1.7.1.jcn2.diff ? debug ? do-diff ? doconf ? guile-1.7.1.jcn1.diff ? guile-1.7.1.jcn2.diff ? guile-config/libtool.m4 ? guile-config/ltdl.m4 ? guile-readline/ice-9 ? guile-readline/libtool.m4 ? libguile/' ? libguile/i18n.c ? libguile/i18n.h Index: ChangeLog =================================================================== RCS file: /cvsroot/guile/guile/guile-core/ChangeLog,v retrieving revision 1.444 diff -p -u -r1.444 ChangeLog --- ChangeLog 27 Aug 2004 01:10:20 -0000 1.444 +++ ChangeLog 2 Sep 2004 09:27:59 -0000 @@ -1,3 +1,7 @@ +2004-09-01 Jan Nieuwenhuizen + + * configure.in: Add i18n tests. + 2004-08-27 Kevin Ryde * configure.in (AC_CHECK_MEMBERS): Add struct sockaddr.sin_len and Index: configure.in =================================================================== RCS file: /cvsroot/guile/guile/guile-core/configure.in,v retrieving revision 1.251 diff -p -u -r1.251 configure.in --- configure.in 27 Aug 2004 01:09:48 -0000 1.251 +++ configure.in 2 Sep 2004 09:27:59 -0000 @@ -637,6 +637,14 @@ AC_TRY_LINK([#include ], [mpz_import (0, 0, 0, 0, 0, 0, 0);] , , [AC_MSG_ERROR([At least GNU MP 4.1 is required, see http://swox.com/gmp])]) +dnl i18n tests +AC_CHECK_HEADERS([libintl.h]) +AC_CHECK_FUNCS(gettext) +if test $ac_cv_func_gettext = no; then + AC_CHECK_LIB(intl, gettext) +fi +AC_CHECK_FUNCS([bindtextdomain textdomain]) + ### Some systems don't declare some functions. On such systems, we ### need to at least provide our own K&R-style declarations. Index: libguile/ChangeLog =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/ChangeLog,v retrieving revision 1.2137 diff -p -u -r1.2137 ChangeLog --- libguile/ChangeLog 27 Aug 2004 12:46:11 -0000 1.2137 +++ libguile/ChangeLog 2 Sep 2004 09:28:02 -0000 @@ -1,3 +1,11 @@ +2004-09-02 Jan Nieuwenhuizen + + * i18n.h: + * i18n.c: New file. + + * init.c: + * Makefile.am: Add it. + 2004-08-27 Marius Vollmer * strings.c (SCM_STRINGP): Accept all strings. Index: libguile/Makefile.am =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/Makefile.am,v retrieving revision 1.191 diff -p -u -r1.191 Makefile.am --- libguile/Makefile.am 24 Aug 2004 22:11:35 -0000 1.191 +++ libguile/Makefile.am 2 Sep 2004 09:28:02 -0000 @@ -97,7 +97,7 @@ libguile_la_SOURCES = alist.c arbiters.c gc.c gc-mark.c gc-segment.c gc-malloc.c gc-card.c gc-freelist.c \ gc_os_dep.c gdbint.c gh_data.c gh_eval.c gh_funcs.c gh_init.c \ gh_io.c gh_list.c gh_predicates.c goops.c gsubr.c guardians.c hash.c \ - hashtab.c hooks.c init.c inline.c ioext.c keywords.c \ + hashtab.c hooks.c i18n.c init.c inline.c ioext.c keywords.c \ lang.c list.c \ load.c macros.c mallocs.c modules.c numbers.c objects.c objprop.c \ options.c pairs.c ports.c print.c procprop.c procs.c properties.c \ @@ -113,7 +113,7 @@ DOT_X_FILES = alist.x arbiters.x async.x error.x eval.x evalext.x extensions.x feature.x fluids.x fports.x \ futures.x \ gc.x gc-mark.x gc-segment.x gc-malloc.x gc-card.x goops.x \ - gsubr.x guardians.x hash.x hashtab.x hooks.x init.x ioext.x \ + gsubr.x guardians.x hash.x hashtab.x hooks.x i18n.x init.x ioext.x \ keywords.x lang.x list.x load.x macros.x mallocs.x modules.x \ numbers.x objects.x objprop.x options.x pairs.x ports.x print.x \ procprop.x procs.x properties.x random.x rdelim.x read.x root.x rw.x \ @@ -187,7 +187,7 @@ modinclude_HEADERS = __scm.h alist.h arb error.h eval.h \ evalext.h extensions.h feature.h filesys.h fluids.h fports.h futures.h \ gc.h gdb_interface.h gdbint.h \ - goops.h gsubr.h guardians.h hash.h hashtab.h hooks.h init.h \ + goops.h gsubr.h guardians.h hash.h hashtab.h hooks.h i18n.h init.h \ inline.h ioext.h \ iselect.h keywords.h lang.h list.h load.h macros.h mallocs.h modules.h \ net_db.h numbers.h objects.h objprop.h options.h pairs.h ports.h posix.h \ Index: libguile/init.c =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/init.c,v retrieving revision 1.159 diff -p -u -r1.159 init.c --- libguile/init.c 24 Aug 2004 22:13:07 -0000 1.159 +++ libguile/init.c 2 Sep 2004 09:28:02 -0000 @@ -63,6 +63,7 @@ #include "libguile/hash.h" #include "libguile/hashtab.h" #include "libguile/hooks.h" +#include "libguile/i18n.h" #include "libguile/iselect.h" #include "libguile/ioext.h" #include "libguile/keywords.h" @@ -477,6 +478,7 @@ scm_init_guile_1 (SCM_STACKITEM *base) scm_init_properties (); scm_init_hooks (); /* Requires smob_prehistory */ scm_init_gc (); /* Requires hooks, async */ + scm_init_i18n (); scm_init_ioext (); scm_init_keywords (); scm_init_list (); Index: libguile/numbers.c =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/numbers.c,v retrieving revision 1.260 diff -p -u -r1.260 numbers.c --- libguile/numbers.c 24 Aug 2004 16:43:50 -0000 1.260 +++ libguile/numbers.c 2 Sep 2004 09:28:03 -0000 @@ -5848,8 +5848,8 @@ scm_init_numbers () scm_dblprec[10-2] = (DBL_DIG > 20) ? 20 : DBL_DIG; #endif -#ifdef GUILE_DEBUG - check_sanity (); +#ifdef FIXME__GUILE_DEBUG + check_sanity (); #endif exactly_one_half = scm_permanent_object (scm_divide (SCM_I_MAKINUM (1), --- ../ugh-cvs/libguile/libguile.h 1970-01-01 01:00:00 +0100 +++ libguile/i18n.h 2004-09-01 18:12:57 +0200 @@ -0,0 +1,43 @@ +/* classes: h_files */ + +#ifndef SCM_I18N_H +#define SCM_I18N_H + +/* Copyright (C) 2004 Free Software Foundation, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + + +#include "libguile/__scm.h" + + + + + + +SCM_API SCM scm_gettext (SCM string); +SCM_API SCM scm_textdomain (SCM domainname); +SCM_API SCM scm_bindtextdomain (SCM domainname, SCM directory); +SCM_API void scm_init_i18n (void); + +#endif /* SCM_I18N_H */ + +/* + Local Variables: + c-file-style: "gnu" + End: +*/ --- ../ugh-cvs/libguile/libguile.c 1970-01-01 01:00:00 +0100 +++ libguile/i18n.c 2004-09-02 11:24:39 +0200 @@ -0,0 +1,113 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#if HAVE_CONFIG_H +# include +#endif + +#if HAVE_LIBINTL_H +# include +#endif + +#include "libguile/_scm.h" +#include "libguile/feature.h" +#include "libguile/i18n.h" +#include "libguile/strings.h" + + + +#if ! HAVE_GETTEXT +# define gettext(x) (x) +#endif + +SCM_DEFINE (scm_gettext, "gettext", 1, 0, 0, + (SCM string), + "Return gettext lookup of @var{string}.") +#define FUNC_NAME s_scm_gettext +{ + SCM_VALIDATE_STRING (1, string); + return scm_from_locale_string (gettext (SCM_STRING_CHARS (string))); +} +#undef FUNC_NAME + +#if HAVE_TEXTDOMAIN +SCM_DEFINE (scm_textdomain, "textdomain", 0, 1, 0, + (SCM domainname), + "If optional argument @var{domainname} is supplied, " + "set textdomain." + "Return the textdomain.") +#define FUNC_NAME s_scm_textdomain +{ + char *rv; + char *n; + + if (SCM_UNBNDP (domainname)) + n = NULL; + else + { + SCM_VALIDATE_STRING (1, domainname); + n = SCM_STRING_CHARS (domainname); + } + rv = textdomain (n); + if (rv == NULL) + SCM_SYSERROR; + return scm_from_locale_string (rv); +} +#undef FUNC_NAME +#endif /* HAVE_TEXTDOMAIN */ + +#if HAVE_BINDTEXTDOMAIN +SCM_DEFINE (scm_bindtextdomain, "bindtextdomain", 1, 1, 0, + (SCM domainname, SCM directory), + "Set message catalogs for domain @var{domainname} " + "to directory @{directory}." + "Return the bound directory.") +#define FUNC_NAME s_scm_bindtextdomain +{ + char *rv; + char *d; + + SCM_VALIDATE_STRING (1, domainname); + if (SCM_UNBNDP (directory)) + d = NULL; + else + { + SCM_VALIDATE_STRING (2, directory); + d = SCM_STRING_CHARS (directory); + } + rv = bindtextdomain (SCM_STRING_CHARS (domainname), d); + if (rv == NULL) + SCM_SYSERROR; + return scm_from_locale_string (rv); +} +#undef FUNC_NAME +#endif /* HAVE_BINDTEXTDOMAIN */ + +void +scm_init_i18n () +{ + scm_add_feature ("i18n"); +#include "libguile/i18n.x" +} + + +/* + Local Variables: + c-file-style: "gnu" + End: +*/ --=-=-= -- Jan Nieuwenhuizen | GNU LilyPond - The music typesetter http://www.xs4all.nl/~jantien | http://www.lilypond.org --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel --=-=-=--