Tk Source Code

Check-in [e9ffec09]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Provide fallback for _strtoi64
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e9ffec09c4b27e71cae231891d5ffc6c3b8198a2
User & Date: jan.nijtmans 2012-02-26 21:40:08
Context
2012-02-28
13:47
[Bug 3495198]: Corrected types of canvas bitmap options. check-in: acd15416 user: dkf tags: trunk
2012-02-26
21:40
Provide fallback for _strtoi64 check-in: e9ffec09 user: jan.nijtmans tags: trunk
21:35
Provide fallback for _strtoi64 check-in: 19eec190 user: jan.nijtmans tags: core-8-5-branch
2012-02-25
08:12
[Bug 1913750]: tk_chooseDirectory -initialdir internationalization problem check-in: 3e882ee5 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.







1
2
3
4
5
6
7






2012-02-25  Jan Nijtmans  <[email protected]>

	* win/tkWinDialog.c: [Bug 1913750]: tk_chooseDirectory -initialdir
	internationalization problem.

2012-02-15  Jan Nijtmans  <[email protected]>

>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2012-02-26  Jan Nijtmans  <[email protected]>

	* xlib/xcolors.c: Provide fallback for _strtoi64
	* win/configure.in: Detect whether _strtoi64 is available
	* win/configure: (regenerated)

2012-02-25  Jan Nijtmans  <[email protected]>

	* win/tkWinDialog.c: [Bug 1913750]: tk_chooseDirectory -initialdir
	internationalization problem.

2012-02-15  Jan Nijtmans  <[email protected]>

Changes to win/configure.

4085
4086
4087
4088
4089
4090
4091



































































4092
4093
4094
4095
4096
4097
4098
  :
else
  MAN2TCLFLAGS="-DNO_ERRNO_H"
fi







































































#--------------------------------------------------------------------
# Windows XP theme engine header for Ttk
#--------------------------------------------------------------------

echo "$as_me:$LINENO: checking for uxtheme.h" >&5
echo $ECHO_N "checking for uxtheme.h... $ECHO_C" >&6







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
  :
else
  MAN2TCLFLAGS="-DNO_ERRNO_H"
fi




#-------------------------------------------
#     Check for _strtoi64
#-------------------------------------------

echo "$as_me:$LINENO: checking availability of _strtoi64" >&5
echo $ECHO_N "checking availability of _strtoi64... $ECHO_C" >&6
if test "${tcl_have_strtoi64+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

    cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <stdlib.h>
int
main ()
{
_strtoi64(0,0,0)
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"
			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  tcl_have_strtoi64=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

tcl_have_strtoi64=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $tcl_have_strtoi64" >&5
echo "${ECHO_T}$tcl_have_strtoi64" >&6
if test $tcl_have_strtoi64 = no; then

cat >>confdefs.h <<\_ACEOF
#define NO_STRTOI64 1
_ACEOF

fi

#--------------------------------------------------------------------
# Windows XP theme engine header for Ttk
#--------------------------------------------------------------------

echo "$as_me:$LINENO: checking for uxtheme.h" >&5
echo $ECHO_N "checking for uxtheme.h... $ECHO_C" >&6

Changes to win/configure.in.

93
94
95
96
97
98
99












100
101
102
103
104
105
106

#--------------------------------------------------------------------
# man2tcl needs this so that it can use errno.h
#--------------------------------------------------------------------

AC_CHECK_HEADER(errno.h, , MAN2TCLFLAGS="-DNO_ERRNO_H")
AC_SUBST(MAN2TCLFLAGS)













#--------------------------------------------------------------------
# Windows XP theme engine header for Ttk
#--------------------------------------------------------------------

AC_CHECK_HEADER([uxtheme.h], [AC_DEFINE(HAVE_UXTHEME_H)],
	[AC_MSG_NOTICE([xpnative theme will be unavailable])],







>
>
>
>
>
>
>
>
>
>
>
>







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

#--------------------------------------------------------------------
# man2tcl needs this so that it can use errno.h
#--------------------------------------------------------------------

AC_CHECK_HEADER(errno.h, , MAN2TCLFLAGS="-DNO_ERRNO_H")
AC_SUBST(MAN2TCLFLAGS)

#-------------------------------------------
#     Check for _strtoi64
#-------------------------------------------

AC_CACHE_CHECK([availability of _strtoi64], tcl_have_strtoi64, [
    AC_TRY_LINK([#include <stdlib.h>],
	    [_strtoi64(0,0,0)],
	    tcl_have_strtoi64=yes, tcl_have_strtoi64=no)])
if test $tcl_have_strtoi64 = no; then
    AC_DEFINE(NO_STRTOI64, 1, [Is _strtoi64 function available?])
fi

#--------------------------------------------------------------------
# Windows XP theme engine header for Ttk
#--------------------------------------------------------------------

AC_CHECK_HEADER([uxtheme.h], [AC_DEFINE(HAVE_UXTHEME_H)],
	[AC_MSG_NOTICE([xpnative theme will be unavailable])],

Changes to xlib/xcolors.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tkInt.h"

/*
 * This value will be set to the number of colors in the color table
 * the first time it is needed.
 */

static int numXColors = 0;

/*
 * Forward declarations for functions used only in this file.
 */

static int	FindColor(const char *name, XColor *colorPtr);

/*







<
<
<
<
<
<
<







8
9
10
11
12
13
14







15
16
17
18
19
20
21
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include "tkInt.h"








/*
 * Forward declarations for functions used only in this file.
 */

static int	FindColor(const char *name, XColor *colorPtr);

/*
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
     { "yellow", 255, 255, 0 },
     { "yellow green", 154, 205, 50 },
     { "yellow1", 255, 255, 0 },
     { "yellow2", 238, 238, 0 },
     { "yellow3", 205, 205, 0 },
     { "yellow4", 139, 139, 0 },
     { "YellowGreen", 154, 205, 50 },
     { NULL, 0, 0, 0 }
};

/*
 *----------------------------------------------------------------------
 *
 * FindColor --
 *







<







778
779
780
781
782
783
784

785
786
787
788
789
790
791
     { "yellow", 255, 255, 0 },
     { "yellow green", 154, 205, 50 },
     { "yellow1", 255, 255, 0 },
     { "yellow2", 238, 238, 0 },
     { "yellow3", 205, 205, 0 },
     { "yellow4", 139, 139, 0 },
     { "YellowGreen", 154, 205, 50 },

};

/*
 *----------------------------------------------------------------------
 *
 * FindColor --
 *
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
static int
FindColor(
    const char *name,
    XColor *colorPtr)
{
    int l, u, r, i = 0;

    /*
     * Count the number of elements in the color array if we haven't done so
     * yet.
     */

    if (numXColors == 0) {
	const XColorEntry *ePtr;
	for (ePtr = xColors; ePtr->name != NULL; ePtr++) {
	    numXColors++;
	}
    }

    /*
     * Perform a binary search on the sorted array of colors.
     */

    l = 0;
    u = numXColors - 1;
    while (l <= u) {
	i = (l + u) / 2;
	r = strcasecmp(name, xColors[i].name);
	if (r == 0) {
	    break;
	} else if (r < 0) {
	    u = i-1;







<
<
<
<
<
<
<
<
<
<
<
<





|







805
806
807
808
809
810
811












812
813
814
815
816
817
818
819
820
821
822
823
824
static int
FindColor(
    const char *name,
    XColor *colorPtr)
{
    int l, u, r, i = 0;













    /*
     * Perform a binary search on the sorted array of colors.
     */

    l = 0;
    u = sizeof(xColors)/sizeof(xColors[0]) - 1;
    while (l <= u) {
	i = (l + u) / 2;
	r = strcasecmp(name, xColors[i].name);
	if (r == 0) {
	    break;
	} else if (r < 0) {
	    u = i-1;
866
867
868
869
870
871
872





























873
874
875
876
877
878
879
 *	Returns non-zero on success.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */






























Status
XParseColor(
    Display *display,
    Colormap map,
    const char *spec,
    XColor *colorPtr)







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
 *	Returns non-zero on success.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

#ifdef __WIN32__
#   ifdef NO_STRTOI64
/* This version only handles hex-strings without 0x prefix */
static __int64
_strtoi64(const char *spec, char **p, int base)
{
    __int64 result = 0;
    char c;
    while ((c = *spec)) {
	if ((c >= '0') && (c <= '9')) {
	    c -= '0';
	} else if ((c >= 'A') && (c <= 'F')) {
	    c += (10 - 'A');
	} else if ((c >= 'a') && (c <= 'f')) {
	    c += (10 - 'a');
	} else {
	    break;
	}
	result = (result << 4) + c;
	++spec;
    }
    *p = (char *) spec;
    return result;
}
#   endif
#else
#   define _strtoi64 strtoll
#endif

Status
XParseColor(
    Display *display,
    Colormap map,
    const char *spec,
    XColor *colorPtr)