Skip to content
Tcl Source Code History Of Ticket 219090
Login

History Of Ticket 219090

Artifacts Associated With Ticket 219090

  1. Ticket change [ae03666bf9] (rid 101556) by nobody on 2000-10-26 01:10:34:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 5422 RFE
      Version: 8.3.1
      SubmitDate: '2000-05-10'
      LastModified: '2000-05-18'
      Severity: SER
      Status: Released
      Submitter: techsupp
      ChangedBy: hobbs
      RelatedBugIDs: 4236 4280 3345 5425
      OS: Linux-Red Hat
      Machine: RedHat Linux 6.1J
      FixedDate: '2000-05-18'
      FixedInVersion: 8.4a1
      ClosedDate: '2000-10-25'
      
      
      Name:
      Keiichi Takahashi
      
      CVS:
      10-May-2000
      
      DesiredBehavior:
      Currently, XIM support doesn't work yet on UNIX. Here are the patches originally written by m-hirano <[email protected]> to make everything work.
      
      Patch:
      diff -c -r -P tcl8.4/unix/Makefile.in xim/tcl8.4/unix/Makefile.in
      *** tcl8.4/unix/Makefile.inWed May  3 09:13:55 2000
      --- xim/tcl8.4/unix/Makefile.inWed May 10 10:42:39 2000
      ***************
      *** 82,87 ****
      --- 82,90 ----
        CFLAGS_DEBUG= @CFLAGS_DEBUG@
        CFLAGS_OPTIMIZE= @CFLAGS_OPTIMIZE@
      
      + # I18n improvement flags
      + I18N_FLAGS= @I18N_FLAGS@
      + 
        # To change the compiler switches, for example to change from optimization to
        # debugging symbols, change the following line:
        #CFLAGS= $(CFLAGS_DEBUG)
      ***************
      *** 212,218 ****
      
        COMPAT_OBJS= @LIBOBJS@
      
      ! AC_FLAGS= @EXTRA_CFLAGS@ @DEFS@
        RANLIB= @RANLIB@
        SRC_DIR= @srcdir@
        TOP_DIR= @srcdir@/..
      --- 215,221 ----
      
        COMPAT_OBJS= @LIBOBJS@
      
      ! AC_FLAGS= @EXTRA_CFLAGS@ @DEFS@ @CPPFLAGS@ @I18N_FLAGS@
        RANLIB= @RANLIB@
        SRC_DIR= @srcdir@
        TOP_DIR= @srcdir@/..
      diff -c -r -P tcl8.4/unix/configure.in xim/tcl8.4/unix/configure.in
      *** tcl8.4/unix/configure.inWed May  3 09:15:10 2000
      --- xim/tcl8.4/unix/configure.inWed May 10 10:42:39 2000
      ***************
      *** 141,146 ****
      --- 141,152 ----
            AC_DEFINE(NO_FD_SET)
        fi
      
      + #------------------------------------------------------------------------
      + # i18n improvement
      + #------------------------------------------------------------------------
      + 
      + SC_ENABLE_I18N_IMPROVE
      + 
        #------------------------------------------------------------------------------
        #       Find out all about time handling differences.
        #------------------------------------------------------------------------------
      diff -c -r -P tcl8.4/unix/tcl.m4 xim/tcl8.4/unix/tcl.m4
      *** tcl8.4/unix/tcl.m4Fri Apr 14 15:42:41 2000
      --- xim/tcl8.4/unix/tcl.m4Wed May 10 10:46:35 2000
      ***************
      *** 1748,1750 ****
      --- 1748,1791 ----
            AC_SUBST(TCL_LIBS)
            AC_SUBST(MATH_LIBS)
        ])
      + 
      + #------------------------------------------------------------------------
      + # SC_ENABLE_I18N_IMPROVE
      + #
      + #Decide use i18n improved features or not.
      + #
      + # Arguments:
      + #none
      + #
      + # Results:
      + #
      + #Adds the following arguments to configure:
      + #--enable-i18nImprove=yes|no
      + #
      + #Defines the following vars:
      + #I18N_FLAGSvalue of '-DI18N_IMPROVE' or ''
      + #------------------------------------------------------------------------
      + 
      + AC_DEFUN(SC_ENABLE_I18N_IMPROVE, [
      +     AC_MSG_CHECKING([if i18n improvement features are enabled])
      +     AC_ARG_ENABLE(i18nImprove,
      +     [  --enable-i18nImprove    enable i18n improvement features [--enable-i18nImprove]],
      +     [tcl_ok=$enableval], [tcl_ok=yes])
      + 
      +     if test "${enable_i18nImprove+set}" = set; then
      + enableval="$enable_i18nImprove"
      + tcl_ok=$enableval
      +     else
      + tcl_ok=yes
      +     fi
      + 
      +     if test "$tcl_ok" = "yes" ; then
      + AC_MSG_RESULT([enabled])
      + I18N_FLAGS='-DI18N_IMPROVE'
      +     else
      + AC_MSG_RESULT([disabled])
      + I18N_FLAGS=''
      +     fi
      + 
      +     AC_SUBST(I18N_FLAGS)
      + ])
      diff -c -r -P tcl8.4/unix/tclConfig.sh.in xim/tcl8.4/unix/tclConfig.sh.in
      *** tcl8.4/unix/tclConfig.sh.inFri Jul 30 04:21:32 1999
      --- xim/tcl8.4/unix/tclConfig.sh.inWed May 10 10:42:39 2000
      ***************
      *** 21,27 ****
        TCL_CC='@CC@'
      
        # -D flags for use with the C compiler.
      ! TCL_DEFS='@DEFS@'
      
        # If TCL was built with debugging symbols, generated libraries contain
        # this string at the end of the library name (before the extension).
      --- 21,27 ----
        TCL_CC='@CC@'
      
        # -D flags for use with the C compiler.
      ! TCL_DEFS='@DEFS@ @I18N_FLAGS@'
      
        # If TCL was built with debugging symbols, generated libraries contain
        # this string at the end of the library name (before the extension).
      ***************
      *** 30,35 ****
      --- 30,38 ----
        # Default flags used in an optimized and debuggable build, respectively.
        TCL_CFLAGS_DEBUG='@CFLAGS_DEBUG@'
        TCL_CFLAGS_OPTIMIZE='@CFLAGS_OPTIMIZE@'
      + 
      + # I18n improvement flags
      + TCL_I18N_IMPROVE_FLAGS='@I18N_FLAGS@'
      
        # Default linker flags used in an optimized and debuggable build, respectively.
        TCL_LDFLAGS_DEBUG='@LDFLAGS_DEBUG@'
      diff -c -r -P tcl8.4/unix/tclUnixInit.c xim/tcl8.4/unix/tclUnixInit.c
      *** tcl8.4/unix/tclUnixInit.cWed Oct 13 09:32:49 1999
      --- xim/tcl8.4/unix/tclUnixInit.cWed May 10 10:42:39 2000
      ***************
      *** 369,375 ****
      --- 369,377 ----
            int i;
            Tcl_Obj *pathPtr;
            char *langEnv;
      + #ifndef I18N_IMPROVE
            Tcl_DString ds;
      + #endif /* !I18N_IMPROVE */
      
            /*
             * Determine the current encoding from the LC_* or LANG environment
      ***************
      *** 432,437 ****
      --- 434,440 ----
      
            Tcl_SetSystemEncoding(NULL, encoding);
      
      + #ifndef I18N_IMPROVE
            /*
             * Initialize the C library's locale subsystem.  This is required
             * for input methods to work properly on X11. Note that we need to
      ***************
      *** 445,450 ****
      --- 448,497 ----
            setlocale(LC_ALL, "");
            setlocale(LC_ALL, Tcl_DStringValue(&ds));
            Tcl_DStringFree(&ds);
      + #else
      +     /*
      +      * Hey, aboves are helpful for X11 XIM, NOT!!!!
      +      *
      +      * If setlocale(LC_ALL, "") are once called, NOT reset to "C"
      +      * BECAUSE OF X11 uses locale sensitive libc routines such as:
      +      * 
      +      *mblen()
      +      *mbstowcs()
      +      *wcstombs()
      +      *
      +      * Calling setlocale() with proper locale is of course needed,
      +      * futhermore, keeping the proper locale setting is ALSO needed
      +      * for proper XIM operation. If not, in the worst case, Tk dumps
      +      * core.
      +      *
      +      * And here's another story:
      +      *
      +      * X11[56]'s internationalization depends on "locale model"
      +      * supported by C language (runtime). But unfortunately, on some
      +      * (many) systems, setlocale(3) supports only "C" locale. For such
      +      * a system, X11 library has _Xsetlocale() (and some locale
      +      * sensitive C runtime function like the mblen(), even If these
      +      * function are not well-implemented, sigh). If on such a system,
      +      * we should't call:
      +      *
      +      *setlocale(LC_ALL)
      +      *or
      +      *setlocale(LC_CTYPE)
      +      *
      +      * at here because Tcl won't be linked with X11 libraries and
      +      * nobody want to use the Tcl library that needs X11 libraries at
      +      * execution/linkage time. Instead, call setlocale() (expanded to
      +      * _Xsetlocale() with C preprocessor macro in <X11/Xlocale.h> if
      +      * X_LOCLAE C preprocessor macro is defined, normaly done in Imake
      +      * environment) at the initializing of Tk. So, at here, I just
      +      * call only setlocale(LC_NUMERIC) since X11's internationalize
      +      * implementation only depends on LC_CTYPE categoly (of cource
      +      * LC_ALL includes this), This must be harmless and might let the
      +      * Tcl and the Tk with XIM be both happy :)
      +      *
      +      *m-hirano
      +      */
      + #endif /* !I18N_IMPROVE */
      
            /*
             * In case the initial locale is not "C", ensure that the numeric
      
      PatchFiles:
      tcl8.4/unix/Makefile.in
          tcl8.4/unix/configure.in
          tcl8.4/unix/tcl.m4
          tcl8.4/unix/tclConfig.sh
          tcl8.4/unix/tclConfig.sh.in
          tcl8.4/unix/tclUnixInit.c
      
      
      
      There were somewhat conflicting patches to get various i18n and
      
      l10n issues fixed.  I have chosen to simplify things at the Tcl
      
      level by not have any extra flags.
      
      
      
      For 8.4a1, I am going to try the following code:
      
      
      
          resetPath:
      
          /*
      
           * Initialize the C library's locale subsystem.  This is required
      
           * for input methods to work properly on X11.  We only do this for
      
           * LC_CTYPE because that's the necessary one, and we don't want to
      
           * affect LC_TIME here.  The side effect of setting the default locale
      
           * should be to load any locale specific modules that are needed by X.
      
           * [BUG: 5422 3345 4236 2522 2521].
      
           */
      
      
      
          setlocale(LC_CTYPE, "");
      
      
      
          /*
      
           * In case the initial locale is not "C", ensure that the numeric
      
           * processing is done in "C" locale regardless.  This is needed because
      
           * Tcl relies on routines like strtod, but should not have locale
      
           * dependent behavior.
      
           */
      
      
      
          setlocale(LC_NUMERIC, "C");
      
      
      
      This means only LC_CTYPE gets interped, not LC_ALL (and thus not
      
      LC_TIME).  Most users want to rely on clock returning an English
      
      formatted time.  If only the %c format to clock would use the locale
      
      specific times, then we could make the LC_CTYPE into LC_ALL, but I
      
      don't have a system on which to test that.  If that is not the case,
      
      then it would be better to add a 'locale' command in Tcl to control
      
      these things optionally (or maybe 'encoding locale ...').
      
      
      
      I have also added the external encoding fix for tclClock.c from 3345,
      
      although we don't change the LC_TIME explicitly yet.
      
      
      
      This will have to be reconciled against 5425, XIM support for Tk.
      
      Hopefully this will correct the core to work reliably on all systems,
      
      while still allowing for extensions to change the locale and have Tcl
      
      still work (all except changing LC_NUMERIC).
      
      
      
      Some comments from users that caused this decision:
      
      
      
      -- Motonori Heita Hirano [[email protected]] --
      
      
      
        What the most important things to let the XIM work fine are:
      
      
      
      1. Call setlocale(LC_CTYPE, "") before calling XOpenIO().
      
      2. Once the above was done, DON'T CHANGE LC_CTYPE setting via calling
      
         setlocale(LC_CTYPE, "otherValue").
      
      
      
        Furthermore, to care about systems using _xsetlocale() in Xlib
      
      instead of setlocale(3) in libc (or some other libraries),
      
      
      
      3. DON'T CALL setlocale(3) in Tcl BUT Tk or We have to link Tcl with
      
         -lX11 and we know this kinda Tcl sucks.
      
      --------
      
      
      
      -- Victor Wagner [[email protected]] --
      
      
      
      As far as I'm understand, Xkb input (which most Russian users use) 
      
      wouldn't work without LC_CTYPE or additional environment variable
      
      _XKB_CHARSET (which is considered ugly hack).
      
      
      
      LC_COLLATE is not neccessary becouse all sorting is done in Unicode
      
      (although unicode binary sequence may not be sufficient for Ukrainian and
      
      Belorussian users), but definitely does no harm. 
      
      
      
      LC_TIME is neccessary for correct date output, so it is useful only in
      
      conjunction with clock patch and rather harmful without it.
      
      
      
      LC_MESSAGES seems to be totally irrelevant for TCL.
      
      
      
      So, there are really two options:
      
      
      
      1. Explicitely set LC_CTYPE and LC_TIME
      
         It has that benefit that setting LC_TIME can be controlled by same
      
         configuration option as clock patch if you decide to make it optional.
      
      
      
      2. Set LC_ALL and reset LC_NUMERIC later.
      
         which seems better, becouse may be somebody would come out with
      
         extension to support GNU gettext, and we already have provisions
      
         for correctly setting LC_MESSAGES for it.
      
      --------------------
      
      
      
      -- Motonori Heita Hirano [[email protected]] --
      
      
      
      >>>   I believe Tcl dose NOT depend on locale model, right? Why do
      
      >>> those Russians need to call setlocale(3) in Tcl ???
      
      
      
      >> Becouse we do want our native month and weekday names and want to
      
      >> read system messages on our native language.  I've heard that in
      
      >> Japan every educated person know enough English to understand
      
      >> simple things. In Russia it is not a case.
      
      
      
        I got it. Try following patch for my latest patch.
      
      
      
      ------- For Tcl ----------------------------------------------------
      
      *** ./tclUnixInit.c.bak Mon May  1 15:28:59 2000
      
      --- ./tclUnixInit.c     Thu May 18 17:06:57 2000
      
      ***************
      
      *** 491,496 ****
      
      --- 491,504 ----
      
             *
      
             *        m-hirano
      
             */
      
      +     /*
      
      +      * Thu May 18 16:57:42 JST 2000
      
      +      *  For people who want to use locale dependent messages in Tcl,
      
      +      * call setlocale(LC_ALL, "") here anyway. I know this is harmful
      
      +      * with asian locale on FreeBSD. On FreeBSD, Tcl must be linked
      
      +      * with -lxpg4 if I call setlocale(LC_ALL, "") very here.
      
      +      */
      
      +     (void)setlocale(LC_ALL, "");
      
        #endif /* !I18N_IMPROVE */
      
        
      
            /*
      
      ------- For Tk ----------------------------------------------------
      
      *** ../generic/tkWindow.c.bak   Thu May 18 17:51:56 2000
      
      --- ../generic/tkWindow.c       Thu May 18 17:52:45 2000
      
      ***************
      
      *** 2515,2523 ****
      
               */
      
        
      
              /*
      
      !        * OK, First of all, setting WHOLE locale to "C".
      
               */
      
      !       (void)setlocale(LC_ALL, "C");
      
              if (setlocale(LC_CTYPE, locale) == NULL) {
      
                  /*
      
                   * Reset to old locale.
      
      --- 2515,2524 ----
      
               */
      
        
      
              /*
      
      !        * OK, First of all, setting WHOLE locale to "" as usual UNIX
      
      !        * i18n'd program.
      
               */
      
      !       (void)setlocale(LC_ALL, "");
      
              if (setlocale(LC_CTYPE, locale) == NULL) {
      
                  /*
      
                   * Reset to old locale.
      
      -----------------------------------------------------------
      
      
      
       
      
      -- 05/18/2000 hobbs
      
    4. foundin initialized to: "obsolete: 8.3.1"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "57. zlib"
    10. title initialized to: "XIM Support"
    11. type initialized to: "Bug"
  2. Ticket change [d895a07746] (rid 107468) by welch on 2000-10-26 08:34:55:

    1. closedate changed to: "2000-10-26T01:34:55"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [424c3144b9] (rid 116345) by dgp on 2001-04-06 03:18:24:

    1. closedate changed to: "2001-04-05T20:18:24"
    2. closer changed to: "dgp"
    3. subsystem changed to: "53. Configuration and Build Tools"