Tk Source Code

Check-in [6ffcea9b]
Login
Bounty program for improvements to Tcl and certain Tcl packages.

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

Overview
Comment:Fully handle 64-bit sec/usec values when Win64 Tk is loaded in Cygwin64 Tclsh
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA3-256: 6ffcea9b093deb5a2fdf40a5876aba0c362c28a016323aacbf49e181545c6fee
User & Date: jan.nijtmans 2021-09-21 11:58:12
Context
2021-10-11
14:27
Backout 6ffcea9b09: Better solution built into Tcl (Win64 only) now. check-in: 4d844b65 user: jan.nijtmans tags: core-8-6-branch
2021-09-21
18:28
Fix [0338867c74]: Windows text widget hangs when Phaistos font is installed check-in: 1f459031 user: fvogel tags: core-8-6-branch
12:00
Merge 8.6 check-in: 3eace28a user: jan.nijtmans tags: trunk, main
11:58
Fully handle 64-bit sec/usec values when Win64 Tk is loaded in Cygwin64 Tclsh check-in: 6ffcea9b user: jan.nijtmans tags: core-8-6-branch
09:35
Merge 8.5 check-in: e81baf05 user: jan.nijtmans tags: core-8-6-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkBind.c.

788
789
790
791
792
793
794


795


796
797
798

799






800
801
802
803
804
805
806
    assert(field);
    return (field[0] >= '1' && field[0] <= '5' && field[1] == '\0') ? field[0] - '0' : 0;
}

static Time
CurrentTimeInMilliSecs(void)
{


    struct {


	Tcl_Time now;
	Tcl_Time dummy; /* Spare, in case Tcl_Time has 32-bit fields */
    } t;

    Tcl_GetTime(&t.now);






    return ((Time) t.now.sec)*1000 + ((Time) t.now.usec)/1000;
}

static Info
GetInfo(
    const PatSeq *psPtr,
    unsigned index)






>
>
|
>
>
|
<

>

>
>
>
>
>
>







788
789
790
791
792
793
794
795
796
797
798
799
800

801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
    assert(field);
    return (field[0] >= '1' && field[0] <= '5' && field[1] == '\0') ? field[0] - '0' : 0;
}

static Time
CurrentTimeInMilliSecs(void)
{
    union {
	Tcl_Time now;
	struct {
	    Tcl_WideInt sec; /* reserve stack space enough for 64-bit fields */
	    Tcl_WideInt usec;
	} lnow;

    } t;
    t.lnow.usec = -1; /* Invalid usec value, so we can see if Tcl_GetTime overwrites it */
    Tcl_GetTime(&t.now);
#ifdef _WIN64
    if (t.lnow.usec != -1) {
	/* Win64 Tk loaded in Cygwin-64: Tcl_GetTime() returns 64-bit fields */
	return ((Time) t.lnow.sec)*1000 + ((Time) t.lnow.usec)/1000;
    }
#endif
    return ((Time) t.now.sec)*1000 + ((Time) t.now.usec)/1000;
}

static Info
GetInfo(
    const PatSeq *psPtr,
    unsigned index)
945
946
947
948
949
950
951

952
953
954
955
956
957
958
static PSEntry *
FreePatSeqEntry(
    TCL_UNUSED(PSList *),
    PSEntry *entry)
{
    PSEntry *next = PSList_Next(entry);

    PSModMaskArr_Free(&entry->lastModMaskArr);
    ckfree(entry);
    return next;
}

static unsigned
ResolveModifiers(






>







955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
static PSEntry *
FreePatSeqEntry(
    TCL_UNUSED(PSList *),
    PSEntry *entry)
{
    PSEntry *next = PSList_Next(entry);

    PSModMaskArr_Free(&entry->lastModMaskArr);
    ckfree(entry);
    return next;
}

static unsigned
ResolveModifiers(
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
unsigned long
Tk_CreateBinding(
    Tcl_Interp *interp,		/* Used for error reporting. */
    Tk_BindingTable bindPtr,	/* Table in which to create binding. */
    ClientData object,		/* Token for object with which binding is associated. */
    const char *eventString,	/* String describing event sequence that triggers binding. */
    const char *script,		/* Contains Tcl script to execute when binding triggers. */
    int append)		/* 0 means replace any existing binding for eventString;
    				 * 1 means append to that binding. If the existing binding is
				 * for a callback function and not a Tcl command string, the
				 * existing binding will always be replaced. */
{
    PatSeq *psPtr;
    unsigned eventMask;
    char *oldStr;






|







1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
unsigned long
Tk_CreateBinding(
    Tcl_Interp *interp,		/* Used for error reporting. */
    Tk_BindingTable bindPtr,	/* Table in which to create binding. */
    ClientData object,		/* Token for object with which binding is associated. */
    const char *eventString,	/* String describing event sequence that triggers binding. */
    const char *script,		/* Contains Tcl script to execute when binding triggers. */
    int append)			/* 0 means replace any existing binding for eventString;
    				 * 1 means append to that binding. If the existing binding is
				 * for a callback function and not a Tcl command string, the
				 * existing binding will always be replaced. */
{
    PatSeq *psPtr;
    unsigned eventMask;
    char *oldStr;
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
FindSequence(
    Tcl_Interp *interp,		/* Interpreter to use for error reporting. */
    LookupTables *lookupTables,	/* Tables used for lookup. */
    ClientData object,		/* For binding table, token for object with which binding is
    				 * associated. For virtual event table, NULL. */
    const char *eventString,	/* String description of pattern to match on. See user
    				 * documentation for details. */
    int create,		/* 0 means don't create the entry if it doesn't already exist.
    				 * 1 means create. */
    int allowVirtual,		/* 0 means that virtual events are not allowed in the sequence.
    				 * 1 otherwise. */
    unsigned *maskPtr)		/* *maskPtr is filled in with the event types on which this
    				 * pattern sequence depends. */
{
    unsigned patsBufSize = 1;






|







4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
FindSequence(
    Tcl_Interp *interp,		/* Interpreter to use for error reporting. */
    LookupTables *lookupTables,	/* Tables used for lookup. */
    ClientData object,		/* For binding table, token for object with which binding is
    				 * associated. For virtual event table, NULL. */
    const char *eventString,	/* String description of pattern to match on. See user
    				 * documentation for details. */
    int create,			/* 0 means don't create the entry if it doesn't already exist.
    				 * 1 means create. */
    int allowVirtual,		/* 0 means that virtual events are not allowed in the sequence.
    				 * 1 otherwise. */
    unsigned *maskPtr)		/* *maskPtr is filled in with the event types on which this
    				 * pattern sequence depends. */
{
    unsigned patsBufSize = 1;