diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-08-07 14:58:34 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-08-07 14:58:34 (GMT) |
commit | 04049103c8d246d5dbc6c6d62e12b2f462208abb (patch) | |
tree | a7b9203360fb140f7f68ed0ceaa52cf97e7b4366 /win | |
parent | de3dd1a56602c61a4d1d2f8583ebaddd68207f43 (diff) | |
download | tcl-04049103c8d246d5dbc6c6d62e12b2f462208abb.zip tcl-04049103c8d246d5dbc6c6d62e12b2f462208abb.tar.gz tcl-04049103c8d246d5dbc6c6d62e12b2f462208abb.tar.bz2 |
add 3 testcases for "dde poke", only active with --enable-symbols
(we need a "dde poke" server for that, which is now built into tcldde14g.dll, but not in tcldde14.dll)
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinDde.c | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 7b9fbf4..23b3a8e 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -17,7 +17,13 @@ #include <dde.h> #include <ddeml.h> -#ifndef UNICODE +#ifdef UNICODE +# if !defined(NDEBUG) + /* test POKE server Implemented for UNICODE in debug mode only */ +# undef CBF_FAIL_POKES +# define CBF_FAIL_POKES 0 +# endif +#else # undef CP_WINUNICODE # define CP_WINUNICODE CP_WINANSI # undef Tcl_WinTCharToUtf @@ -786,6 +792,53 @@ DdeServerProc( } return ddeReturn; +#if !CBF_FAIL_POKES + case XTYP_POKE: + /* + * This is a poke for a Tcl variable, only implemented in + * debug/UNICODE mode. + */ + ddeReturn = DDE_FNOTPROCESSED; + + if ((uFmt != CF_TEXT) && (uFmt != CF_UNICODETEXT)) { + return ddeReturn; + } + + for (convPtr = tsdPtr->currentConversations; (convPtr != NULL) + && (convPtr->hConv != hConv); convPtr = convPtr->nextPtr) { + /* + * Empty loop body. + */ + } + + if (convPtr && !Tcl_IsSafe(convPtr->riPtr->interp)) { + Tcl_DString ds; + Tcl_Obj *variableObjPtr; + + len = DdeQueryString(ddeInstance, ddeItem, NULL, 0, CP_WINUNICODE); + Tcl_DStringInit(&dString); + Tcl_DStringSetLength(&dString, (len + 1) * sizeof(TCHAR) - 1); + utilString = (TCHAR *) Tcl_DStringValue(&dString); + DdeQueryString(ddeInstance, ddeItem, utilString, (DWORD) len + 1, + CP_WINUNICODE); + Tcl_WinTCharToUtf(utilString, -1, &ds); + utilString = (TCHAR *) DdeAccessData(hData, &dlen); + if (uFmt == CF_TEXT) { + variableObjPtr = Tcl_NewStringObj((char *)utilString, -1); + } else { + variableObjPtr = Tcl_NewUnicodeObj(utilString, -1); + } + + Tcl_SetVar2Ex(convPtr->riPtr->interp, Tcl_DStringValue(&ds), NULL, + variableObjPtr, TCL_GLOBAL_ONLY); + + Tcl_DStringFree(&ds); + Tcl_DStringFree(&dString); + ddeReturn = (HDDEDATA) DDE_FACK; + } + return ddeReturn; + +#endif case XTYP_EXECUTE: { /* * Execute this script. The results will be saved into a list object |