From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19885 invoked by alias); 21 Jun 2002 22:57:27 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19873 invoked from network); 21 Jun 2002 22:57:24 -0000 Received: from unknown (HELO gash2.peakpeak.com) (207.174.178.17) by sources.redhat.com with SMTP; 21 Jun 2002 22:57:24 -0000 Received: from fleche.redhat.com (ta0196.peakpeak.com [204.144.244.196]) by gash2.peakpeak.com (8.9.3/8.9.3) with ESMTP id QAA31747 for ; Fri, 21 Jun 2002 16:57:22 -0600 Received: by fleche.redhat.com (Postfix, from userid 1000) id A7AE74F80BA; Fri, 21 Jun 2002 17:10:45 -0600 (MDT) To: Andrew Cagney Cc: Elena Zannoni , gdb-patches@sources.redhat.com Subject: Re: RFA: start of i18n References: <87elf0wnp2.fsf@fleche.redhat.com> <15635.26155.499501.230768@localhost.redhat.com> <3D13A500.4070609@cygnus.com> From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom X-Zippy: It's the RINSE CYCLE!! They've ALL IGNORED the RINSE CYCLE!! Date: Fri, 21 Jun 2002 15:57:00 -0000 In-Reply-To: <3D13A500.4070609@cygnus.com> Message-ID: <87n0torzwq.fsf@fleche.redhat.com> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-06/txt/msg00452.txt.bz2 Andrew> And the rest. Just suggest moving: Andrew> [ ... ] Andrew> to "gdb_locale.h" and then including that. Ok, I did that. New patch appended. I still have gdb_locale.h included in defs.h. My rationale is that most files will eventually want to use these macros. Is this how you'd like it to be done? If not I can easily remove the #include from defs.h and just include it in each .c file by need. Andrew> Does src/Makefile.in:all-gdb need any dependency tweaks? Not yet. That will come with the addition of the po directory. Tom Index: ChangeLog from Tom Tromey * gdb_locale.h: New file. * Makefile.in (GDB_CFLAGS): Define LOCALEDIR. (defs_h): Added gdb_locale.h. * configure, config.in: Rebuilt. * configure.in (PACKAGE): Define. * defs.h: Include gdb_locale.h. * main.c (captured_main): Call setlocale, bindtextdomain, textdomain. Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.209 diff -u -r1.209 Makefile.in --- Makefile.in 14 Jun 2002 22:30:41 -0000 1.209 +++ Makefile.in 21 Jun 2002 22:54:14 -0000 @@ -312,7 +312,7 @@ # your system doesn't have fcntl.h in /usr/include (which is where it # should be according to Posix). DEFS = @DEFS@ -GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config $(DEFS) +GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config -DLOCALEDIR="\"$(prefix)/share/locale\"" $(DEFS) # M{H,T}_CFLAGS, if defined, have host- and target-dependent CFLAGS # from the config directory. @@ -619,7 +619,7 @@ cp_abi_h = cp-abi.h dcache_h = dcache.h defs_h = defs.h $(xm_h) $(tm_h) $(nm_h) config.status config.h \ - gdbarch.h ui-file.h $(INCLUDE_DIR)/gdb/signals.h + gdbarch.h ui-file.h $(INCLUDE_DIR)/gdb/signals.h gdb_locale.h doublest_h = doublest.h $(floatformat_h) dwarf2cfi_h = dwarf2cfi.h event_loop_h = event-loop.h Index: configure.in =================================================================== RCS file: /cvs/src/src/gdb/configure.in,v retrieving revision 1.87 diff -u -r1.87 configure.in --- configure.in 11 May 2002 00:40:25 -0000 1.87 +++ configure.in 21 Jun 2002 22:54:20 -0000 @@ -33,10 +33,11 @@ AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) AC_CANONICAL_SYSTEM -dnl gdb doesn't use gettext, but bfd does. We call this to ensure we -dnl link with the correct libraries. +dnl Set up for gettext. PACKAGE is used when we call bindtextdomain. ALL_LINGUAS= CY_GNU_GETTEXT +AC_DEFINE(PACKAGE, "gdb", [Name of this package. ]) + dnl List of object files added by configure. Index: defs.h =================================================================== RCS file: /cvs/src/src/gdb/defs.h,v retrieving revision 1.89 diff -u -r1.89 defs.h --- defs.h 15 Jun 2002 18:45:31 -0000 1.89 +++ defs.h 21 Jun 2002 22:54:21 -0000 @@ -39,6 +39,8 @@ #include #endif +#include "gdb_locale.h" + /* For ``enum target_signal''. */ #include "gdb/signals.h" Index: gdb_locale.h =================================================================== RCS file: gdb_locale.h diff -N gdb_locale.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb_locale.h 21 Jun 2002 22:54:25 -0000 @@ -0,0 +1,46 @@ +/* GDB-friendly replacement for . + Copyright 2002 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef GDB_LOCALE_H +#define GDB_LOCALE_H + +#ifdef HAVE_LOCALE_H +# include +#endif + +#ifdef ENABLE_NLS +# include +# define _(String) gettext (String) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +#else +# define gettext(Msgid) (Msgid) +# define dgettext(Domainname, Msgid) (Msgid) +# define dcgettext(Domainname, Msgid, Category) (Msgid) +# define textdomain(Domainname) while (0) /* nothing */ +# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */ +# define _(String) (String) +# define N_(String) (String) +#endif + +#endif /* GDB_LOCALE_H */ Index: main.c =================================================================== RCS file: /cvs/src/src/gdb/main.c,v retrieving revision 1.16 diff -u -r1.16 main.c --- main.c 17 Jan 2002 22:15:17 -0000 1.16 +++ main.c 21 Jun 2002 22:54:28 -0000 @@ -157,6 +157,15 @@ long time_at_startup = get_run_time (); +#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) + setlocale (LC_MESSAGES, ""); +#endif +#if defined (HAVE_SETLOCALE) + setlocale (LC_CTYPE, ""); +#endif + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + START_PROGRESS (argv[0], 0); #ifdef MPW