From ac859f541ab22b0778aa06864848fdf336bb49cf Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 25 Sep 2001 16:25:20 +0000 Subject: * Corrected definition of TkpScanWindowId to handle situation where types Window and int do not have the same number of bits. CONST-ified too. --- ChangeLog | 13 +++++++++++++ generic/tkBind.c | 7 ++++++- generic/tkInt.decls | 8 ++++++-- generic/tkIntPlatDecls.h | 14 +++++++++++--- generic/tkStubInit.c | 3 ++- unix/tkUnixPort.h | 11 ++--------- unix/tkUnixXId.c | 36 +++++++++++++++++++++++++++++++++++- win/tkWinWindow.c | 4 ++-- 8 files changed, 77 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index ffbbeb1..ea75b82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2001-09-25 Don Porter + + * generic/tkBind.c: + * generic/tkInt.decls (TkpScanWindowId): + * unix/tkUnixPort.h (Tkp{Print,Scan}WindowId): + * unix/tkUnixXId.c (TkpScanWindowId): + * win/tkWinWindow.c (TkpScanWindowId): Corrected definition of + TkpScanWindowId to handle situation where types Window and int + do not have the same number of bits. CONST-ified too. + + * generic/tkIntPlatDecls.h: + * generic/tkStubInit.c: make genstubs + 2001-09-24 Don Porter * generic/tkMain.c (StdinProc): Update to handle change in diff --git a/generic/tkBind.c b/generic/tkBind.c index b382cf0..ddd7e39 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkBind.c,v 1.17 2001/09/21 21:19:02 hobbs Exp $ + * RCS: @(#) $Id: tkBind.c,v 1.18 2001/09/25 16:25:20 dgp Exp $ */ #include "tkPort.h" @@ -21,6 +21,11 @@ #include "tkWinInt.h" #endif +#if !defined(__WIN32__) && !defined(MAC_TCL) /* UNIX */ +#include "tkUnixInt.h" +#endif + + /* * File structure: * diff --git a/generic/tkInt.decls b/generic/tkInt.decls index eb6e821..71d5690 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tkInt.decls,v 1.20 2001/09/21 21:19:43 hobbs Exp $ +# RCS: @(#) $Id: tkInt.decls,v 1.21 2001/09/25 16:25:20 dgp Exp $ library tk @@ -679,6 +679,10 @@ declare 7 unix { void TkUnixSetMenubar (Tk_Window tkwin, Tk_Window menubar) } +declare 8 unix { + int TkpScanWindowId (Tcl_Interp *interp, CONST char *string, Window *idPtr) +} + ############################ # Windows specific functions @@ -703,7 +707,7 @@ declare 5 win { } declare 6 win { - int TkpScanWindowId (Tcl_Interp *interp, char *string, Window *idPtr) + int TkpScanWindowId (Tcl_Interp *interp, CONST char *string, Window *idPtr) } declare 7 win { diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 01c31e8..234dcd5 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -9,7 +9,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tkIntPlatDecls.h,v 1.8 2001/09/21 21:19:43 hobbs Exp $ + * RCS: @(#) $Id: tkIntPlatDecls.h,v 1.9 2001/09/25 16:25:20 dgp Exp $ */ #ifndef _TKINTPLATDECLS @@ -52,6 +52,9 @@ EXTERN int TkUnixDoOneXEvent _ANSI_ARGS_((Tcl_Time * timePtr)); /* 7 */ EXTERN void TkUnixSetMenubar _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); +/* 8 */ +EXTERN int TkpScanWindowId _ANSI_ARGS_((Tcl_Interp * interp, + CONST char * string, Window * idPtr)); #endif /* UNIX */ #ifdef __WIN32__ /* 0 */ @@ -70,7 +73,7 @@ EXTERN void TkpPrintWindowId _ANSI_ARGS_((char * buf, Window window)); /* 6 */ EXTERN int TkpScanWindowId _ANSI_ARGS_((Tcl_Interp * interp, - char * string, Window * idPtr)); + CONST char * string, Window * idPtr)); /* 7 */ EXTERN void TkpSetCapture _ANSI_ARGS_((TkWindow * winPtr)); /* 8 */ @@ -307,6 +310,7 @@ typedef struct TkIntPlatStubs { Window (*tkUnixContainerId) _ANSI_ARGS_((TkWindow * winPtr)); /* 5 */ int (*tkUnixDoOneXEvent) _ANSI_ARGS_((Tcl_Time * timePtr)); /* 6 */ void (*tkUnixSetMenubar) _ANSI_ARGS_((Tk_Window tkwin, Tk_Window menubar)); /* 7 */ + int (*tkpScanWindowId) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * string, Window * idPtr)); /* 8 */ #endif /* UNIX */ #ifdef __WIN32__ char * (*tkAlignImageData) _ANSI_ARGS_((XImage * image, int alignment, int bitOrder)); /* 0 */ @@ -315,7 +319,7 @@ typedef struct TkIntPlatStubs { unsigned long (*tkpGetMS) _ANSI_ARGS_((void)); /* 3 */ void (*tkPointerDeadWindow) _ANSI_ARGS_((TkWindow * winPtr)); /* 4 */ void (*tkpPrintWindowId) _ANSI_ARGS_((char * buf, Window window)); /* 5 */ - int (*tkpScanWindowId) _ANSI_ARGS_((Tcl_Interp * interp, char * string, Window * idPtr)); /* 6 */ + int (*tkpScanWindowId) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * string, Window * idPtr)); /* 6 */ void (*tkpSetCapture) _ANSI_ARGS_((TkWindow * winPtr)); /* 7 */ void (*tkpSetCursor) _ANSI_ARGS_((TkpCursor cursor)); /* 8 */ void (*tkpWmSetState) _ANSI_ARGS_((TkWindow * winPtr, int state)); /* 9 */ @@ -461,6 +465,10 @@ extern TkIntPlatStubs *tkIntPlatStubsPtr; #define TkUnixSetMenubar \ (tkIntPlatStubsPtr->tkUnixSetMenubar) /* 7 */ #endif +#ifndef TkpScanWindowId +#define TkpScanWindowId \ + (tkIntPlatStubsPtr->tkpScanWindowId) /* 8 */ +#endif #endif /* UNIX */ #ifdef __WIN32__ #ifndef TkAlignImageData diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 94263c5..bbf3506 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubInit.c,v 1.26 2000/11/22 01:49:38 ericm Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.27 2001/09/25 16:25:20 dgp Exp $ */ #include "tkInt.h" @@ -362,6 +362,7 @@ TkIntPlatStubs tkIntPlatStubs = { TkUnixContainerId, /* 5 */ TkUnixDoOneXEvent, /* 6 */ TkUnixSetMenubar, /* 7 */ + TkpScanWindowId, /* 8 */ #endif /* UNIX */ #ifdef __WIN32__ TkAlignImageData, /* 0 */ diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index e2895dc..6e51fe7 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixPort.h,v 1.6 2001/09/21 21:22:09 hobbs Exp $ + * RCS: @(#) $Id: tkUnixPort.h,v 1.7 2001/09/25 16:25:20 dgp Exp $ */ #ifndef _UNIXPORT @@ -204,14 +204,7 @@ extern int errno; */ #define TkpPrintWindowId(buf,w) \ - sprintf((buf), "0x%x", (unsigned int) (w)) - -/* - * TkpScanWindowId is just an alias for Tcl_GetInt on Unix. - */ - -#define TkpScanWindowId(i,s,wp) \ - Tcl_GetInt((i),(s),(int *)(wp)) + sprintf((buf), "%#08lx", (unsigned long) (w)) /* * This macro indicates that entry and text widgets should display diff --git a/unix/tkUnixXId.c b/unix/tkUnixXId.c index 6312d3a..c2be145 100644 --- a/unix/tkUnixXId.c +++ b/unix/tkUnixXId.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixXId.c,v 1.5 1999/04/21 21:53:32 rjohnson Exp $ + * RCS: @(#) $Id: tkUnixXId.c,v 1.6 2001/09/25 16:25:20 dgp Exp $ */ /* @@ -534,3 +534,37 @@ TkpWindowWasRecentlyDeleted(win, dispPtr) } return 0; } + +/* + *---------------------------------------------------------------------- + * + * TkpScanWindowId -- + * + * Given a string, produce the corresponding Window Id. + * + * Results: + * The return value is normally TCL_OK; in this case *idPtr + * will be set to the Window value equivalent to string. If + * string is improperly formed then TCL_ERROR is returned and + * an error message will be left in the interp's result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TkpScanWindowId(interp, string, idPtr) + Tcl_Interp *interp; + CONST char *string; + Window *idPtr; +{ + int value; + if (Tcl_GetInt(interp, string, &value) != TCL_OK) { + return TCL_ERROR; + } + *idPtr = (Window) value; + return TCL_OK; +} + diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index b1484c7..7139ccf 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWindow.c,v 1.7 2001/09/21 22:13:52 hobbs Exp $ + * RCS: @(#) $Id: tkWinWindow.c,v 1.8 2001/09/25 16:25:20 dgp Exp $ */ #include "tkWinInt.h" @@ -205,7 +205,7 @@ TkpPrintWindowId(buf, window) int TkpScanWindowId(interp, string, idPtr) Tcl_Interp *interp; /* Interpreter to use for error reporting. */ - char *string; /* String containing a (possibly signed) + CONST char *string; /* String containing a (possibly signed) * integer in a form acceptable to strtol. */ Window *idPtr; /* Place to store converted result. */ { -- cgit v0.12