From: Jan Nieuwenhuizen <janneke@gnu.org>
Cc: guile-devel@gnu.org
Subject: Re: i18n, gettext support
Date: Wed, 01 Sep 2004 18:25:12 +0200 [thread overview]
Message-ID: <87zn4ayn13.fsf@peder.flower> (raw)
In-Reply-To: <200408202226.10769.bruno@clisp.org> (Bruno Haible's message of "Fri, 20 Aug 2004 22:26:10 +0200")
[-- Attachment #1: Type: text/plain, Size: 323 bytes --]
Bruno Haible writes:
> I plan to use this sample "hello world" program as an example. Is this OK
> with you, the guile developers?
Attached is a patch with gettext C bindings for GUILE (which I tried
to avoid before).
When this gets included in GUILE, we can make the final changes to
hello-guile.scm.
Greetings,
Jan.
[-- Attachment #2: guile-1.7.1.jcn1.diff --]
[-- Type: text/plain, Size: 9687 bytes --]
? debug
? doconf
? guile-config/libtool.m4
? guile-config/ltdl.m4
? guile-readline/ice-9
? guile-readline/libtool.m4
? libguile/i18n.c
? libguile/i18n.h
? libguile/init.loT
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 1 Sep 2004 16:17:14 -0000
@@ -1,3 +1,7 @@
+2004-09-01 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * configure.in: Add i18n checks.
+
2004-08-27 Kevin Ryde <user42@zip.com.au>
* 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 1 Sep 2004 16:17:14 -0000
@@ -637,6 +637,14 @@ AC_TRY_LINK([#include <gmp.h>],
[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([gettext.h 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 1 Sep 2004 16:17:17 -0000
@@ -1,3 +1,8 @@
+2004-09-01 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * i18n.h:
+ * i18n.c: New file.
+
2004-08-27 Marius Vollmer <marius.vollmer@uni-dortmund.de>
* 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 1 Sep 2004 16:17:17 -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 1 Sep 2004 16:17:17 -0000
@@ -477,6 +477,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 1 Sep 2004 16:17:18 -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
+ */
+
+\f
+
+#include "libguile/__scm.h"
+
+\f
+
+
+\f
+
+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-01 17:38:29 +0200
@@ -0,0 +1,116 @@
+/* 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 <config.h>
+#endif
+
+#ifdef HAVE_GETEXT_H
+# include <gettext.h>
+#endif
+
+#ifdef HAVE_LIBINTL_H
+# include <libintl.h>
+#endif
+
+#include "libguile/_scm.h"
+#include "libguile/discouraged.h"
+#include "libguile/feature.h"
+#include "libguile/i18n.h"
+#include "libguile/strings.h"
+
+\f
+
+#ifdef HAVE_GETTEXT
+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_makfrom0str (gettext (SCM_STRING_CHARS (string)));
+}
+#undef FUNC_NAME
+#endif /* HAVE_GETTEXT */
+
+#ifdef 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_makfrom0str (rv);
+}
+#undef FUNC_NAME
+#endif /* HAVE_TEXTDOMAIN */
+
+#ifdef 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_makfrom0str (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:
+*/
[-- Attachment #3: Type: text/plain, Size: 141 bytes --]
--
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
[-- Attachment #4: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2004-09-01 16:25 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-20 20:26 i18n, gettext support Bruno Haible
2004-08-23 0:58 ` Kevin Ryde
2004-09-01 16:25 ` Jan Nieuwenhuizen [this message]
2004-09-01 20:57 ` Bruno Haible
2004-09-02 9:38 ` Jan Nieuwenhuizen
2004-09-02 16:06 ` Bruno Haible
2004-09-02 16:21 ` Bruno Haible
2004-09-03 1:34 ` Kevin Ryde
2004-09-04 17:25 ` Bruno Haible
2004-09-07 0:13 ` Kevin Ryde
2004-09-07 12:38 ` Bruno Haible
2004-09-08 1:10 ` Kevin Ryde
2004-09-07 8:20 ` Jan Nieuwenhuizen
2004-09-07 14:16 ` Jan Nieuwenhuizen
2004-09-08 1:15 ` Kevin Ryde
2004-09-08 8:58 ` Jan Nieuwenhuizen
2004-09-08 10:39 ` Bruno Haible
2004-09-08 14:37 ` Jan Nieuwenhuizen
2004-09-08 16:37 ` Bruno Haible
2004-09-08 21:53 ` Jan Nieuwenhuizen
2004-09-08 22:45 ` Kevin Ryde
2004-09-08 23:46 ` Jan Nieuwenhuizen
2004-09-09 16:25 ` Jan Nieuwenhuizen
2004-09-15 11:20 ` Bruno Haible
2004-09-22 0:42 ` Marius Vollmer
2004-09-22 14:55 ` Bruno Haible
2004-09-02 17:32 ` Jan Nieuwenhuizen
2004-09-01 21:44 ` Kevin Ryde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zn4ayn13.fsf@peder.flower \
--to=janneke@gnu.org \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).