summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2002-02-28 05:11:24 (GMT)
committerdgp <dgp@users.sourceforge.net>2002-02-28 05:11:24 (GMT)
commite74c02673aec97beeb6f8ae55376bd5b88d9e3cc (patch)
tree2b9c586de5573bc73d089f27034488ef9f4f1972
parentdfa5329058b763cbe42687ceba9095b5b13c5c2a (diff)
downloadtcl-e74c02673aec97beeb6f8ae55376bd5b88d9e3cc.zip
tcl-e74c02673aec97beeb6f8ae55376bd5b88d9e3cc.tar.gz
tcl-e74c02673aec97beeb6f8ae55376bd5b88d9e3cc.tar.bz2
* doc/GetIndex.3:
* generic/tcl.decls (Tcl_GetIndexFromObjStruct): * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): Revised the prototype of the Tcl_GetIndexFromObjStruct to take its struct table as a (CONST VOID *) argument, better describing what it is, maintaining source compatibility, and adding CONST correctness according to TIP 27. Thanks to Joe English for an elegant solution. [Bug 520304] * generic/tclDecls.h: make genstubs
-rw-r--r--ChangeLog11
-rw-r--r--doc/GetIndex.312
-rw-r--r--generic/tcl.decls4
-rw-r--r--generic/tclDecls.h6
-rw-r--r--generic/tclIndexObj.c6
5 files changed, 27 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 23517ac..c379368 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2002-02-27 Don Porter <dgp@users.sourceforge.net>
+ * doc/GetIndex.3:
+ * generic/tcl.decls (Tcl_GetIndexFromObjStruct):
+ * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): Revised the
+ prototype of the Tcl_GetIndexFromObjStruct to take its struct
+ table as a (CONST VOID *) argument, better describing what it is,
+ maintaining source compatibility, and adding CONST correctness
+ according to TIP 27. Thanks to Joe English for an elegant
+ solution. [Bug 520304]
+
+ * generic/tclDecls.h: make genstubs
+
* generic/tclMain.c (Tcl_Main,StdinProc): Corrected some reference
count management errors on the interactive command Tcl_Obj found by
Purify. Thanks to Jeff Hobbs for the report and assistance.
diff --git a/doc/GetIndex.3 b/doc/GetIndex.3
index 79d3a1e..8ac4975 100644
--- a/doc/GetIndex.3
+++ b/doc/GetIndex.3
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: GetIndex.3,v 1.9 2002/02/15 14:28:47 dkf Exp $
+'\" RCS: @(#) $Id: GetIndex.3,v 1.10 2002/02/28 05:11:25 dgp Exp $
'\"
.so man.macros
.TH Tcl_GetIndexFromObj 3 8.1 Tcl "Tcl Library Procedures"
@@ -21,7 +21,7 @@ indexPtr\fR)
.VS
.sp
int
-\fBTcl_GetIndexFromObjStruct\fR(\fIinterp, objPtr, tablePtr, offset,
+\fBTcl_GetIndexFromObjStruct\fR(\fIinterp, objPtr, structTablePtr, offset,
msg, flags, indexPtr\fR)
.VE
.SH ARGUMENTS
@@ -36,10 +36,14 @@ table entry.
.AP "CONST char" **tablePtr in
An array of null-terminated ASCII strings. The end of the array is marked
by a NULL string pointer.
+.AP "CONST VOID" *structTablePtr in
+An array of arbitrary type, typically some \fBstruct\fP type.
+The first member of the structure must be a null-terminated ASCII string.
+The size of the structure is given by \fIoffset\fP.
.VS
.AP int offset in
-The offset to add to tablePtr to get to the next string in the
-list. The end of the array is marked by a NULL string pointer.
+The offset to add to structTablePtr to get to the next entry.
+The end of the array is marked by a NULL string pointer.
.VE
.AP "CONST char" *msg in
Null-terminated string describing what is being looked up, such as
diff --git a/generic/tcl.decls b/generic/tcl.decls
index cc380ae..120f888 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -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: tcl.decls,v 1.84 2002/02/20 18:46:29 dgp Exp $
+# RCS: @(#) $Id: tcl.decls,v 1.85 2002/02/28 05:11:25 dgp Exp $
library tcl
@@ -1086,7 +1086,7 @@ declare 303 generic {
}
declare 304 generic {
int Tcl_GetIndexFromObjStruct(Tcl_Interp *interp, Tcl_Obj *objPtr,
- CONST84 char **tablePtr, int offset, CONST char *msg, int flags,
+ CONST VOID *tablePtr, int offset, CONST char *msg, int flags,
int *indexPtr)
}
declare 305 generic {
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 65cc00b..e3f46ba 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.84 2002/02/20 18:46:29 dgp Exp $
+ * RCS: @(#) $Id: tclDecls.h,v 1.85 2002/02/28 05:11:25 dgp Exp $
*/
#ifndef _TCLDECLS
@@ -987,7 +987,7 @@ EXTERN void Tcl_GetEncodingNames _ANSI_ARGS_((
/* 304 */
EXTERN int Tcl_GetIndexFromObjStruct _ANSI_ARGS_((
Tcl_Interp * interp, Tcl_Obj * objPtr,
- CONST84 char ** tablePtr, int offset,
+ CONST VOID * tablePtr, int offset,
CONST char * msg, int flags, int * indexPtr));
/* 305 */
EXTERN VOID * Tcl_GetThreadData _ANSI_ARGS_((
@@ -1916,7 +1916,7 @@ typedef struct TclStubs {
Tcl_Encoding (*tcl_GetEncoding) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 301 */
CONST char * (*tcl_GetEncodingName) _ANSI_ARGS_((Tcl_Encoding encoding)); /* 302 */
void (*tcl_GetEncodingNames) _ANSI_ARGS_((Tcl_Interp * interp)); /* 303 */
- int (*tcl_GetIndexFromObjStruct) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CONST84 char ** tablePtr, int offset, CONST char * msg, int flags, int * indexPtr)); /* 304 */
+ int (*tcl_GetIndexFromObjStruct) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, CONST VOID * tablePtr, int offset, CONST char * msg, int flags, int * indexPtr)); /* 304 */
VOID * (*tcl_GetThreadData) _ANSI_ARGS_((Tcl_ThreadDataKey * keyPtr, int size)); /* 305 */
Tcl_Obj * (*tcl_GetVar2Ex) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags)); /* 306 */
ClientData (*tcl_InitNotifier) _ANSI_ARGS_((void)); /* 307 */
diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c
index fbddce9..5891aeb 100644
--- a/generic/tclIndexObj.c
+++ b/generic/tclIndexObj.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: tclIndexObj.c,v 1.15 2002/02/16 00:37:54 hobbs Exp $
+ * RCS: @(#) $Id: tclIndexObj.c,v 1.16 2002/02/28 05:11:25 dgp Exp $
*/
#include "tclInt.h"
@@ -161,7 +161,7 @@ Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags,
indexPtr)
Tcl_Interp *interp; /* Used for error reporting if not NULL. */
Tcl_Obj *objPtr; /* Object containing the string to lookup. */
- CONST char **tablePtr; /* The first string in the table. The second
+ CONST VOID *tablePtr; /* The first string in the table. The second
* string will be at this address plus the
* offset, the third plus the offset again,
* etc. The last entry must be NULL
@@ -274,7 +274,7 @@ Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, offset, msg, flags,
resultPtr = Tcl_GetObjResult(interp);
Tcl_AppendStringsToObj(resultPtr,
(numAbbrev > 1) ? "ambiguous " : "bad ", msg, " \"",
- key, "\": must be ", *tablePtr, (char *) NULL);
+ key, "\": must be ", STRING_AT(tablePtr,offset,0), (char*)NULL);
for (entryPtr = NEXT_ENTRY(tablePtr, offset), count = 0;
*entryPtr != NULL;
entryPtr = NEXT_ENTRY(entryPtr, offset), count++) {