From: Bruno Haible Date: Mon, 7 Mar 2005 19:45:23 +0000 (+0000) Subject: Remove old sh, tcl, perl interfaces. X-Git-Tag: v0.14.3~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c1145aceaacfcaa249296b269c4939aae4f67f0;p=thirdparty%2Fgettext.git Remove old sh, tcl, perl interfaces. --- diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog index debd9227a..8abe5dde4 100644 --- a/gettext-tools/misc/ChangeLog +++ b/gettext-tools/misc/ChangeLog @@ -1,3 +1,11 @@ +2005-03-05 Bruno Haible + + Remove old sh, tcl, perl interfaces. + * gettext-sh: Remove file. + * tcl_gettext.c, README-Tcl: Remove files. + * gettext.perl: Remove file. + * Makefile.am (EXTRA_DIST): Remove them. + 2005-02-24 Bruno Haible * gettext-0.14.2 released. diff --git a/gettext-tools/misc/Makefile.am b/gettext-tools/misc/Makefile.am index 33f86f530..5a5d32902 100644 --- a/gettext-tools/misc/Makefile.am +++ b/gettext-tools/misc/Makefile.am @@ -1,5 +1,5 @@ ## Makefile for the gettext-tools/misc subdirectory of GNU gettext -## Copyright (C) 1995-1997, 2000-2003 Free Software Foundation, Inc. +## Copyright (C) 1995-1997, 2000-2003, 2005 Free Software Foundation, Inc. ## ## 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 @@ -46,21 +46,6 @@ lisp_LISP = po-mode.el po-compat.el EXTRA_DIST += $(lisp_LISP) -# Old sh interface. - -EXTRA_DIST += gettext-sh - - -# Old Tcl interface. - -EXTRA_DIST += tcl_gettext.c README-Tcl - - -# Old Perl interface. - -EXTRA_DIST += gettext.perl - - # VMS support. EXTRA_DIST += Makefile.vms diff --git a/gettext-tools/misc/README-Tcl b/gettext-tools/misc/README-Tcl deleted file mode 100644 index 7b9f6f95b..000000000 --- a/gettext-tools/misc/README-Tcl +++ /dev/null @@ -1,52 +0,0 @@ - Gettext support for Tcl - ======================= - -The file `tcl_gettext.c' contains the first attempt to provide an -interface for Tcl. I know that TclX already supports `catgets', but -because GNU uses `gettext' and because I think `gettext' is the better -concept I wrote this file. - - -Unlike many other interpreter extension I haven't provided a -`tclAppInit.c' file. I have three reason: it's easy to write (see -Ousterhout's book), It will probably combined with other extensions -and so would be more or less useless. But the most important reason -is that I don't find Tcl useful without the dynamic loading introduced -in version 7.5. - -The way I think you should use this module is to build a dynamic -object and load it at runtime with the command `load'. The following -transcript shows the way I work on my Linux/ELF box. Consult other -Tcl modules or a local wizard to see how it works for your system. - - -1. Compile the file to position independent object code: - - gcc -fPIC -O3 -c tcl_gettext.c - - (The file `tcl.h' from tcl7.5 or up and `libintl.h' as installed - from GNU gettext must be found in the path.) - -2. Link the file to a shared object: - - gcc -shared -o gettext.so tcl_gettext.o -lintl - - (The system's or GNU gettext libintl.a must be found in the path - of the linker.) - -3. Now we are ready to run: - -bash> tclsh7.5 -% load ./gettext.so Gettext -% textdomain "xxx" -% gettext "some string" -The translated form -% exit -bash> - - -If you have some ideas how to improve this or you found a bug, please -let me know. - -Ulrich Drepper , 18. December 1995. - diff --git a/gettext-tools/misc/gettext-sh b/gettext-tools/misc/gettext-sh deleted file mode 100644 index ee15babd1..000000000 --- a/gettext-tools/misc/gettext-sh +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (C) 1995 Free Software Foundation, Inc. -# Written by Ulrich Drepper , August 1995 -# -# 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, 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. -# -# Shell script excerpt to be inserted in shell scripts which are intended -# to be internationalized using GNU gettext. -# -# Precondition: -# ${PACKAGE-IDENT} is the name of one program of the package which -# understands the --print-text-domain-dir option -# ${PACKAGE-NAME} is the name of the message domain the package uses -# ${PATH} should list all directories which should be searched -# for either `gettext' or ${PACKAGE-IDENT}. -# -# Postcondition: -# ${echo} command to use like Un*x echo command which translates -# its arguments when a translation is available. -# -save_IFS="${IFS}" -IFS="${IFS}:" -gettext_dir=FAILED -locale_dir=FAILED -for dir in ${PATH} -do - if test "${gettext_dir}" = "FAILED" && test -x ${dir}/gettext \ - && (${dir}/gettext --version >/dev/null 2>&1) - then - set `${dir}/gettext --version 2>&1` - if test "$3" = "GNU" - then - gettext_dir=${dir} - fi - fi - if test "${locale_dir}" = "FAILED" && test -x ${dir}/${PACKAGE-IDENT} \ - && (${dir}/${PACKAGE-IDENT} --print-text-domain-dir >/dev/null 2>&1) - then - locale_dir=`${dir}/${PACKAGE-IDENT} --print-text-domain-dir` - fi -done -IFS="${save_IFS}" -if test "${locale_dir}" = "FAILED" || test "${gettext_dir}" = "FAILED" -then - echo=echo -else - TEXTDOMAINDIR=${locale_dir} - export TEXTDOMAINDIR - TEXTDOMAIN=${PACKAGE-NAME} - export TEXTDOMAIN - echo="${gettext_dir}/gettext -s" -fi diff --git a/gettext-tools/misc/gettext.perl b/gettext-tools/misc/gettext.perl deleted file mode 100644 index 7bd1ee830..000000000 --- a/gettext-tools/misc/gettext.perl +++ /dev/null @@ -1,86 +0,0 @@ -# Toying at an interface between Perl and GNU gettext .mo format. -# Copyright (C) 1995 Free Software Foundation, Inc. -# François Pinard , 1995. - -textdomain ("tar"); -print &_("Try \`%s --help\' for more information.\n"); -exit 0; - -## --------------------------------------------------------------- ## -## The `&textdomain (DOMAIN_NAME)' routine reads the given domain ## -## into an associative array %_, able to later translate strings. ## -## --------------------------------------------------------------- ## - -sub textdomain -{ - local ($language, $catalog, $domain, $buffer); - local ($reverse); - local ($magic, $revision, $nstrings, $orig_tab_offset, $trans_tab_offset); - local ($orig_length, $orig_pointer, $trans_length, $trans_pointer); - - %_ = (); - - $language = $ENV{"LANG"}; - return if ! $language; - $domain = $_[0]; - $catalog = "/usr/local/share/locale/$language/LC_MESSAGES/$domain.mo"; - - open (CATALOG, $catalog) || return; - sysread (CATALOG, $buffer, (stat CATALOG)[7]); - close CATALOG; - - $magic = unpack ("I", $buffer); - if (sprintf ("%x", $magic) eq "de120495") - { - $reverse = 1; - } - elsif (sprintf ("%x", $magic) ne "950412de") - { - die "Not a catalog file\n"; - } - - $revision = &mo_format_value (4); - $nstrings = &mo_format_value (8); - $orig_tab_offset = &mo_format_value (12); - $trans_tab_offset = &mo_format_value (16); - - while ($nstrings-- > 0) - { - $orig_length = &mo_format_value ($orig_tab_offset); - $orig_pointer = &mo_format_value ($orig_tab_offset + 4); - $orig_tab_offset += 8; - - $trans_length = &mo_format_value ($trans_tab_offset); - $trans_pointer = &mo_format_value ($trans_tab_offset + 4); - $trans_tab_offset += 8; - - $_{substr ($buffer, $orig_pointer, $orig_length)} - = substr ($buffer, $trans_pointer, $trans_length); - } -} - -## ----------------------------------------------------------------- ## -## The `&mo_format_value (ADDRESS)' routine returns the value at a ## -## given address in the .mo format catalog, once read into $buffer ## -## by `&textdomain'. This is a service routine of `&textdomain', ## -## which uses $buffer and $reverse variables local in that routine. ## -## ----------------------------------------------------------------- ## - -sub mo_format_value -{ - unpack ("i", - $reverse - ? pack ("c4", reverse unpack ("c4", substr ($buffer, $_[0], 4))) - : substr ($buffer, $_[0], 4)); -} - -## ------------------------------------------------------------ ## -## The `&_(STRING)' routine translates STRING if there is some ## -## translation offered for it in the `%_' associative array, or ## -## return STRING itself, otherwize. ## -## ------------------------------------------------------------ ## - -sub _ -{ - defined $_{$_[0]} ? $_{$_[0]} : $_[0]; -} diff --git a/gettext-tools/misc/tcl_gettext.c b/gettext-tools/misc/tcl_gettext.c deleted file mode 100644 index b26849bbc..000000000 --- a/gettext-tools/misc/tcl_gettext.c +++ /dev/null @@ -1,144 +0,0 @@ -/* tcl_gettext - Module implementing gettext interface for Tcl. - Copyright (C) 1995, 1998, 2002 Free Software Foundation, Inc. - Written by Ulrich Drepper , December 1995. - - 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, 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. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -/* Data for Tcl interpreter interface. */ -#include "tcl.h" - - -static int -tcl_gettext (ClientData client_data, Tcl_Interp *interp, - int argc, char *argv[]) -{ - const char *domainname = NULL; - int category = LC_MESSAGES; - const char *msgid; - - /* The pointer which is assigned in the following statement might - reference an invalid part of the address space. But we don't use - this value before we know the pointer is correct. */ - msgid = argv[1]; - - switch (argc) - { - case 4: -#ifdef LC_CTYPE - if (strcmp (argv[3], "LC_CTYPE") == 0) - category = LC_CTYPE; - else -#endif -#ifdef LC_COLLATE - if (strcmp (argv[3], "LC_COLLATE") == 0) - category = LC_COLLATE; - else -#endif -#ifdef LC_MESSAGES - if (strcmp (argv[3], "LC_MESSAGES") == 0) - category = LC_MESSAGES; - else -#endif -#ifdef LC_MONETARY - if (strcmp (argv[3], "LC_MONETARY") == 0) - category = LC_MONETARY; - else -#endif -#ifdef LC_NUMERIC - if (strcmp (argv[3], "LC_NUMERIC") == 0) - category = LC_NUMERIC; - else -#endif -#ifdef LC_TIME - if (strcmp (argv[3], "LC_TIME") == 0) - category = LC_TIME; - else -#endif - { - interp->result = gettext ("invalid third argument"); - return TCL_ERROR; - } - /* FALLTHROUGH */ - - case 3: - domainname = argv[1]; - msgid = argv[2]; - /* FALLTHROUGH */ - - case 2: - interp->result = dcgettext (domainname, msgid, category); - break; - - default: - interp->result = gettext ("wrong number of arguments"); - return TCL_ERROR; - } - - return TCL_OK; -} - - -static int -tcl_textdomain (ClientData client_data, Tcl_Interp *interp, - int argc, char *argv[]) -{ - if (argc != 2) - { - interp->result = gettext ("wrong number of arguments"); - return TCL_ERROR; - } - - interp->result = textdomain (argv[1]); - - return TCL_OK; -} - - -static int -tcl_bindtextdomain (ClientData client_data, Tcl_Interp *interp, - int argc, char *argv[]) -{ - if (argc != 3) - { - interp->result = gettext ("wrong number of arguments"); - return TCL_ERROR; - } - - return bindtextdomain (argv[1], argv[2]) == NULL ? TCL_ERROR : TCL_OK; -} - - -/* Initialization functions. Called from the tclAppInit.c/tkAppInit.c - or while the dynamic loading with Tcl7.x, x>= 5. */ -int -Gettext_Init (Tcl_Interp *interp) -{ - Tcl_CreateCommand (interp, "gettext", tcl_gettext, (ClientData) 0, - (Tcl_CmdDeleteProc *) NULL); - Tcl_CreateCommand (interp, "textdomain", tcl_textdomain, (ClientData) 0, - (Tcl_CmdDeleteProc *) NULL); - Tcl_CreateCommand (interp, "bindtextdomain", tcl_bindtextdomain, - (ClientData) 0, (Tcl_CmdDeleteProc *) NULL); - - return TCL_OK; -}