summaryrefslogtreecommitdiffstats
path: root/doc/GetIndex.3
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-06-29 08:47:49 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-06-29 08:47:49 (GMT)
commit5ae31d17ae90c4d8e051c04a45dbcff59b4e4159 (patch)
tree8abae8da3745d19293c8f8072bdb2e6ddb5d83e9 /doc/GetIndex.3
parent50f846b8e0f664d9d8c2e92aef3ea676db9cf172 (diff)
parent1bacfee38ca9ec1cb380f01206190a06f9413609 (diff)
downloadtcl-5ae31d17ae90c4d8e051c04a45dbcff59b4e4159.zip
tcl-5ae31d17ae90c4d8e051c04a45dbcff59b4e4159.tar.gz
tcl-5ae31d17ae90c4d8e051c04a45dbcff59b4e4159.tar.bz2
Reinforced the description of the requirement for the tables of names for Tcl_GetIndexFromObj to index over to be static, following posting to tcl-core by Brian Griffin about a bug caused by not obeying this rule correctly.
Diffstat (limited to 'doc/GetIndex.3')
-rw-r--r--doc/GetIndex.310
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/GetIndex.3 b/doc/GetIndex.3
index 82590fb..45d4e9c 100644
--- a/doc/GetIndex.3
+++ b/doc/GetIndex.3
@@ -32,10 +32,16 @@ table entry.
.AP "const char" **tablePtr in
An array of null-terminated strings. The end of the array is marked
by a NULL string pointer.
+Note that references to the \fItablePtr\fR may be retained in the
+internal representation of \fIobjPtr\fR, so this should represent the
+address of a statically-allocated array.
.AP "const void" *structTablePtr in
An array of arbitrary type, typically some \fBstruct\fR type.
The first member of the structure must be a null-terminated string.
The size of the structure is given by \fIoffset\fR.
+Note that references to the \fIstructTablePtr\fR may be retained in the
+internal representation of \fIobjPtr\fR, so this should represent the
+address of a statically-allocated array of structures.
.AP int offset in
The offset to add to structTablePtr to get to the next entry.
The end of the array is marked by a NULL string pointer.
@@ -52,10 +58,10 @@ The index of the string in \fItablePtr\fR that matches the value of
.SH DESCRIPTION
.PP
-This procedure provides an efficient way for looking up keywords,
+These procedures provide an efficient way for looking up keywords,
switch names, option names, and similar things where the value of
an object must be one of a predefined set of values.
-\fIObjPtr\fR is compared against each of
+\fBTcl_GetIndexFromObj\fR compares \fIobjPtr\fR against each of
the strings in \fItablePtr\fR to find a match. A match occurs if
\fIobjPtr\fR's string value is identical to one of the strings in
\fItablePtr\fR, or if it is a non-empty unique abbreviation