Tcl Source Code

Check-in [18027385fd]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:[Bug 473946]: special characters not correctly sent
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-473946
Files: files | file ages | folders
SHA1: 18027385fde19eaab3d980be054f79f26c31aadb
User & Date: jan.nijtmans 2012-05-09 08:47:19
Context
2012-05-09
19:18
Increase version to 1.2.5 Now should work on Win95 as well Use Tcl_GetUnicodeFromObj in stead of Tcl... Closed-Leaf check-in: 7bb9d6699f user: jan.nijtmans tags: bug-473946
08:47
[Bug 473946]: special characters not correctly sent check-in: 18027385fd user: jan.nijtmans tags: bug-473946
2012-05-07
07:50
proposal from jmphilippe check-in: 6036f72024 user: jan.nijtmans tags: bug-473946
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.





1
2
3
4
5
6
7



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

	* generic/configure.in:    Better detection and implementation for cpuid
	* generic/configure:       instruction on Intel-derived processors, both
	* generic/tclUnixCompat.c: 32-bit and 64-bit.
	* generic/tclTest.c:       Move cpuid testcase from win-specific to generic
	* win/tclWinTest.c:        tests, as it should work on all Intel-related
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
2012-05-09  Jan Nijtmans  <[email protected]>

	* win/tclWinDde.c:    [Bug 473946]: special characters not correctly sent

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

	* generic/configure.in:    Better detection and implementation for cpuid
	* generic/configure:       instruction on Intel-derived processors, both
	* generic/tclUnixCompat.c: 32-bit and 64-bit.
	* generic/tclTest.c:       Move cpuid testcase from win-specific to generic
	* win/tclWinTest.c:        tests, as it should work on all Intel-related

Changes to win/tclWinDde.c.

96
97
98
99
100
101
102





















103
104
105
106
107
108
109
...
120
121
122
123
124
125
126










127
128
129
130
131
132
133
...
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
...
558
559
560
561
562
563
564

565
566
567



568
569
570
571
572
573
574
575
576
577

578
579
580



581
582
583
584
585
586
587
588
589
590
				char *topicName));
int Tcl_DdeObjCmd(ClientData clientData,	/* Used only for deletion */
	Tcl_Interp *interp,		/* The interp we are sending from */
	int objc,			/* Number of arguments */
	Tcl_Obj *CONST objv[]);	/* The arguments */

EXTERN int Dde_Init(Tcl_Interp *interp);





















 
/*
 *----------------------------------------------------------------------
 *
 * Dde_Init --
 *
 *	This procedure initializes the dde command.
................................................................................
int
Dde_Init(
    Tcl_Interp *interp)
{
    if (!Tcl_InitStubs(interp, "8.0", 0)) {
	return TCL_ERROR;
    }











    Tcl_CreateObjCommand(interp, "dde", Tcl_DdeObjCmd, NULL, NULL);

    Tcl_CreateExitHandler(DdeExitProc, NULL);

    return Tcl_PkgProvide(interp, TCL_DDE_PACKAGE_NAME, TCL_DDE_VERSION);
}
................................................................................

	    /*
	     * This could be either a request for a value of a Tcl variable,
	     * or it could be the send command requesting the results of the
	     * last execute.
	     */

	    if (uFmt != CF_TEXT) {
		return (HDDEDATA) FALSE;
	    }

	    ddeReturn = (HDDEDATA) FALSE;
	    for (convPtr = tsdPtr->currentConversations; (convPtr != NULL)
		    && (convPtr->hConv != hConv); convPtr = convPtr->nextPtr) {
		/*
................................................................................
		Tcl_DStringSetLength(&dString, len);
		utilString = Tcl_DStringValue(&dString);
		DdeQueryString(ddeInstance, ddeItem, utilString, 
                        (DWORD) len + 1, CP_WINANSI);
		if (stricmp(utilString, "$TCLEVAL$EXECUTE$RESULT") == 0) {
		    returnString =
		        Tcl_GetStringFromObj(convPtr->returnPackagePtr, &len);

		    Tcl_DStringInit (&dString);
		    returnString =
			   Tcl_UtfToExternalDString (NULL, returnString, -1, &dString);



		    ddeReturn = DdeCreateDataHandle(ddeInstance,
		    		(BYTE *)returnString, (DWORD) len+1, 0, ddeItem, CF_TEXT,
			    0);
		} else {
		    Tcl_Obj *variableObjPtr = Tcl_GetVar2Ex(
			    convPtr->riPtr->interp, utilString, NULL, 
			    TCL_GLOBAL_ONLY);
		    if (variableObjPtr != NULL) {
			returnString = Tcl_GetStringFromObj(variableObjPtr,
				&len);

		    Tcl_DStringInit (&dString);
		    returnString =
			    Tcl_UtfToExternalDString (NULL, returnString, -1, &dString);



			ddeReturn = DdeCreateDataHandle(ddeInstance,
					(BYTE *)returnString, (DWORD) len+1, 0, ddeItem,
				CF_TEXT, 0);
		    } else {
			ddeReturn = NULL;
		    }
		}
		Tcl_DStringFree(&dString);
	    }
	    return ddeReturn;






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







 







>
>
>
>
>
>
>
>
>
>







 







|







 







>
|
|
<
>
>
>

|








>
|
|
<
>
>
>

|
|







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
...
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
...
589
590
591
592
593
594
595
596
597
598

599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614

615
616
617
618
619
620
621
622
623
624
625
626
627
				char *topicName));
int Tcl_DdeObjCmd(ClientData clientData,	/* Used only for deletion */
	Tcl_Interp *interp,		/* The interp we are sending from */
	int objc,			/* Number of arguments */
	Tcl_Obj *CONST objv[]);	/* The arguments */

EXTERN int Dde_Init(Tcl_Interp *interp);

/*
 * The following structures allow us to select between the Unicode and ASCII
 * interfaces at run time based on whether Unicode APIs are available.  The
 * Unicode APIs are preferable because they will handle characters outside
 * of the current code page.
 */

typedef struct DdeWinProcs {
    int uFmt;
} DdeWinProcs;

static DdeWinProcs *ddeWinProcs;

static DdeWinProcs asciiProcs = {
    CF_TEXT
};

static DdeWinProcs unicodeProcs = {
    CF_UNICODETEXT
};
 
/*
 *----------------------------------------------------------------------
 *
 * Dde_Init --
 *
 *	This procedure initializes the dde command.
................................................................................
int
Dde_Init(
    Tcl_Interp *interp)
{
    if (!Tcl_InitStubs(interp, "8.0", 0)) {
	return TCL_ERROR;
    }
    /*
     * Determine if the unicode interfaces are available and select the
     * appropriate dde function table.
     */

    if (TclWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
	ddeWinProcs = &unicodeProcs;
    } else {
	ddeWinProcs = &asciiProcs;
    }

    Tcl_CreateObjCommand(interp, "dde", Tcl_DdeObjCmd, NULL, NULL);

    Tcl_CreateExitHandler(DdeExitProc, NULL);

    return Tcl_PkgProvide(interp, TCL_DDE_PACKAGE_NAME, TCL_DDE_VERSION);
}
................................................................................

	    /*
	     * This could be either a request for a value of a Tcl variable,
	     * or it could be the send command requesting the results of the
	     * last execute.
	     */

	    if ((uFmt != CF_TEXT) && (uFmt != ddeWinProcs->uFmt)) {
		return (HDDEDATA) FALSE;
	    }

	    ddeReturn = (HDDEDATA) FALSE;
	    for (convPtr = tsdPtr->currentConversations; (convPtr != NULL)
		    && (convPtr->hConv != hConv); convPtr = convPtr->nextPtr) {
		/*
................................................................................
		Tcl_DStringSetLength(&dString, len);
		utilString = Tcl_DStringValue(&dString);
		DdeQueryString(ddeInstance, ddeItem, utilString, 
                        (DWORD) len + 1, CP_WINANSI);
		if (stricmp(utilString, "$TCLEVAL$EXECUTE$RESULT") == 0) {
		    returnString =
		        Tcl_GetStringFromObj(convPtr->returnPackagePtr, &len);
		    if (uFmt == CF_UNICODETEXT) {
			Tcl_DStringFree(&dString);
			returnString =

				Tcl_WinUtfToTChar(returnString, len, &dString);
			len = Tcl_DStringLength(&dString) + 1;
		    }
		    ddeReturn = DdeCreateDataHandle(ddeInstance,
		    		(BYTE *)returnString, (DWORD) len+1, 0, ddeItem, uFmt,
			    0);
		} else {
		    Tcl_Obj *variableObjPtr = Tcl_GetVar2Ex(
			    convPtr->riPtr->interp, utilString, NULL, 
			    TCL_GLOBAL_ONLY);
		    if (variableObjPtr != NULL) {
			returnString = Tcl_GetStringFromObj(variableObjPtr,
				&len);
			if (uFmt == CF_UNICODETEXT) {
			    Tcl_DStringFree(&dString);
			    returnString =

				    Tcl_WinUtfToTChar(returnString, len, &dString);
				    len = Tcl_DStringLength(&dString) + 1;
			}
			ddeReturn = DdeCreateDataHandle(ddeInstance,
				(BYTE *)returnString, (DWORD) len+1, 0, ddeItem,
				uFmt, 0);
		    } else {
			ddeReturn = NULL;
		    }
		}
		Tcl_DStringFree(&dString);
	    }
	    return ddeReturn;