summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornijtmans <nijtmans>2010-08-30 13:49:27 (GMT)
committernijtmans <nijtmans>2010-08-30 13:49:27 (GMT)
commita37106179e4c1484469107de089057cd2748090c (patch)
treeed25a8b0bdfa5acdf1aa2509cc57b783aaf9d1a2
parentaf6af80ab88abd5db88a9b378434fa041f19a74a (diff)
downloadtcl-a37106179e4c1484469107de089057cd2748090c.zip
tcl-a37106179e4c1484469107de089057cd2748090c.tar.gz
tcl-a37106179e4c1484469107de089057cd2748090c.tar.bz2
[Patch 2997642] many type casts needed when using Tcl_Pkg* API. Partly.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tcl.decls8
-rw-r--r--generic/tclDecls.h15
-rw-r--r--generic/tclPkg.c15
-rw-r--r--generic/tclStubLib.c8
-rw-r--r--generic/tclTomMathStubLib.c9
6 files changed, 32 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index efb5703..2bd1908 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,11 @@
* win/tclWinDde.c: Those 3 files are not converted yet to be
* win/tclWinReg.c: built with -DUNICODE, so add a TODO.
* win/tclWinTest.c:
+ * generic/tcl.decls: [Patch 2997642] many type casts needed when
+ * generic/tclDecls.h: using Tcl_Pkg* API. Partly.
+ * generic/tclPkg.c:
+ * generic/tclStubLib.c: demonstration how this change can benefit code.
+ * generic/tclTomMathStubLib.c:
2010-08-29 Donal K. Fellows <dkf@users.sf.net>
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 3fadbce..826c6a6 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -12,7 +12,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: tcl.decls,v 1.178 2010/08/25 01:00:10 nijtmans Exp $
+# RCS: @(#) $Id: tcl.decls,v 1.179 2010/08/30 13:49:27 nijtmans Exp $
library tcl
@@ -35,7 +35,7 @@ declare 0 generic {
declare 1 generic {
CONST84_RETURN char *Tcl_PkgRequireEx(Tcl_Interp *interp,
const char *name, const char *version, int exact,
- ClientData *clientDataPtr)
+ void *clientDataPtr)
}
declare 2 generic {
void Tcl_Panic(const char *format, ...)
@@ -966,7 +966,7 @@ declare 271 generic {
declare 272 generic {
CONST84_RETURN char *Tcl_PkgPresentEx(Tcl_Interp *interp,
const char *name, const char *version, int exact,
- ClientData *clientDataPtr)
+ void *clientDataPtr)
}
declare 273 generic {
int Tcl_PkgProvide(Tcl_Interp *interp, const char *name,
@@ -2085,7 +2085,7 @@ declare 572 generic {
# TIP#268 (extended version numbers and requirements) akupries
declare 573 generic {
int Tcl_PkgRequireProc(Tcl_Interp *interp, const char *name,
- int objc, Tcl_Obj *const objv[], ClientData *clientDataPtr)
+ int objc, Tcl_Obj *const objv[], void *clientDataPtr)
}
# TIP#270 (utility C routines for string formatting) dgp
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index c16ba1b..b993e38 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -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: tclDecls.h,v 1.183 2010/08/25 01:00:10 nijtmans Exp $
+ * RCS: @(#) $Id: tclDecls.h,v 1.184 2010/08/30 13:49:28 nijtmans Exp $
*/
#ifndef _TCLDECLS
@@ -44,7 +44,7 @@ EXTERN int Tcl_PkgProvideEx(Tcl_Interp *interp,
/* 1 */
EXTERN CONST84_RETURN char * Tcl_PkgRequireEx(Tcl_Interp *interp,
const char *name, const char *version,
- int exact, ClientData *clientDataPtr);
+ int exact, void *clientDataPtr);
/* 2 */
EXTERN void Tcl_Panic(const char *format, ...);
/* 3 */
@@ -817,7 +817,7 @@ EXTERN CONST84_RETURN char * Tcl_PkgPresent(Tcl_Interp *interp,
/* 272 */
EXTERN CONST84_RETURN char * Tcl_PkgPresentEx(Tcl_Interp *interp,
const char *name, const char *version,
- int exact, ClientData *clientDataPtr);
+ int exact, void *clientDataPtr);
/* 273 */
EXTERN int Tcl_PkgProvide(Tcl_Interp *interp, const char *name,
const char *version);
@@ -1648,8 +1648,7 @@ EXTERN const char * Tcl_GetEncodingNameFromEnvironment(
/* 573 */
EXTERN int Tcl_PkgRequireProc(Tcl_Interp *interp,
const char *name, int objc,
- Tcl_Obj *const objv[],
- ClientData *clientDataPtr);
+ Tcl_Obj *const objv[], void *clientDataPtr);
/* 574 */
EXTERN void Tcl_AppendObjToErrorInfo(Tcl_Interp *interp,
Tcl_Obj *objPtr);
@@ -1822,7 +1821,7 @@ typedef struct TclStubs {
const struct TclStubHooks *hooks;
int (*tcl_PkgProvideEx) (Tcl_Interp *interp, const char *name, const char *version, ClientData clientData); /* 0 */
- CONST84_RETURN char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, ClientData *clientDataPtr); /* 1 */
+ CONST84_RETURN char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */
void (*tcl_Panic) (const char *format, ...); /* 2 */
char * (*tcl_Alloc) (unsigned int size); /* 3 */
void (*tcl_Free) (char *ptr); /* 4 */
@@ -2117,7 +2116,7 @@ typedef struct TclStubs {
char * (*tcl_HashStats) (Tcl_HashTable *tablePtr); /* 269 */
CONST84_RETURN char * (*tcl_ParseVar) (Tcl_Interp *interp, const char *start, CONST84 char **termPtr); /* 270 */
CONST84_RETURN char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */
- CONST84_RETURN char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, ClientData *clientDataPtr); /* 272 */
+ CONST84_RETURN char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 272 */
int (*tcl_PkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */
CONST84_RETURN char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */
void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */
@@ -2418,7 +2417,7 @@ typedef struct TclStubs {
Tcl_Obj * (*tcl_GetEncodingSearchPath) (void); /* 570 */
int (*tcl_SetEncodingSearchPath) (Tcl_Obj *searchPath); /* 571 */
const char * (*tcl_GetEncodingNameFromEnvironment) (Tcl_DString *bufPtr); /* 572 */
- int (*tcl_PkgRequireProc) (Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], ClientData *clientDataPtr); /* 573 */
+ int (*tcl_PkgRequireProc) (Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], void *clientDataPtr); /* 573 */
void (*tcl_AppendObjToErrorInfo) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 574 */
void (*tcl_AppendLimitedToObj) (Tcl_Obj *objPtr, const char *bytes, int length, int limit, const char *ellipsis); /* 575 */
Tcl_Obj * (*tcl_Format) (Tcl_Interp *interp, const char *format, int objc, Tcl_Obj *const objv[]); /* 576 */
diff --git a/generic/tclPkg.c b/generic/tclPkg.c
index 31972af..cba612f 100644
--- a/generic/tclPkg.c
+++ b/generic/tclPkg.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPkg.c,v 1.42 2010/05/05 22:43:46 nijtmans Exp $
+ * RCS: @(#) $Id: tclPkg.c,v 1.43 2010/08/30 13:49:27 nijtmans Exp $
*
* TIP #268.
* Heavily rewritten to handle the extend version numbers, and extended
@@ -73,7 +73,7 @@ static void AddRequirementsToDString(Tcl_DString *dstring,
static Package * FindPackage(Tcl_Interp *interp, const char *name);
static const char * PkgRequireCore(Tcl_Interp *interp, const char *name,
int reqc, Tcl_Obj *const reqv[],
- ClientData *clientDataPtr);
+ void *clientDataPtr);
/*
* Helper macros.
@@ -212,7 +212,7 @@ Tcl_PkgRequireEx(
int exact, /* Non-zero means that only the particular
* version given is acceptable. Zero means use
* the latest compatible version. */
- ClientData *clientDataPtr) /* Used to return the client data for this
+ void *clientDataPtr) /* Used to return the client data for this
* package. If it is NULL then the client data
* is not returned. This is unchanged if this
* call fails for any reason. */
@@ -323,7 +323,7 @@ Tcl_PkgRequireProc(
* version. */
Tcl_Obj *const reqv[], /* 0 means to use the latest version
* available. */
- ClientData *clientDataPtr)
+ void *clientDataPtr)
{
const char *result =
PkgRequireCore(interp, name, reqc, reqv, clientDataPtr);
@@ -344,7 +344,7 @@ PkgRequireCore(
* version. */
Tcl_Obj *const reqv[], /* 0 means to use the latest version
* available. */
- ClientData *clientDataPtr)
+ void *clientDataPtr)
{
Interp *iPtr = (Interp *) interp;
Package *pkgPtr;
@@ -621,7 +621,8 @@ PkgRequireCore(
if (satisfies) {
if (clientDataPtr) {
- *clientDataPtr = pkgPtr->clientData;
+ ClientData *ptr = clientDataPtr;
+ *ptr = pkgPtr->clientData;
}
return pkgPtr->version;
}
@@ -677,7 +678,7 @@ Tcl_PkgPresentEx(
int exact, /* Non-zero means that only the particular
* version given is acceptable. Zero means use
* the latest compatible version. */
- ClientData *clientDataPtr) /* Used to return the client data for this
+ void *clientDataPtr) /* Used to return the client data for this
* package. If it is NULL then the client data
* is not returned. This is unchanged if this
* call fails for any reason. */
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c
index 8603e02..db10cc8 100644
--- a/generic/tclStubLib.c
+++ b/generic/tclStubLib.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStubLib.c,v 1.32 2010/03/06 06:29:24 nijtmans Exp $
+ * RCS: @(#) $Id: tclStubLib.c,v 1.33 2010/08/30 13:49:28 nijtmans Exp $
*/
/*
@@ -84,7 +84,7 @@ Tcl_InitStubs(
int exact)
{
const char *actualVersion = NULL;
- ClientData pkgData = NULL;
+ const TclStubs *stubsPtr;
/*
* We can't optimize this check by caching tclStubsPtr because that
@@ -97,7 +97,7 @@ Tcl_InitStubs(
return NULL;
}
- actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, 0, &pkgData);
+ actualVersion = Tcl_PkgRequireEx(interp, "Tcl", version, 0, &stubsPtr);
if (actualVersion == NULL) {
return NULL;
}
@@ -127,7 +127,7 @@ Tcl_InitStubs(
}
}
}
- tclStubsPtr = (TclStubs *) pkgData;
+ tclStubsPtr = stubsPtr;
if (tclStubsPtr->hooks) {
tclPlatStubsPtr = tclStubsPtr->hooks->tclPlatStubs;
diff --git a/generic/tclTomMathStubLib.c b/generic/tclTomMathStubLib.c
index 4139261..9c9cbc5 100644
--- a/generic/tclTomMathStubLib.c
+++ b/generic/tclTomMathStubLib.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTomMathStubLib.c,v 1.1 2010/03/04 22:29:05 nijtmans Exp $
+ * RCS: @(#) $Id: tclTomMathStubLib.c,v 1.2 2010/08/30 13:49:28 nijtmans Exp $
*/
/*
@@ -57,15 +57,14 @@ TclTomMathInitializeStubs(
int exact = 0;
const char *packageName = "tcl::tommath";
const char *errMsg = NULL;
- ClientData pkgClientData = NULL;
+ const TclTomMathStubs *stubsPtr;
const char *actualVersion =
- Tcl_PkgRequireEx(interp, packageName, version, exact, &pkgClientData);
- const TclTomMathStubs *stubsPtr = pkgClientData;
+ Tcl_PkgRequireEx(interp, packageName, version, exact, &stubsPtr);
if (actualVersion == NULL) {
return NULL;
}
- if (pkgClientData == NULL) {
+ if (stubsPtr == NULL) {
errMsg = "missing stub table pointer";
} else if ((stubsPtr->tclBN_epoch)() != epoch) {
errMsg = "epoch number mismatch";