From 65ff2c43c71d36723489b8d3f3b73f63751bc934 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Mon, 3 Dec 2012 15:02:01 +0000
Subject: This doesn't compile! Just a reminder to myself which other
 API's/fields/whatever might need to become size_t. Probably too much.

---
 generic/tcl.decls    | 40 ++++++++++++++++++++--------------------
 generic/tcl.h        | 14 --------------
 generic/tclCompile.h | 18 +++++++++---------
 generic/tclInt.decls | 26 +++++++++++++-------------
 generic/tclInt.h     | 22 +++++++++++-----------
 5 files changed, 53 insertions(+), 67 deletions(-)

diff --git a/generic/tcl.decls b/generic/tcl.decls
index ede06a8..039fce7 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -551,7 +551,7 @@ declare 151 {
 	    int *modePtr)
 }
 declare 152 {
-    int Tcl_GetChannelBufferSize(Tcl_Channel chan)
+    size_t Tcl_GetChannelBufferSize(Tcl_Channel chan)
 }
 declare 153 {
     int Tcl_GetChannelHandle(Tcl_Channel chan, int direction,
@@ -613,10 +613,10 @@ declare 168 {
     Tcl_PathType Tcl_GetPathType(const char *path)
 }
 declare 169 {
-    ssize_t Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr)
+    size_t Tcl_Gets(Tcl_Channel chan, Tcl_DString *dsPtr)
 }
 declare 170 {
-    ssize_t Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr)
+    size_t Tcl_GetsObj(Tcl_Channel chan, Tcl_Obj *objPtr)
 }
 declare 171 {
     int Tcl_GetServiceMode(void)
@@ -742,7 +742,7 @@ declare 205 {
     void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position)
 }
 declare 206 {
-    ssize_t Tcl_Read(Tcl_Channel chan, char *bufPtr, size_t toRead)
+    size_t Tcl_Read(Tcl_Channel chan, char *bufPtr, size_t toRead)
 }
 declare 207 {
     void Tcl_ReapDetachedProcs(void)
@@ -771,7 +771,7 @@ declare 214 {
 	    const char *pattern)
 }
 declare 215 {
-    void Tcl_RegExpRange(Tcl_RegExp regexp, int index,
+    void Tcl_RegExpRange(Tcl_RegExp regexp, size_t index,
 	    const char **startPtr, const char **endPtr)
 }
 declare 216 {
@@ -801,7 +801,7 @@ declare 223 {
 	    Tcl_InterpDeleteProc *proc, ClientData clientData)
 }
 declare 224 {
-    void Tcl_SetChannelBufferSize(Tcl_Channel chan, int sz)
+    void Tcl_SetChannelBufferSize(Tcl_Channel chan, size_t sz)
 }
 declare 225 {
     int Tcl_SetChannelOption(Tcl_Interp *interp, Tcl_Channel chan,
@@ -892,7 +892,7 @@ declare 249 {
 	    Tcl_DString *bufferPtr)
 }
 declare 250 {
-    ssize_t Tcl_Ungets(Tcl_Channel chan, const char *str, size_t len, int atHead)
+    size_t Tcl_Ungets(Tcl_Channel chan, const char *str, size_t len, int atHead)
 }
 declare 251 {
     void Tcl_UnlinkVar(Tcl_Interp *interp, const char *varName)
@@ -940,7 +940,7 @@ declare 262 {
 	    ClientData prevClientData)
 }
 declare 263 {
-    ssize_t Tcl_Write(Tcl_Channel chan, const char *s, size_t slen)
+    size_t Tcl_Write(Tcl_Channel chan, const char *s, size_t slen)
 }
 declare 264 {
     void Tcl_WrongNumArgs(Tcl_Interp *interp, size_t objc,
@@ -1101,7 +1101,7 @@ declare 303 {
 }
 declare 304 {
     int Tcl_GetIndexFromObjStruct(Tcl_Interp *interp, Tcl_Obj *objPtr,
-	    const void *tablePtr, int offset, const char *msg, int flags,
+	    const void *tablePtr, size_t offset, const char *msg, int flags,
 	    int *indexPtr)
 }
 declare 305 {
@@ -1131,7 +1131,7 @@ declare 312 {
     size_t Tcl_NumUtfChars(const char *src, size_t length)
 }
 declare 313 {
-    ssize_t Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr,
+    size_t Tcl_ReadChars(Tcl_Channel channel, Tcl_Obj *objPtr,
 	    size_t charsToRead, int appendFlag)
 }
 declare 314 {
@@ -1213,10 +1213,10 @@ declare 337 {
     int Tcl_UtfToUpper(char *src)
 }
 declare 338 {
-    ssize_t Tcl_WriteChars(Tcl_Channel chan, const char *src, size_t srcLen)
+    size_t Tcl_WriteChars(Tcl_Channel chan, const char *src, size_t srcLen)
 }
 declare 339 {
-    ssize_t Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr)
+    size_t Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr)
 }
 declare 340 {
     char *Tcl_GetString(Tcl_Obj *objPtr)
@@ -1344,7 +1344,7 @@ declare 375 {
 }
 declare 376 {
     int Tcl_RegExpExecObj(Tcl_Interp *interp, Tcl_RegExp regexp,
-	    Tcl_Obj *textObj, int offset, int nmatches, int flags)
+	    Tcl_Obj *textObj, size_t offset, int nmatches, int flags)
 }
 declare 377 {
     void Tcl_RegExpGetInfo(Tcl_RegExp regexp, Tcl_RegExpInfo *infoPtr)
@@ -1405,10 +1405,10 @@ declare 393 {
 
 # Introduced in 8.3.2
 declare 394 {
-    ssize_t Tcl_ReadRaw(Tcl_Channel chan, char *dst, size_t bytesToRead)
+    size_t Tcl_ReadRaw(Tcl_Channel chan, char *dst, size_t bytesToRead)
 }
 declare 395 {
-    ssize_t Tcl_WriteRaw(Tcl_Channel chan, const char *src, size_t srcLen)
+    size_t Tcl_WriteRaw(Tcl_Channel chan, const char *src, size_t srcLen)
 }
 declare 396 {
     Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan)
@@ -1619,11 +1619,11 @@ declare 450 {
 }
 declare 451 {
     int Tcl_FSFileAttrsGet(Tcl_Interp *interp,
-	    int index, Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef)
+	    size_t index, Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef)
 }
 declare 452 {
     int Tcl_FSFileAttrsSet(Tcl_Interp *interp,
-	    int index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr)
+	    size_t index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr)
 }
 declare 453 {
     const char *const *Tcl_FSFileAttrStrings(Tcl_Obj *pathPtr,
@@ -1649,7 +1649,7 @@ declare 459 {
     int Tcl_FSConvertToPathType(Tcl_Interp *interp, Tcl_Obj *pathPtr)
 }
 declare 460 {
-    Tcl_Obj *Tcl_FSJoinPath(Tcl_Obj *listObj, int elements)
+    Tcl_Obj *Tcl_FSJoinPath(Tcl_Obj *listObj, size_t elements)
 }
 declare 461 {
     Tcl_Obj *Tcl_FSSplitPath(Tcl_Obj *pathPtr, size_t *lenPtr)
@@ -2255,7 +2255,7 @@ declare 610 {
 }
 declare 611 {
     int Tcl_ZlibInflate(Tcl_Interp *interp, int format, Tcl_Obj *data,
-	    int buffersize, Tcl_Obj *gzipHeaderDictObj)
+	    size_t buffersize, Tcl_Obj *gzipHeaderDictObj)
 }
 declare 612 {
     unsigned int Tcl_ZlibCRC32(unsigned int crc, const unsigned char *buf,
@@ -2379,7 +2379,7 @@ declare 1 macosx {
 # Public functions that are not accessible via the stubs table.
 
 export {
-    void Tcl_Main(int argc, char **argv, Tcl_AppInitProc *appInitProc)
+    void Tcl_Main(size_t argc, char **argv, Tcl_AppInitProc *appInitProc)
 }
 export {
     const char *Tcl_InitStubs(Tcl_Interp *interp, const char *version,
diff --git a/generic/tcl.h b/generic/tcl.h
index e136011..efcdc7f 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -90,20 +90,6 @@ extern "C" {
 #endif /* __WIN32__ */
 
 /*
- * Utility macros: STRINGIFY takes an argument and wraps it in "" (double
- * quotation marks), JOIN joins two arguments.
- */
-
-#ifndef STRINGIFY
-#  define STRINGIFY(x) STRINGIFY1(x)
-#  define STRINGIFY1(x) #x
-#endif
-#ifndef JOIN
-#  define JOIN(a,b) JOIN1(a,b)
-#  define JOIN1(a,b) a##b
-#endif
-
-/*
  * A special definition used to allow this header file to be included from
  * windows resource files so that they can obtain version information.
  * RC_INVOKED is defined by default by the windows RC tool.
diff --git a/generic/tclCompile.h b/generic/tclCompile.h
index cf163d7..cefdb1f 100644
--- a/generic/tclCompile.h
+++ b/generic/tclCompile.h
@@ -232,13 +232,13 @@ typedef struct CompileEnv {
 				 * SetByteCodeFromAny. This pointer is not
 				 * owned by the CompileEnv and must not be
 				 * freed or changed by it. */
-    int numSrcBytes;		/* Number of bytes in source. */
+    size_t numSrcBytes1;		/* Number of bytes in source. */
     Proc *procPtr;		/* If a procedure is being compiled, a pointer
 				 * to its Proc structure; otherwise NULL. Used
 				 * to compile local variables. Set from
 				 * information provided by ObjInterpProc in
 				 * tclProc.c. */
-    int numCommands;		/* Number of commands compiled. */
+    size_t numCommands1;		/* Number of commands compiled. */
     int exceptDepth;		/* Current exception range nesting level; -1
 				 * if not in any range currently. */
     int maxExceptDepth;		/* Max nesting level of exception ranges; -1
@@ -303,7 +303,7 @@ typedef struct CompileEnv {
     /* TIP #280 */
     ExtCmdLoc *extCmdMapPtr;	/* Extended command location information for
 				 * 'info frame'. */
-    int line;			/* First line of the script, based on the
+    size_t line1;			/* First line of the script, based on the
 				 * invoking context, then the line of the
 				 * command currently compiled. */
     int atCmdStart;		/* Flag to say whether an INST_START_CMD
@@ -314,7 +314,7 @@ typedef struct CompileEnv {
 				 * locations of the invisible continuation
 				 * lines in the input script, to adjust the
 				 * line counter. */
-    ssize_t *clNext;		/* If not NULL, it refers to the next slot in
+    size_t *clNext;		/* If not NULL, it refers to the next slot in
 				 * clLoc to check for an invisible
 				 * continuation line. */
 } CompileEnv;
@@ -381,9 +381,9 @@ typedef struct ByteCode {
 				 * itself. Does not include heap space for
 				 * literal Tcl objects or storage referenced
 				 * by AuxData entries. */
-    int numCommands;		/* Number of commands compiled. */
-    int numSrcBytes;		/* Number of source bytes compiled. */
-    int numCodeBytes;		/* Number of code bytes. */
+    size_t numCommands;		/* Number of commands compiled. */
+    size_t numSrcBytes;		/* Number of source bytes compiled. */
+    size_t numCodeBytes;		/* Number of code bytes. */
     int numLitObjects;		/* Number of objects in literal array. */
     int numExceptRanges;	/* Number of ExceptionRange array elems. */
     int numAuxDataItems;	/* Number of AuxData items. */
@@ -905,7 +905,7 @@ MODULE_SCOPE Tcl_ObjCmdProc	TclNRInterpCoroutine;
  */
 
 MODULE_SCOPE ByteCode *	TclCompileObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
-			    const CmdFrame *invoker, int word);
+			    const CmdFrame *invoker, size_t word);
 
 /*
  *----------------------------------------------------------------
@@ -969,7 +969,7 @@ MODULE_SCOPE void	TclInitCompilation(void);
 MODULE_SCOPE void	TclInitCompileEnv(Tcl_Interp *interp,
 			    CompileEnv *envPtr, const char *string,
 			    size_t numBytes, const CmdFrame *invoker,
-			    int word);
+			    size_t word);
 MODULE_SCOPE void	TclInitJumpFixupArray(JumpFixupArray *fixupArrayPtr);
 MODULE_SCOPE void	TclInitLiteralTable(LiteralTable *tablePtr);
 #ifdef TCL_COMPILE_STATS
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 7c0374d..678b344 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -155,7 +155,7 @@ declare 32 {
 #}
 declare 34 {
     int TclGetIntForIndex(Tcl_Interp *interp, Tcl_Obj *objPtr,
-	    ssize_t endValue, ssize_t *indexPtr)
+	    size_t endValue, size_t *indexPtr)
 }
 # Removed in 8.4b2:
 #declare 35 {
@@ -442,7 +442,7 @@ declare 109 {
     int TclUpdateReturnInfo(Interp *iPtr)
 }
 declare 110 {
-    int TclSockMinimumBuffers(void *sock, int size)
+    int TclSockMinimumBuffers(void *sock, size_t size)
 }
 # Removed in 8.1:
 #  declare 110 {
@@ -578,7 +578,7 @@ declare 143 {
 }
 declare 144 {
     void TclHideLiteral(Tcl_Interp *interp, struct CompileEnv *envPtr,
-	    int index)
+	    size_t index)
 }
 declare 145 {
     const struct AuxDataType *TclGetAuxDataType(const char *typeName)
@@ -602,8 +602,8 @@ declare 150 {
     int TclRegAbout(Tcl_Interp *interp, Tcl_RegExp re)
 }
 declare 151 {
-    void TclRegExpRangeUniChar(Tcl_RegExp re, int index, int *startPtr,
-	    int *endPtr)
+    void TclRegExpRangeUniChar(Tcl_RegExp re, size_t index, size_t *startPtr,
+	    size_t *endPtr)
 }
 declare 152 {
     void TclSetLibraryPath(Tcl_Obj *pathPtr)
@@ -691,7 +691,7 @@ declare 166 {
 #}
 # variant of Tcl_UtfNCmp that takes n as bytes, not chars
 declare 169 {
-    int TclpUtfNcmp2(const char *s1, const char *s2, unsigned long n)
+    int TclpUtfNcmp2(const char *s1, const char *s2, size_t n)
 }
 declare 170 {
     int TclCheckInterpTraces(Tcl_Interp *interp, const char *command,
@@ -912,12 +912,12 @@ declare 227 {
 #  }
 declare 229 {
     int	TclPtrMakeUpvar(Tcl_Interp *interp, Var *otherP1Ptr,
-	    const char *myName, int myFlags, int index)
+	    const char *myName, int myFlags, size_t index)
 }
 declare 230 {
     Var *TclObjLookupVar(Tcl_Interp *interp, Tcl_Obj *part1Ptr,
 	    const char *part2, int flags, const char *msg,
-	    const int createPart1, const int createPart2, Var **arrayPtrPtr)
+	    int createPart1, int createPart2, Var **arrayPtrPtr)
 }
 declare 231 {
     int	TclGetNamespaceFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
@@ -969,7 +969,7 @@ declare 240 {
 }
 declare 241 {
     int TclNREvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags,
-	    const CmdFrame *invoker, int word)
+	    const CmdFrame *invoker, size_t word)
 }
 declare 242 {
     int TclNREvalObjv(Tcl_Interp *interp, size_t objc,
@@ -989,8 +989,8 @@ declare 245 {
     Tcl_HashTable *TclGetNamespaceCommandTable(Tcl_Namespace *nsPtr)
 }
 declare 246 {
-    int TclInitRewriteEnsemble(Tcl_Interp *interp, int numRemoved,
-	    int numInserted, Tcl_Obj *const *objv)
+    int TclInitRewriteEnsemble(Tcl_Interp *interp, size_t numRemoved,
+	    size_t numInserted, Tcl_Obj *const *objv)
 }
 declare 247 {
     void TclResetRewriteEnsemble(Tcl_Interp *interp, int isRootEnsemble)
@@ -1232,11 +1232,11 @@ declare 20 unix {
 # Mac OS X specific functions
 
 declare 15 macosx {
-    int TclMacOSXGetFileAttribute(Tcl_Interp *interp, int objIndex,
+    int TclMacOSXGetFileAttribute(Tcl_Interp *interp, size_t objIndex,
 	    Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr)
 }
 declare 16 macosx {
-    int TclMacOSXSetFileAttribute(Tcl_Interp *interp, int objIndex,
+    int TclMacOSXSetFileAttribute(Tcl_Interp *interp, size_t objIndex,
 	    Tcl_Obj *fileName, Tcl_Obj *attributePtr)
 }
 declare 17 macosx {
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 39eec2e..f5db5cb 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -1195,8 +1195,8 @@ typedef struct CmdFrame {
     int type;			/* Values see below. */
     int level;			/* Number of frames in stack, prevent O(n)
 				 * scan of list. */
-    int *line;			/* Lines the words of the command start on. */
-    int nline;
+    size_t *line1;			/* Lines the words of the command start on. */
+    size_t nline1;
     CallFrame *framePtr;	/* Procedure activation record, may be
 				 * NULL. */
     struct CmdFrame *nextPtr;	/* Link to calling frame. */
@@ -1258,7 +1258,7 @@ typedef struct CmdFrame {
 
 typedef struct CFWord {
     CmdFrame *framePtr;		/* CmdFrame to access. */
-    size_t word;		/* Index of the word in the command. */
+    size_t word1;		/* Index of the word in the command. */
     int refCount;		/* Number of times the word is on the
 				 * stack. */
 } CFWord;
@@ -1267,7 +1267,7 @@ typedef struct CFWordBC {
     CmdFrame *framePtr;		/* CmdFrame to access. */
     int pc;			/* Instruction pointer of a command in
 				 * ExtCmdLoc.loc[.] */
-    int word;			/* Index of word in
+    size_t word1;			/* Index of word in
 				 * ExtCmdLoc.loc[cmd]->line[.] */
     struct CFWordBC *prevPtr;	/* Previous entry in stack for same Tcl_Obj. */
     struct CFWordBC *nextPtr;	/* Next entry for same command call. See
@@ -2885,9 +2885,9 @@ MODULE_SCOPE void	TclAppendBytesToByteArray(Tcl_Obj *objPtr,
 MODULE_SCOPE int	TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr,
 			    int flags);
 MODULE_SCOPE void	TclPushTailcallPoint(Tcl_Interp *interp);
-MODULE_SCOPE void	TclAdvanceContinuations(int *line, ssize_t **next,
+MODULE_SCOPE void	TclAdvanceContinuations(size_t *line, size_t **next,
 			    int loc);
-MODULE_SCOPE void	TclAdvanceLines(int *line, const char *start,
+MODULE_SCOPE void	TclAdvanceLines(size_t *line, const char *start,
 			    const char *end);
 MODULE_SCOPE void	TclArgumentEnter(Tcl_Interp *interp,
 			    Tcl_Obj *objv[], size_t objc, CmdFrame *cf);
@@ -2899,7 +2899,7 @@ MODULE_SCOPE void	TclArgumentBCEnter(Tcl_Interp *interp,
 MODULE_SCOPE void	TclArgumentBCRelease(Tcl_Interp *interp,
 			    CmdFrame *cfPtr);
 MODULE_SCOPE void	TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj,
-			    CmdFrame **cfPtrPtr, int *wordPtr);
+			    CmdFrame **cfPtrPtr, size_t *wordPtr);
 MODULE_SCOPE int	TclArraySet(Tcl_Interp *interp,
 			    Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj);
 MODULE_SCOPE double	TclBignumToDouble(const mp_int *bignum);
@@ -2924,7 +2924,7 @@ MODULE_SCOPE size_t	TclConvertElement(const char *src, size_t length,
 MODULE_SCOPE void	TclDeleteNamespaceVars(Namespace *nsPtr);
 /* TIP #280 - Modified token based evulation, with line information. */
 MODULE_SCOPE int	TclEvalEx(Tcl_Interp *interp, const char *script,
-			    size_t numBytes, int flags, int line,
+			    size_t numBytes, int flags, size_t line,
 			    ssize_t *clNextOuter, const char *outerScript);
 MODULE_SCOPE Tcl_ObjCmdProc TclFileAttrsCmd;
 MODULE_SCOPE Tcl_ObjCmdProc TclFileCopyCmd;
@@ -3026,8 +3026,8 @@ MODULE_SCOPE Tcl_Obj *	TclLindexList(Tcl_Interp *interp,
 MODULE_SCOPE Tcl_Obj *	TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr,
 			    size_t indexCount, Tcl_Obj *const indexArray[]);
 /* TIP #280 */
-MODULE_SCOPE void	TclListLines(Tcl_Obj *listObj, int line,
-			    size_t numLines, int *lines,
+MODULE_SCOPE void	TclListLines(Tcl_Obj *listObj, size_t line,
+			    size_t numLines, size_t *lines,
 			    Tcl_Obj *const *elems);
 MODULE_SCOPE Tcl_Obj *	TclListObjCopy(Tcl_Interp *interp, Tcl_Obj *listPtr);
 MODULE_SCOPE Tcl_Obj *	TclLsetList(Tcl_Interp *interp, Tcl_Obj *listPtr,
@@ -3160,7 +3160,7 @@ MODULE_SCOPE void	TclSubstParse(Tcl_Interp *interp, const char *bytes,
 			    size_t numBytes, int flags, Tcl_Parse *parsePtr,
 			    Tcl_InterpState *statePtr);
 MODULE_SCOPE int	TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr,
-			    size_t count, size_t *tokensLeftPtr, int line,
+			    size_t count, size_t *tokensLeftPtr, size_t line,
 			    ssize_t *clNextOuter, const char *outerScript);
 MODULE_SCOPE int	TclTrimLeft(const char *bytes, size_t numBytes,
 			    const char *trim, size_t numTrim);
-- 
cgit v0.12

