Attachment "None" to
ticket [402561ffff]
added by
andreas_kupries
2000-11-28 18:02:19.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.362
diff -u -r1.362 ChangeLog
--- ChangeLog 2001/01/12 09:54:16 1.362
+++ ChangeLog 2001/01/17 23:40:58
@@ -1,3 +1,28 @@
+2001-01-xx Andreas Kupries <[email protected]>
+ * Everything below belongs together, it fixes bug #123153.
+
+ * generic/tcl.h (line 342): A bit more explanation about the
+ default value for TCL_PRESERVE_BINARY_COMPATABILITY.
+
+ * generic/tcl.h (line 1208): Define the macro 'Tcl_InitHashTable'
+ only when TCL_PRESERVE_BINARY_COMPATIBILITY is not set
+ as it kills binary compatibility to 8.3 and earlier
+ versions. This is the main part of the patch/change.
+
+ * generic/tcl.decls (line 1469):
+ * generic/tclHash.c (Tcl_InitHashTable):
+ * generic/tclHash.c (Tcl_InitHashTableEx):
+ * generic/tclObj.c (Tcl_InitObjHashTable): Changed
+ 'Tcl_InitHashTableEx' to 'Tcl_InitCustomHashTable'. This change
+ is more of an estethical nature, replacing the ubiquitous 'Ex'
+ suffix with a more meaningful name. The introduced binary
+ incompatibility is deemed acceptable as it is between alpha
+ versions. Updated callers.
+
+ * doc/Hash.3:
+ * unix/mkLinks: Changed 'Tcl_InitHashTableEx' to
+ 'Tcl_InitCustomHashTable'.
+
2001-01-10 Donal K. Fellows <[email protected]>
* tests/winPipe.test (winpipe-1.20):
Index: doc/Hash.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/Hash.3,v
retrieving revision 1.7
diff -u -r1.7 Hash.3
--- doc/Hash.3 2000/07/22 01:53:23 1.7
+++ doc/Hash.3 2001/01/17 23:40:58
@@ -11,14 +11,14 @@
.TH Tcl_Hash 3 "" Tcl "Tcl Library Procedures"
.BS
.SH NAME
-Tcl_InitHashTable, Tcl_InitHashTableEx, Tcl_InitObjHashTable, Tcl_DeleteHashTable, Tcl_CreateHashEntry, Tcl_DeleteHashEntry, Tcl_FindHashEntry, Tcl_GetHashValue, Tcl_SetHashValue, Tcl_GetHashKey, Tcl_FirstHashEntry, Tcl_NextHashEntry, Tcl_HashStats \- procedures to manage hash tables
+Tcl_InitHashTable, Tcl_InitCustomHashTable, Tcl_InitObjHashTable, Tcl_DeleteHashTable, Tcl_CreateHashEntry, Tcl_DeleteHashEntry, Tcl_FindHashEntry, Tcl_GetHashValue, Tcl_SetHashValue, Tcl_GetHashKey, Tcl_FirstHashEntry, Tcl_NextHashEntry, Tcl_HashStats \- procedures to manage hash tables
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
.sp
\fBTcl_InitHashTable\fR(\fItablePtr, keyType\fR)
.sp
-\fBTcl_InitHashTableEx\fR(\fItablePtr, keyType, typePtr\fR)
+\fBTcl_InitCustomHashTable\fR(\fItablePtr, keyType, typePtr\fR)
.sp
\fBTcl_InitObjHashTable\fR(\fItablePtr\fR)
.sp
@@ -75,43 +75,49 @@
Pointer to record to use to keep track of progress in enumerating
all the entries in a hash table.
.BE
-
.SH DESCRIPTION
.PP
-A hash table consists of zero or more entries, each consisting of
-a key and a value.
-Given the key for an entry, the hashing routines can very quickly
-locate the entry, and hence its value.
-There may be at most one entry in a hash table with a
-particular key, but many entries may have the same value.
-Keys can take one of three forms: strings,
-one-word values, or integer arrays.
-All of the keys in a given table have the same form, which is
-specified when the table is initialized.
-.PP
-The value of a hash table entry can be anything that fits in
-the same space as a ``char *'' pointer.
-Values for hash table entries are managed entirely by clients,
-not by the hash module itself.
-Typically each entry's value is a pointer to a data structure
-managed by client code.
-.PP
-Hash tables grow gracefully as the number of entries increases,
-so that there are always less than three entries per hash bucket,
-on average.
-This allows for fast lookups regardless of the number of entries
-in a table.
-.PP
-\fBTcl_InitHashTable\fR calls the extended function
-\fBTcl_InitHashTableEx\fR with a NULL \fItypePtr\fR.
-.PP
-\fBTcl_InitHashTableEx\fR initializes a structure that describes
-a new hash table.
-The space for the structure is provided by the caller, not by
-the hash module.
-The value of \fIkeyType\fR indicates what kinds of keys will
-be used for all entries in the table. \fIKeyType\fR must have
-one of the following values:
+A hash table consists of zero or more entries, each consisting of a
+key and a value. Given the key for an entry, the hashing routines can
+very quickly locate the entry, and hence its value. There may be at
+most one entry in a hash table with a particular key, but many entries
+may have the same value. Keys can take one of four forms: strings,
+one-word values, integer arrays, or custom keys defined by a
+Tcl_HashKeyType structure (See section \fBTHE TCL_HASHKEYTYPE
+STRUCTURE\fR below). All of the keys in a given table have the same
+form, which is specified when the table is initialized.
+.PP
+The value of a hash table entry can be anything that fits in the same
+space as a ``char *'' pointer. Values for hash table entries are
+managed entirely by clients, not by the hash module itself. Typically
+each entry's value is a pointer to a data structure managed by client
+code.
+.PP
+Hash tables grow gracefully as the number of entries increases, so
+that there are always less than three entries per hash bucket, on
+average. This allows for fast lookups regardless of the number of
+entries in a table.
+.PP
+The core provides three functions for the initialization of hash
+tables, Tcl_InitHashTable, Tcl_InitObjHashTable and
+Tcl_InitCustomHashTable.
+.PP
+\fBTcl_InitHashTable\fR initializes a structure that describes a new
+hash table. The space for the structure is provided by the caller,
+not by the hash module. The value of \fIkeyType\fR indicates what
+kinds of keys will be used for all entries in the table. All of the
+key types described later are allowed, with the exception of
+\fBTCL_CUSTOM_TYPE_KEYS\fR and \fBTCL_CUSTOM_PTR_KEYS\fR.
+.PP
+\fBTcl_InitObjHashTable\fR is a wrapper around
+\fBTcl_InitCustomHashTable\fR and initializes a hash table whose keys
+are Tcl_Obj *.
+.PP
+\fBTcl_InitCustomHashTable\fR initializes a structure that describes a
+new hash table. The space for the structure is provided by the
+caller, not by the hash module. The value of \fIkeyType\fR indicates
+what kinds of keys will be used for all entries in the table.
+\fIKeyType\fR must have one of the following values:
.IP \fBTCL_STRING_KEYS\fR 25
Keys are null-terminated ASCII strings.
They are passed to hashing routines using the address of the
@@ -126,9 +132,8 @@
and comparison is determined by \fItypePtr\fR. The Tcl_HashKeyType
structure is described in the section
\fBTHE TCL_HASHKEYTYPE STRUCTURE\fR below.
-
-.IP \fBTCL_CUSTOM_TYPE_KEYS\fR 25
-Keys are pointers to arbitrary type, and the are stored in the entry. Hashing
+.IP \fBTCL_CUSTOM_PTR_KEYS\fR 25
+Keys are pointers to an arbitrary type, and are stored in the entry. Hashing
and comparison is determined by \fItypePtr\fR. The Tcl_HashKeyType
structure is described in the section
\fBTHE TCL_HASHKEYTYPE STRUCTURE\fR below.
@@ -142,9 +147,6 @@
Array keys are passed into hashing functions using the address
of the first int in the array.
.PP
-\fBTcl_InitObjHashTable\fR uses \fBTcl_InitHashTableEx\fR to
-initialize a hash table whose keys are Tcl_Obj *.
-.PP
\fBTcl_DeleteHashTable\fR deletes all of the entries in a hash
table and frees up the memory associated with the table's
bucket array and entries.
@@ -226,12 +228,11 @@
However, users of the hashing routines should never refer directly
to any of the fields of any of the hash-related data structures;
use the procedures and macros defined here.
-
.SH "THE TCL_HASHKEYTYPE STRUCTURE"
.PP
Extension writers can define new hash key types by defining four
-procedure, initializing a Tcl_HashKeyType structure to describe
-the type, and calling \fBTcl_InitHashTableEx\fR.
+procedures, initializing a Tcl_HashKeyType structure to describe
+the type, and calling \fBTcl_InitCustomHashTable\fR.
The \fBTcl_HashKeyType\fR structure is defined as follows:
.CS
typedef struct Tcl_HashKeyType {
@@ -249,7 +250,7 @@
to distinguish between different structures. It should be set
to \fBTCL_HASH_KEY_TYPE_VERSION\fR.
.PP
-The \fIflags\fR member is one or more of the following OR'ed together:
+The \fIflags\fR member is one or more of the following values OR'ed together:
.IP \fBTCL_HASH_KEY_RANDOMIZE_HASH\fR 25
There are some things, pointers for example which don't hash well
because they do not use the lower bits. If this flag is set then the
Index: generic/tcl.decls
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.decls,v
retrieving revision 1.42
diff -u -r1.42 tcl.decls
--- generic/tcl.decls 2000/11/03 18:46:10 1.42
+++ generic/tcl.decls 2001/01/17 23:40:58
@@ -1466,7 +1466,7 @@
}
declare 423 generic {
- void Tcl_InitHashTableEx(Tcl_HashTable *tablePtr, int keyType, \
+ void Tcl_InitCustomHashTable(Tcl_HashTable *tablePtr, int keyType, \
Tcl_HashKeyType *typePtr)
}
Index: generic/tcl.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.h,v
retrieving revision 1.85
diff -u -r1.85 tcl.h
--- generic/tcl.h 2000/12/08 04:22:43 1.85
+++ generic/tcl.h 2001/01/17 23:40:58
@@ -339,7 +339,8 @@
/*
* This flag controls whether binary compatability is maintained with
- * extensions built against a previous version of Tcl.
+ * extensions built against a previous version of Tcl. This is true
+ * by default.
*/
#ifndef TCL_PRESERVE_BINARY_COMPATABILITY
#define TCL_PRESERVE_BINARY_COMPATABILITY 1
@@ -1206,12 +1207,14 @@
(*((tablePtr)->createProc))(tablePtr, key, newPtr)
#endif
+#if !TCL_PRESERVE_BINARY_COMPATABILITY
/*
* Macro to use new extended version of Tcl_InitHashTable.
*/
#define Tcl_InitHashTable(tablePtr, keyType) \
Tcl_InitHashTableEx(tablePtr, keyType, NULL)
-
+#endif
+
/*
* Flag values to pass to Tcl_DoOneEvent to disable searches
* for some kinds of events:
Index: generic/tclDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDecls.h,v
retrieving revision 1.43
diff -u -r1.43 tclDecls.h
--- generic/tclDecls.h 2000/11/03 18:46:11 1.43
+++ generic/tclDecls.h 2001/01/17 23:40:59
@@ -1315,7 +1315,7 @@
Tcl_HashTable * tablePtr, CONST char * key,
int * newPtr));
/* 423 */
-EXTERN void Tcl_InitHashTableEx _ANSI_ARGS_((
+EXTERN void Tcl_InitCustomHashTable _ANSI_ARGS_((
Tcl_HashTable * tablePtr, int keyType,
Tcl_HashKeyType * typePtr));
/* 424 */
@@ -1840,7 +1840,7 @@
int (*tcl_UniCharCaseMatch) _ANSI_ARGS_((CONST Tcl_UniChar * ustr, CONST Tcl_UniChar * pattern, int nocase)); /* 420 */
Tcl_HashEntry * (*tcl_FindHashEntry) _ANSI_ARGS_((Tcl_HashTable * tablePtr, CONST char * key)); /* 421 */
Tcl_HashEntry * (*tcl_CreateHashEntry) _ANSI_ARGS_((Tcl_HashTable * tablePtr, CONST char * key, int * newPtr)); /* 422 */
- void (*tcl_InitHashTableEx) _ANSI_ARGS_((Tcl_HashTable * tablePtr, int keyType, Tcl_HashKeyType * typePtr)); /* 423 */
+ void (*Tcl_InitCustomHashTable) _ANSI_ARGS_((Tcl_HashTable * tablePtr, int keyType, Tcl_HashKeyType * typePtr)); /* 423 */
void (*tcl_InitObjHashTable) _ANSI_ARGS_((Tcl_HashTable * tablePtr)); /* 424 */
ClientData (*tcl_CommandTraceInfo) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags, Tcl_CommandTraceProc * procPtr, ClientData prevClientData)); /* 425 */
int (*tcl_TraceCommand) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags, Tcl_CommandTraceProc * proc, ClientData clientData)); /* 426 */
@@ -3590,9 +3590,9 @@
#define Tcl_CreateHashEntry \
(tclStubsPtr->tcl_CreateHashEntry) /* 422 */
#endif
-#ifndef Tcl_InitHashTableEx
-#define Tcl_InitHashTableEx \
- (tclStubsPtr->tcl_InitHashTableEx) /* 423 */
+#ifndef Tcl_InitCustomHashTable
+#define Tcl_InitCustomHashTable \
+ (tclStubsPtr->Tcl_InitCustomHashTable) /* 423 */
#endif
#ifndef Tcl_InitObjHashTable
#define Tcl_InitObjHashTable \
Index: generic/tclHash.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclHash.c,v
retrieving revision 1.8
diff -u -r1.8 tclHash.c
--- generic/tclHash.c 2000/09/06 16:57:27 1.8
+++ generic/tclHash.c 2001/01/17 23:40:59
@@ -157,17 +157,17 @@
* extension is rebuilt then any calls to this function will be
* redirected to the extended version by a macro.
*/
- Tcl_InitHashTableEx(tablePtr, keyType, (Tcl_HashKeyType *) -1);
+ Tcl_InitCustomHashTable(tablePtr, keyType, (Tcl_HashKeyType *) -1);
}
/*
*----------------------------------------------------------------------
*
- * Tcl_InitHashTableEx --
+ * Tcl_InitCustomHashTable --
*
* Given storage for a hash table, set up the fields to prepare
* the hash table for use. This is an extended version of
- * Tcl_InitHashTableEx which supports user defined keys.
+ * Tcl_InitHashTable which supports user defined keys.
*
* Results:
* None.
@@ -180,7 +180,7 @@
*/
void
-Tcl_InitHashTableEx(tablePtr, keyType, typePtr)
+Tcl_InitCustomHashTable(tablePtr, keyType, typePtr)
register Tcl_HashTable *tablePtr; /* Pointer to table record, which
* is supplied by the caller. */
int keyType; /* Type of keys to use in table:
@@ -192,7 +192,7 @@
* the behaviour of this table. */
{
#if (TCL_SMALL_HASH_TABLE != 4)
- panic("Tcl_InitHashTableEx: TCL_SMALL_HASH_TABLE is %d, not 4\n",
+ panic("Tcl_InitCustomHashTable: TCL_SMALL_HASH_TABLE is %d, not 4\n",
TCL_SMALL_HASH_TABLE);
#endif
Index: generic/tclObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclObj.c,v
retrieving revision 1.18
diff -u -r1.18 tclObj.c
--- generic/tclObj.c 2000/08/10 18:24:52 1.18
+++ generic/tclObj.c 2001/01/17 23:40:59
@@ -2148,7 +2148,8 @@
register Tcl_HashTable *tablePtr; /* Pointer to table record, which
* is supplied by the caller. */
{
- Tcl_InitHashTableEx (tablePtr, TCL_CUSTOM_PTR_KEYS, &tclObjHashKeyType);
+ Tcl_InitCustomHashTable(tablePtr, TCL_CUSTOM_PTR_KEYS,
+ &tclObjHashKeyType);
}
/*
Index: generic/tclStubInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclStubInit.c,v
retrieving revision 1.46
diff -u -r1.46 tclStubInit.c
--- generic/tclStubInit.c 2000/11/03 18:46:12 1.46
+++ generic/tclStubInit.c 2001/01/17 23:40:59
@@ -826,7 +826,7 @@
Tcl_UniCharCaseMatch, /* 420 */
Tcl_FindHashEntry, /* 421 */
Tcl_CreateHashEntry, /* 422 */
- Tcl_InitHashTableEx, /* 423 */
+ Tcl_InitCustomHashTable, /* 423 */
Tcl_InitObjHashTable, /* 424 */
Tcl_CommandTraceInfo, /* 425 */
Tcl_TraceCommand, /* 426 */
Index: unix/mkLinks
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/mkLinks,v
retrieving revision 1.17
diff -u -r1.17 mkLinks
--- unix/mkLinks 2000/11/03 20:19:44 1.17
+++ unix/mkLinks 2001/01/17 23:40:59
@@ -472,7 +472,7 @@
fi
if test -r Hash.3; then
rm -f Tcl_InitHashTable.3
- rm -f Tcl_InitHashTableEx.3
+ rm -f Tcl_InitCustomHashTable.3
rm -f Tcl_InitObjHashTable.3
rm -f Tcl_DeleteHashTable.3
rm -f Tcl_CreateHashEntry.3
@@ -485,7 +485,7 @@
rm -f Tcl_NextHashEntry.3
rm -f Tcl_HashStats.3
ln Hash.3 Tcl_InitHashTable.3
- ln Hash.3 Tcl_InitHashTableEx.3
+ ln Hash.3 Tcl_InitCustomHashTable.3
ln Hash.3 Tcl_InitObjHashTable.3
ln Hash.3 Tcl_DeleteHashTable.3
ln Hash.3 Tcl_CreateHashEntry.3