Tcl Source Code

Artifact [f8ca4b9f4a]
Login

Artifact f8ca4b9f4a794d89b9a22408c8f2c48bc5212174:

Attachment "index.patch" to ticket [501491ffff] added by dgp 2002-01-10 04:24:49.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.783
diff -u -u -r1.783 ChangeLog
--- ChangeLog	2002/01/09 19:09:28	1.783
+++ ChangeLog	2002/01/09 21:07:32
@@ -20,11 +20,18 @@
 
 2002-01-09  Don Porter <[email protected]>
 
+	* doc/GetIndex.3:
+	* doc/WrongNumArgs.3:
+	* generic/tcl.decls (Tcl_GetIndexFromObj, Tcl_GetIndexFromObjStruct,
+	  Tcl_WrongNumArgs):
+	* generic/tclIndexObj.c (Tcl_GetIndexFromObj, Tcl_GetIndexFromObjStruct,
+	  Tcl_WrongNumArgs):  Updated APIs in the file generic/tclIndexObj.c
+	according to the guidelines of TIP 27.
+	* generic/tclDecls.h: make genstubs
+
 	* generic/tclTest.c (MainLoop):
 	* tests/main.test (Tcl_Main-1.{3,4,5,6}):  Corrected some non-portable
 	tests from the new Tcl_Main changes.  Thanks to Kevin Kenny.
-
-	* generic/tclIntDecls.h: make genstubs
 
 2002-01-07  Don Porter <[email protected]>
 
Index: doc/GetIndex.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/GetIndex.3,v
retrieving revision 1.6
diff -u -u -r1.6 GetIndex.3
--- doc/GetIndex.3	2000/07/24 00:03:02	1.6
+++ doc/GetIndex.3	2002/01/09 21:07:33
@@ -25,7 +25,7 @@
 msg, flags, indexPtr\fR)
 .VE
 .SH ARGUMENTS
-.AS Tcl_Interp **tablePtr
+.AS "char * CONST" *tablePtr
 .AP Tcl_Interp *interp in
 Interpreter to use for error reporting; if NULL, then no message is
 provided on errors.
@@ -33,7 +33,7 @@
 The string value of this object is used to search through \fItablePtr\fR.
 The internal representation is modified to hold the index of the matching
 table entry.
-.AP char **tablePtr in
+.AP "char * CONST" *tablePtr in
 An array of null-terminated strings.  The end of the array is marked
 by a NULL string pointer.
 .VS
@@ -41,7 +41,7 @@
 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.
 .VE
-.AP char *msg in
+.AP "CONST char" *msg in
 Null-terminated string describing what is being looked up, such as
 \fBoption\fR.  This string is included in error messages.
 .AP int flags in
Index: doc/WrongNumArgs.3
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/WrongNumArgs.3,v
retrieving revision 1.3
diff -u -u -r1.3 WrongNumArgs.3
--- doc/WrongNumArgs.3	1999/08/21 19:40:48	1.3
+++ doc/WrongNumArgs.3	2002/01/09 21:07:33
@@ -26,7 +26,7 @@
 message.
 .AP Tcl_Obj "*CONST\ objv[]" in
 Arguments to command that had the wrong number of arguments.
-.AP char *message in
+.AP "CONST char" *message in
 Additional error information to print after leading arguments
 from \fIobjv\fR.  This typically gives the acceptable syntax
 of the command.  This argument may be NULL.
Index: generic/tcl.decls
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.decls,v
retrieving revision 1.68
diff -u -u -r1.68 tcl.decls
--- generic/tcl.decls	2002/01/09 19:09:28	1.68
+++ generic/tcl.decls	2002/01/09 21:07:33
@@ -154,7 +154,7 @@
 }
 declare 36 generic {
     int Tcl_GetIndexFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, \
-	    char **tablePtr, char *msg, int flags, int *indexPtr)
+	    char * CONST *tablePtr, CONST char *msg, int flags, int *indexPtr)
 }
 declare 37 generic {
     int Tcl_GetInt(Tcl_Interp *interp, CONST char *str, int *intPtr)
@@ -927,7 +927,7 @@
 }
 declare 264 generic {
     void Tcl_WrongNumArgs(Tcl_Interp *interp, int objc, \
-	    Tcl_Obj *CONST objv[], char *message)
+	    Tcl_Obj *CONST objv[], CONST char *message)
 }
 declare 265 generic {
     int Tcl_DumpActiveMemory( CONST char *fileName )
@@ -1083,7 +1083,8 @@
 }
 declare 304 generic {
     int Tcl_GetIndexFromObjStruct(Tcl_Interp *interp, Tcl_Obj *objPtr, \
-	    char **tablePtr, int offset, char *msg, int flags, int *indexPtr)
+	    char * CONST *tablePtr, int offset, CONST char *msg, int flags, \
+	    int *indexPtr)
 }
 declare 305 generic {
     VOID * Tcl_GetThreadData(Tcl_ThreadDataKey *keyPtr, int size)
Index: generic/tclDecls.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDecls.h,v
retrieving revision 1.68
diff -u -u -r1.68 tclDecls.h
--- generic/tclDecls.h	2002/01/09 19:09:28	1.68
+++ generic/tclDecls.h	2002/01/09 21:07:34
@@ -137,8 +137,8 @@
 				double * doublePtr));
 /* 36 */
 EXTERN int		Tcl_GetIndexFromObj _ANSI_ARGS_((Tcl_Interp * interp, 
-				Tcl_Obj * objPtr, char ** tablePtr, 
-				char * msg, int flags, int * indexPtr));
+				Tcl_Obj * objPtr, char * CONST * tablePtr, 
+				CONST char * msg, int flags, int * indexPtr));
 /* 37 */
 EXTERN int		Tcl_GetInt _ANSI_ARGS_((Tcl_Interp * interp, 
 				CONST char * str, int * intPtr));
@@ -858,7 +858,7 @@
 /* 264 */
 EXTERN void		Tcl_WrongNumArgs _ANSI_ARGS_((Tcl_Interp * interp, 
 				int objc, Tcl_Obj *CONST objv[], 
-				char * message));
+				CONST char * message));
 /* 265 */
 EXTERN int		Tcl_DumpActiveMemory _ANSI_ARGS_((
 				CONST char * fileName));
@@ -979,8 +979,8 @@
 /* 304 */
 EXTERN int		Tcl_GetIndexFromObjStruct _ANSI_ARGS_((
 				Tcl_Interp * interp, Tcl_Obj * objPtr, 
-				char ** tablePtr, int offset, char * msg, 
-				int flags, int * indexPtr));
+				char * CONST * tablePtr, int offset, 
+				CONST char * msg, int flags, int * indexPtr));
 /* 305 */
 EXTERN VOID *		Tcl_GetThreadData _ANSI_ARGS_((
 				Tcl_ThreadDataKey * keyPtr, int size));
@@ -1573,7 +1573,7 @@
     unsigned char * (*tcl_GetByteArrayFromObj) _ANSI_ARGS_((Tcl_Obj * objPtr, int * lengthPtr)); /* 33 */
     int (*tcl_GetDouble) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, double * doublePtr)); /* 34 */
     int (*tcl_GetDoubleFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, double * doublePtr)); /* 35 */
-    int (*tcl_GetIndexFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, char ** tablePtr, char * msg, int flags, int * indexPtr)); /* 36 */
+    int (*tcl_GetIndexFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, char * CONST * tablePtr, CONST char * msg, int flags, int * indexPtr)); /* 36 */
     int (*tcl_GetInt) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * str, int * intPtr)); /* 37 */
     int (*tcl_GetIntFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, int * intPtr)); /* 38 */
     int (*tcl_GetLongFromObj) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, long * longPtr)); /* 39 */
@@ -1833,7 +1833,7 @@
     ClientData (*tcl_VarTraceInfo) _ANSI_ARGS_((Tcl_Interp * interp, char * varName, int flags, Tcl_VarTraceProc * procPtr, ClientData prevClientData)); /* 261 */
     ClientData (*tcl_VarTraceInfo2) _ANSI_ARGS_((Tcl_Interp * interp, char * part1, char * part2, int flags, Tcl_VarTraceProc * procPtr, ClientData prevClientData)); /* 262 */
     int (*tcl_Write) _ANSI_ARGS_((Tcl_Channel chan, char * s, int slen)); /* 263 */
-    void (*tcl_WrongNumArgs) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], char * message)); /* 264 */
+    void (*tcl_WrongNumArgs) _ANSI_ARGS_((Tcl_Interp * interp, int objc, Tcl_Obj *CONST objv[], CONST char * message)); /* 264 */
     int (*tcl_DumpActiveMemory) _ANSI_ARGS_((CONST char * fileName)); /* 265 */
     void (*tcl_ValidateAllMemory) _ANSI_ARGS_((CONST char * file, int line)); /* 266 */
     void (*tcl_AppendResultVA) _ANSI_ARGS_((Tcl_Interp * interp, va_list argList)); /* 267 */
@@ -1873,7 +1873,7 @@
     Tcl_Encoding (*tcl_GetEncoding) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * name)); /* 301 */
     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, char ** tablePtr, int offset, char * msg, int flags, int * indexPtr)); /* 304 */
+    int (*tcl_GetIndexFromObjStruct) _ANSI_ARGS_((Tcl_Interp * interp, Tcl_Obj * objPtr, char * CONST * 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 */
Index: generic/tclIndexObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclIndexObj.c,v
retrieving revision 1.10
diff -u -u -r1.10 tclIndexObj.c
--- generic/tclIndexObj.c	2001/08/30 19:02:43	1.10
+++ generic/tclIndexObj.c	2002/01/09 21:07:34
@@ -76,10 +76,10 @@
 Tcl_GetIndexFromObj(interp, objPtr, tablePtr, msg, flags, indexPtr)
     Tcl_Interp *interp; 	/* Used for error reporting if not NULL. */
     Tcl_Obj *objPtr;		/* Object containing the string to lookup. */
-    char **tablePtr;		/* Array of strings to compare against the
+    char * CONST *tablePtr;	/* Array of strings to compare against the
 				 * value of objPtr; last entry must be NULL
 				 * and there must not be duplicate entries. */
-    char *msg;			/* Identifying word to use in error messages. */
+    CONST char *msg;		/* Identifying word to use in error messages. */
     int flags;			/* 0 or TCL_EXACT */
     int *indexPtr;		/* Place to store resulting integer index. */
 {
@@ -135,18 +135,19 @@
 	indexPtr)
     Tcl_Interp *interp; 	/* Used for error reporting if not NULL. */
     Tcl_Obj *objPtr;		/* Object containing the string to lookup. */
-    char **tablePtr;		/* The first string in the table. The second
+    char * CONST *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
 				 * and there must not be duplicate entries. */
     int offset;			/* The number of bytes between entries */
-    char *msg;			/* Identifying word to use in error messages. */
+    CONST char *msg;		/* Identifying word to use in error messages. */
     int flags;			/* 0 or TCL_EXACT */
     int *indexPtr;		/* Place to store resulting integer index. */
 {
     int index, length, i, numAbbrev;
-    char *key, *p1, *p2, **entryPtr;
+    char *key, *p1, *p2;
+    char * CONST *entryPtr;
     Tcl_Obj *resultPtr;
 
     /*
@@ -301,7 +302,7 @@
     Tcl_Obj *CONST objv[];		/* Initial argument objects, which
 					 * should be included in the error
 					 * message. */
-    char *message;			/* Error message to print after the
+    CONST char *message;		/* Error message to print after the
 					 * leading objects in objv. The
 					 * message may be NULL. */
 {