summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornijtmans <nijtmans>2009-11-19 23:45:08 (GMT)
committernijtmans <nijtmans>2009-11-19 23:45:08 (GMT)
commit930fbd756216e095a887d89e631cc699a97406bf (patch)
treeae364155226308454d7c9368c5364a9f4ac440a5
parentb36e07917dbad9ecfad09b3941e0aabbdc9f3747 (diff)
downloadtk-930fbd756216e095a887d89e631cc699a97406bf.zip
tk-930fbd756216e095a887d89e631cc699a97406bf.tar.gz
tk-930fbd756216e095a887d89e631cc699a97406bf.tar.bz2
Compile tkTest.c and friends with Stubs
-rw-r--r--ChangeLog4
-rw-r--r--doc/.cvsignore1
-rw-r--r--generic/tkOldTest.c8
-rw-r--r--generic/tkSquare.c8
-rw-r--r--generic/tkTest.c24
-rw-r--r--unix/Makefile.in10
-rw-r--r--win/tkWinTest.c68
7 files changed, 109 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 5e15605..ca77c19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,8 +5,12 @@
2009-11-19 Jan Nijtmans <nijtmans@users.sf.net>
* doc/GetHINSTANCE.3 Fix mentioned header file
+ * generic/tkTest.c Compile with Stubs
+ * generic/tkOldTest.c
+ * generic/tkSquare.c
* win/tcl.m4 Should have been checked in together with
the 2009-08-09 check in of "win/configure"
+ * win/tkWinTest.c Don't access tkWinProcs from Tk dll any more
* unix/tcl.m4: [Patch #2883533] tcl.m4 support for Haiku OS
* unix/configure (regenerated)
* unix/Makefile.in Fix library order in X11_LIB_SWITCHES
diff --git a/doc/.cvsignore b/doc/.cvsignore
new file mode 100644
index 0000000..a1f8667
--- /dev/null
+++ b/doc/.cvsignore
@@ -0,0 +1 @@
+man.macros
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
index 3d17686..280b088 100644
--- a/generic/tkOldTest.c
+++ b/generic/tkOldTest.c
@@ -14,10 +14,16 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkOldTest.c,v 1.4 2008/11/03 22:20:22 nijtmans Exp $
+ * RCS: @(#) $Id: tkOldTest.c,v 1.5 2009/11/19 23:45:08 nijtmans Exp $
*/
#define USE_OLD_IMAGE
+#ifndef USE_TCL_STUBS
+# define USE_TCL_STUBS
+#endif
+#ifndef USE_TK_STUBS
+# define USE_TK_STUBS
+#endif
#include "tkInt.h"
/*
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 50292d1..5446413 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -12,12 +12,18 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkSquare.c,v 1.13 2008/10/17 23:18:37 nijtmans Exp $
+ * RCS: @(#) $Id: tkSquare.c,v 1.14 2009/11/19 23:45:08 nijtmans Exp $
*/
#if 0
#define __NO_OLD_CONFIG
#endif
+#ifndef USE_TCL_STUBS
+# define USE_TCL_STUBS
+#endif
+#ifndef USE_TK_STUBS
+# define USE_TK_STUBS
+#endif
#include "tkInt.h"
/*
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 22879ee..b90d689 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -13,9 +13,15 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTest.c,v 1.42 2009/09/07 07:29:04 das Exp $
+ * RCS: @(#) $Id: tkTest.c,v 1.43 2009/11/19 23:45:08 nijtmans Exp $
*/
+#ifndef USE_TCL_STUBS
+# define USE_TCL_STUBS
+#endif
+#ifndef USE_TK_STUBS
+# define USE_TK_STUBS
+#endif
#include "tkInt.h"
#include "tkText.h"
@@ -33,6 +39,15 @@
#endif
/*
+ * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the
+ * Tcltest_Init declaration is in the source file itself, which is only
+ * accessed when we are building a library.
+ */
+
+#undef TCL_STORAGE_CLASS
+#define TCL_STORAGE_CLASS DLLEXPORT
+EXTERN int Tktest_Init(Tcl_Interp *interp);
+/*
* The following data structure represents the master for a test image:
*/
@@ -241,6 +256,13 @@ Tktest_Init(
{
static int initialized = 0;
+ if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
+ return TCL_ERROR;
+ }
+ if (Tk_InitStubs(interp, "8.1", 0) == NULL) {
+ return TCL_ERROR;
+ }
+
/*
* Create additional commands for testing Tk.
*/
diff --git a/unix/Makefile.in b/unix/Makefile.in
index ff2bf5b..4148bed 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -5,7 +5,7 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
-# RCS: @(#) $Id: Makefile.in,v 1.161 2009/11/19 22:21:01 nijtmans Exp $
+# RCS: @(#) $Id: Makefile.in,v 1.162 2009/11/19 23:45:08 nijtmans Exp $
# Current Tk version; used in various names.
@@ -624,17 +624,17 @@ wish: $(WISH_OBJS) $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) @APP_RSRC_FILE@
tktest: $(TKTEST_OBJS) $(TK_LIB_FILE)
$(MAKE) tktest-real LIB_RUNTIME_DIR="`pwd`:$(TCL_BIN_DIR)"
-tktest-real:
- ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) @TK_BUILD_LIB_SPEC@ \
+tktest-real: ${TK_STUB_LIB_FILE}
+ ${CC} ${CFLAGS} ${LDFLAGS} $(TKTEST_OBJS) ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} @TK_BUILD_LIB_SPEC@ \
$(WISH_LIBS) $(CC_SEARCH_FLAGS) -o tktest
# FIXME: This xttest rule seems to be broken in a number of ways.
# It should use CC_SEARCH_FLAGS, it does not include the shared
# lib location logic from tktest, and it is not clear where this
# test.o object file comes from.
-xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE)
+xttest: test.o tkTest.o tkSquare.o $(TK_LIB_FILE) ${TK_STUB_LIB_FILE}
${CC} ${CFLAGS} ${LDFLAGS} test.o tkTest.o tkSquare.o \
- @TK_BUILD_LIB_SPEC@ \
+ @TK_BUILD_LIB_SPEC@ ${TK_STUB_LIB_FILE} ${TCL_STUB_LIB_SPEC} \
$(WISH_LIBS) $(LD_SEARCH_FLAGS) -lXt -o xttest
# Note, in the target below TCL_LIBRARY needs to be set or else
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index 78b06f3..5ab725e 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -11,9 +11,15 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinTest.c,v 1.26 2009/08/10 23:16:28 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinTest.c,v 1.27 2009/11/19 23:45:08 nijtmans Exp $
*/
+#ifndef USE_TCL_STUBS
+# define USE_TCL_STUBS
+#endif
+#ifndef USE_TK_STUBS
+# define USE_TK_STUBS
+#endif
#include "tkWinInt.h"
HWND tkWinCurrentDialog;
@@ -39,6 +45,50 @@ static int TestwinlocaleObjCmd(ClientData clientData,
MODULE_SCOPE int TkplatformtestInit(Tcl_Interp *interp);
static Tk_GetSelProc SetSelectionResult;
+
+static TkWinProcs asciiProcs = {
+ 0,
+
+ (LRESULT (WINAPI *)(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg,
+ WPARAM wParam, LPARAM lParam)) CallWindowProcA,
+ (LRESULT (WINAPI *)(HWND hWnd, UINT Msg, WPARAM wParam,
+ LPARAM lParam)) DefWindowProcA,
+ (ATOM (WINAPI *)(const WNDCLASS *lpWndClass)) RegisterClassA,
+ (BOOL (WINAPI *)(HWND hWnd, LPCTSTR lpString)) SetWindowTextA,
+ (HWND (WINAPI *)(DWORD dwExStyle, LPCTSTR lpClassName,
+ LPCTSTR lpWindowName, DWORD dwStyle, int x, int y,
+ int nWidth, int nHeight, HWND hWndParent, HMENU hMenu,
+ HINSTANCE hInstance, LPVOID lpParam)) CreateWindowExA,
+ (BOOL (WINAPI *)(HMENU hMenu, UINT uPosition, UINT uFlags,
+ UINT uIDNewItem, LPCTSTR lpNewItem)) InsertMenuA,
+ (int (WINAPI *)(HWND hWnd, LPCTSTR lpString, int nMaxCount)) GetWindowTextA,
+ (HWND (WINAPI *)(LPCTSTR lpClassName, LPCTSTR lpWindowName)) FindWindowA,
+ (int (WINAPI *)(HWND hwnd, LPTSTR lpClassName, int nMaxCount)) GetClassNameA,
+};
+
+static TkWinProcs unicodeProcs = {
+ 1,
+
+ (LRESULT (WINAPI *)(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg,
+ WPARAM wParam, LPARAM lParam)) CallWindowProcW,
+ (LRESULT (WINAPI *)(HWND hWnd, UINT Msg, WPARAM wParam,
+ LPARAM lParam)) DefWindowProcW,
+ (ATOM (WINAPI *)(const WNDCLASS *lpWndClass)) RegisterClassW,
+ (BOOL (WINAPI *)(HWND hWnd, LPCTSTR lpString)) SetWindowTextW,
+ (HWND (WINAPI *)(DWORD dwExStyle, LPCTSTR lpClassName,
+ LPCTSTR lpWindowName, DWORD dwStyle, int x, int y,
+ int nWidth, int nHeight, HWND hWndParent, HMENU hMenu,
+ HINSTANCE hInstance, LPVOID lpParam)) CreateWindowExW,
+ (BOOL (WINAPI *)(HMENU hMenu, UINT uPosition, UINT uFlags,
+ UINT uIDNewItem, LPCTSTR lpNewItem)) InsertMenuW,
+ (int (WINAPI *)(HWND hWnd, LPCTSTR lpString, int nMaxCount)) GetWindowTextW,
+ (HWND (WINAPI *)(LPCTSTR lpClassName, LPCTSTR lpWindowName)) FindWindowW,
+ (int (WINAPI *)(HWND hwnd, LPTSTR lpClassName, int nMaxCount)) GetClassNameW,
+};
+
+static TkWinProcs *tkTestWinProcs = &asciiProcs;
+
+
/*
*----------------------------------------------------------------------
*
@@ -60,6 +110,12 @@ int
TkplatformtestInit(
Tcl_Interp *interp) /* Interpreter to add commands to. */
{
+ int useWide = (TkWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS);
+ if (useWide) {
+ tkTestWinProcs = &unicodeProcs;
+ } else {
+ tkTestWinProcs = &asciiProcs;
+ }
/*
* Add commands for platform specific tests on MacOS here.
*/
@@ -401,7 +457,7 @@ TestfindwindowObjCmd(
class = Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
}
- hwnd = tkWinProcs->findWindow(class, title);
+ hwnd = tkTestWinProcs->findWindow(class, title);
if (hwnd == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1));
@@ -439,7 +495,7 @@ TestgetwindowinfoObjCmd(
Tcl_Obj *dictObj = NULL, *classObj = NULL, *textObj = NULL;
Tcl_Obj *childrenObj = NULL;
char buf[512];
- int cch, cchBuf = tkWinProcs->useWide ? 256 : 512;
+ int cch, cchBuf = tkTestWinProcs->useWide ? 256 : 512;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "hwnd");
@@ -449,7 +505,7 @@ TestgetwindowinfoObjCmd(
if (Tcl_GetLongFromObj(interp, objv[1], &hwnd) != TCL_OK)
return TCL_ERROR;
- cch = tkWinProcs->getClassName((HWND)hwnd, buf, cchBuf);
+ cch = tkTestWinProcs->getClassName((HWND)hwnd, buf, cchBuf);
if (cch == 0) {
Tcl_SetResult(interp, "failed to get class name: ", TCL_STATIC);
AppendSystemError(interp, GetLastError());
@@ -466,8 +522,8 @@ TestgetwindowinfoObjCmd(
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2),
Tcl_NewLongObj(GetWindowLong((HWND)hwnd, GWL_ID)));
- cch = tkWinProcs->getWindowText((HWND)hwnd, (LPTSTR)buf, cchBuf);
- if (tkWinProcs->useWide) {
+ cch = tkTestWinProcs->getWindowText((HWND)hwnd, (LPTSTR)buf, cchBuf);
+ if (tkTestWinProcs->useWide) {
textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);
} else {
textObj = Tcl_NewStringObj((LPCSTR)buf, cch);