diff options
author | griffin <briang42@easystreet.net> | 2023-05-24 23:17:17 (GMT) |
---|---|---|
committer | griffin <briang42@easystreet.net> | 2023-05-24 23:17:17 (GMT) |
commit | ba261e8e87cd9fb904172ca5a43fadb8f163666a (patch) | |
tree | 07f644f0eb19d93b953c156179e27db3c292384f | |
parent | c3f8318a3f328bd39244bc8f88ed606848ec5b85 (diff) | |
parent | 231fd112f959c258117188b044681643f30129f1 (diff) | |
download | tcl-ba261e8e87cd9fb904172ca5a43fadb8f163666a.zip tcl-ba261e8e87cd9fb904172ca5a43fadb8f163666a.tar.gz tcl-ba261e8e87cd9fb904172ca5a43fadb8f163666a.tar.bz2 |
merge trunk
-rw-r--r-- | doc/Thread.3 | 2 | ||||
-rw-r--r-- | doc/chan.n | 19 | ||||
-rw-r--r-- | doc/close.n | 21 | ||||
-rw-r--r-- | doc/configurable.n | 2 | ||||
-rw-r--r-- | doc/link.n | 14 | ||||
-rw-r--r-- | doc/lremove.n | 2 | ||||
-rw-r--r-- | doc/lseq.n | 130 | ||||
-rw-r--r-- | generic/tcl.decls | 2 | ||||
-rw-r--r-- | generic/tclDecls.h | 4 | ||||
-rw-r--r-- | generic/tclDictObj.c | 2 | ||||
-rw-r--r-- | generic/tclEvent.c | 2 | ||||
-rw-r--r-- | generic/tclExecute.c | 119 | ||||
-rw-r--r-- | generic/tclInt.decls | 2 | ||||
-rw-r--r-- | generic/tclInt.h | 10 | ||||
-rw-r--r-- | generic/tclIntDecls.h | 5 | ||||
-rw-r--r-- | generic/tclStringObj.c | 4 | ||||
-rw-r--r-- | generic/tclUtil.c | 4 | ||||
-rw-r--r-- | tools/tcltk-man2html-utils.tcl | 2 | ||||
-rwxr-xr-x | tools/tcltk-man2html.tcl | 2 | ||||
-rw-r--r-- | unix/Makefile.in | 2 | ||||
-rw-r--r-- | unix/tclUnixThrd.c | 6 | ||||
-rw-r--r-- | win/Makefile.in | 2 | ||||
-rw-r--r-- | win/makefile.vc | 2 | ||||
-rw-r--r-- | win/tclWinDde.c | 19 | ||||
-rw-r--r-- | win/tclWinThrd.c | 8 |
25 files changed, 215 insertions, 172 deletions
diff --git a/doc/Thread.3 b/doc/Thread.3 index 51df5bb..c59a8dd 100644 --- a/doc/Thread.3 +++ b/doc/Thread.3 @@ -69,7 +69,7 @@ This procedure will act as the \fBmain()\fR of the newly created thread. The specified \fIclientData\fR will be its sole argument. .AP void *clientData in Arbitrary information. Passed as sole argument to the \fIproc\fR. -.AP int stackSize in +.AP size_t stackSize in The size of the stack given to the new thread. .AP int flags in Bitmask containing flags allowing the caller to modify behavior of @@ -55,7 +55,9 @@ channel is flushed in the background before finally being closed. .PP \fBchan close\fR may return an error if an error occurs while flushing output. If a process in a command pipeline created by \fBopen\fR returns an -error, \fBchan close\fR generates an error in the same manner as \fBexec\fR. +error (either by returning a non-zero exit code or writing to its standard +error file descriptor), \fBchan close\fR generates an error in the same +manner as \fBexec\fR. .PP Closing one side of a socket or command pipeline may lead to the shutdown() or close() of the underlying system resource, leading to a reaction from whatever @@ -70,6 +72,17 @@ description of channel sharing. .PP When the last interpreter sharing a channel is destroyed, the channel is switched to blocking mode and fully flushed and then closed. +.PP +Channels are automatically closed when an interpreter is destroyed and +when the process exits. +From 8.6 on (TIP#398), nonblocking channels are no longer switched to +blocking mode when exiting; this guarantees a timely exit even when the +peer or a communication channel is stalled. To ensure proper flushing of +stalled nonblocking channels on exit, one must now either (a) actively +switch them back to blocking or (b) use the environment variable +\fBTCL_FLUSH_NONBLOCKING_ON_EXIT\fR, which when set and not equal to +.QW \fB0\fR +restores the previous behavior. .RE .TP \fBchan configure \fIchannelName\fR ?\fIoptionName\fR? ?\fIvalue\fR? ?\fIoptionName value\fR?... @@ -348,8 +361,8 @@ first words of a command that provides the interface for a \fBrefchan\fR. \fBImode\fR is a list of one or more of the strings .QW \fBread\fR or -.QW \fBwrite\fR -, indicating whether the channel is a read channel, a write channel, or both. +.QW \fBwrite\fR , +indicating whether the channel is a read channel, a write channel, or both. It is an error if the handler does not support the chosen mode. .PP The handler is called as needed from the global namespace at the top level, and diff --git a/doc/close.n b/doc/close.n index 3d18aea..2066583 100644 --- a/doc/close.n +++ b/doc/close.n @@ -12,11 +12,12 @@ .SH NAME close \- Close an open channel .SH SYNOPSIS -\fBclose \fIchannelId\fR ?r(ead)|w(rite)? +\fBclose \fIchannelId\fR ?\fBr\fR(\fBead\fR)|\fBw\fR(\fBrite\fR)? .BE .SH DESCRIPTION .PP -Closes or half-closes the channel given by \fIchannelId\fR. +Closes or half-closes the channel given by \fIchannelId\fR. \fBchan close\fR +is another name for this command. .PP \fIChannelId\fR must be an identifier for an open channel such as a Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR), @@ -49,12 +50,20 @@ When the last interpreter in which the channel is registered invokes .PP Channels are automatically closed when an interpreter is destroyed and when the process exits. -From 8.6 on (TIP#398), nonblocking channels are no longer switched to blocking mode when exiting; this guarantees a timely exit even when the peer or a communication channel is stalled. To ensure proper flushing of stalled nonblocking channels on exit, one must now either (a) actively switch them back to blocking or (b) use the environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT, which when set and not equal to "0" restores the previous behavior. +From 8.6 on (TIP#398), nonblocking channels are no longer switched to +blocking mode when exiting; this guarantees a timely exit even when the +peer or a communication channel is stalled. To ensure proper flushing of +stalled nonblocking channels on exit, one must now either (a) actively +switch them back to blocking or (b) use the environment variable +\fBTCL_FLUSH_NONBLOCKING_ON_EXIT\fR, which when set and not equal to +.QW \fB0\fR +restores the previous behavior. .PP The command returns an empty string, and may generate an error if an error occurs while flushing output. If a command in a command -pipeline created with \fBopen\fR returns an error, \fBclose\fR -generates an error (similar to the \fBexec\fR command.) +pipeline created with \fBopen\fR returns an error (either by returning a +non-zero exit code or writing to its standard error file descriptor), +\fBclose\fR generates an error (similar to the \fBexec\fR command.) .PP The two-argument form is a .QW "half-close" : @@ -95,7 +104,7 @@ proc withOpenFile {filename channelVar script} { } .CE .SH "SEE ALSO" -file(n), open(n), socket(n), eof(n), Tcl_StandardChannels(3) +chan(n), file(n), open(n), socket(n), eof(n), Tcl_StandardChannels(3) .SH KEYWORDS blocking, channel, close, nonblocking, half-close '\" Local Variables: diff --git a/doc/configurable.n b/doc/configurable.n index 6477894..a138c33 100644 --- a/doc/configurable.n +++ b/doc/configurable.n @@ -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. '\" -.TH configurable n 0.1 TclOO "TclOO Commands" +.TH configurable n 0.4 TclOO "TclOO Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! @@ -52,11 +52,11 @@ oo::class create ABC { constructor {} { \fBlink\fR Foo - # The method foo is now directly accessible as foo here + # The method Foo is now directly accessible as Foo here \fBlink\fR {bar Foo} - # The method foo is now directly accessible as bar + # The method Foo is now directly accessible as bar \fBlink\fR {::ExternalCall Foo} - # The method foo is now directly accessible in the global + # The method Foo is now directly accessible in the global # namespace as ExternalCall } @@ -71,13 +71,13 @@ oo::class create ABC { ABC create abc abc grill \fI\(-> Step 1:\fR - \fI\(-> This is foo in ::abc\fR + \fI\(-> This is Foo in ::abc\fR \fI\(-> Step 2:\fR - \fI\(-> This is foo in ::abc\fR + \fI\(-> This is Foo in ::abc\fR # Direct access via the linked command puts "Step 3:"; ExternalCall \fI\(-> Step 3:\fR - \fI\(-> This is foo in ::abc\fR + \fI\(-> This is Foo in ::abc\fR .CE .PP This example shows that multiple linked commands can be made in a call to @@ -88,7 +88,7 @@ oo::class create Ex { constructor {} { \fBlink\fR a b c # The methods a, b, and c (defined below) are all now - # directly acessible within methods under their own names. + # directly accessible within methods under their own names. } method a {} { diff --git a/doc/lremove.n b/doc/lremove.n index 8763ea6..bd4a5eb 100644 --- a/doc/lremove.n +++ b/doc/lremove.n @@ -16,7 +16,7 @@ lremove \- Remove elements from a list by index .SH DESCRIPTION .PP \fBlremove\fR returns a new list formed by simultaneously removing zero or -more elements of \fIlist\fR at each of the indices given by an arbirary number +more elements of \fIlist\fR at each of the indices given by an arbitrary number of \fIindex\fR arguments. The indices may be in any order and may be repeated; the element at index will only be removed once. The index values are interpreted the same as index values for the command \fBstring index\fR, @@ -11,85 +11,109 @@ .SH NAME lseq \- Build a numeric sequence returned as a list .SH SYNOPSIS -\fBlseq \fIStart \fR?(\fB..\fR|\fBto\fR)? \fIEnd\fR ??\fBby\fR? \fIStep\fR? +\fBlseq \fIstart \fR?(\fB..\fR|\fBto\fR)? \fIend\fR ??\fBby\fR? \fIstep\fR? -\fBlseq \fIStart \fBcount\fR \fICount\fR ??\fBby\fR? \fIStep\fR? +\fBlseq \fIstart \fBcount\fR \fIcount\fR ??\fBby\fR? \fIstep\fR? -\fBlseq \fICount\fR ?\fBby \fIStep\fR? +\fBlseq \fIcount\fR ?\fBby \fIstep\fR? .BE .SH DESCRIPTION .PP The \fBlseq\fR command creates a sequence of numeric values using the given -parameters \fIStart\fR, \fIEnd\fR, and \fIStep\fR. The \fIoperation\fR -argument ".." or "to" defines the range. The "count" option is used -to define a count of the number of elements in the list. A short form use of -the command, with a -single count value, will create a range from 0 to count-1. - -The \fBlseq\fR command can produce both increasing and decreasing sequences. When -both Start and End are provided without a Step value, then if Start <= End, -the sequence will be increasing and if Start > End it will be decreasing. If a -Step vale is included, it's sign should agree with the direction of the +parameters \fIstart\fR, \fIend\fR, and \fIstep\fR. The \fIoperation\fR +argument "\fB..\fR" or "\fBto\fR" defines the range. The "\fBcount\fR" option +is used to define a count of the number of elements in the list. A short form +use of the command, with a single count value, will create a range from 0 to +count-1. + +The \fBlseq\fR command can produce both increasing and decreasing +sequences. When both \fIstart\fR and \fIend\fR are provided without a +\fIstep\fR value, then if \fIstart\fR <= \fIend\fR, the sequence will be +increasing and if \fIstart\fR > \fIend\fR it will be decreasing. If a +\fIstep\fR vale is included, it's sign should agree with the direction of the sequence (descending -> negative and ascending -> positive), otherwise an empty list is returned. For example: .CS \" - % lseq 1 to 5 ;# increasing - 1 2 3 4 5 +% \fBlseq\fR 1 to 5 ;# increasing +\fI\(-> 1 2 3 4 5 - % lseq 5 to 1 ;# decreasing - 5 4 3 2 1 +% \fBlseq\fR 5 to 1 ;# decreasing +\fI\(-> 5 4 3 2 1 - % lseq 6 to 1 by 2 ;# decreasing, step wrong sign, empty list +% \fBlseq\fR 6 to 1 by 2 ;# decreasing, step wrong sign, empty list - % lseq 1 to 5 by 0 ;# all step sizes of 0 produce an empty list +% \fBlseq\fR 1 to 5 by 0 ;# all step sizes of 0 produce an empty list +.\" +.CE +The numeric arguments, \fIstart\fR, \fIend\fR, \fIstep\fR, and \fIcount\fR, +may also be a valid expression. The expression will be evaluated and the +numeric result will be used. An expression that does not evaluate to a number +will produce an invalid argument error. +.PP +\fIStart\fR defines the initial value and \fIend\fR defines the limit, not +necessarily the last value. \fBlseq\fR produces a list with \fIcount\fR +elements, and if \fIcount\fR is not supplied, it is computed as + +.CS \" + \fIcount\fR = int( (\fIend\fR - \fIstart\fR + \fIstep\fR) / \fIstep\fR ) .\" .CE -The numeric arguments, \fIStart\fR, \fIEnd\fR, \fIStep\fR, and \fICount\fR, -may also be a valid expression. The expression will be evaluate and the -numeric result be used. An expression that does not evaluate to a number will -produce an invalid argument error. +.PP +The numeric arguments, \fIstart\fR, \fIend\fR, \fIstep\fR, and \fIcount\fR, +can also be a valid expression. the \fBlseq\fR command will evaluate the +expression (as if with \fBexpr\fR) +and use the numeric result, or return an error as with any invalid argument +value; a non-numeric expression result will result in an error. .SH EXAMPLES .CS .\" +\fBlseq\fR 3 +\fI\(-> 0 1 2\fR - lseq 3 - \(-> 0 1 2 - - lseq 3 0 - \(-> 3 2 1 0 +\fBlseq\fR 3 0 +\fI\(-> 3 2 1 0\fR - lseq 10 .. 1 by -2 - \(-> 10 8 6 4 2 +\fBlseq\fR 10 .. 1 by -2 +\fI\(-> 10 8 6 4 2\fR - set l [lseq 0 -5] - \(-> 0 -1 -2 -3 -4 -5 +set l [\fBlseq\fR 0 -5] +\fI\(-> 0 -1 -2 -3 -4 -5\fR - foreach i [lseq [llength $l]] { - puts l($i)=[lindex $l $i] - } - \(-> l(0)=0 - l(1)=-1 - l(2)=-2 - l(3)=-3 - l(4)=-4 - l(5)=-5 - - foreach i [lseq [llength $l]-1 0] { +foreach i [\fBlseq\fR [llength $l]] { + puts l($i)=[lindex $l $i] +} +\fI\(-> l(0)=0\fR +\fI\(-> l(1)=-1\fR +\fI\(-> l(2)=-2\fR +\fI\(-> l(3)=-3\fR +\fI\(-> l(4)=-4\fR +\fI\(-> l(5)=-5\fR + +foreach i [\fBlseq\fR {[llength $l]-1} 0] { puts l($i)=[lindex $l $i] - } - \(-> l(5)=-5 - l(4)=-4 - l(3)=-3 - l(2)=-2 - l(1)=-1 - l(0)=0 - - set sqrs [lmap i [lseq 1 10] {expr $i*$i}] - \(-> 1 4 9 16 25 36 49 64 81 100 +} +\fI\(-> l(5)=-5\fR +\fI\(-> l(4)=-4\fR +\fI\(-> l(3)=-3\fR +\fI\(-> l(2)=-2\fR +\fI\(-> l(1)=-1\fR +\fI\(-> l(0)=0\fR + +set i 17 + \fI\(-> 17\fR +if {$i in [\fBlseq\fR 0 50]} { # equivalent to: (0 <= $i && $i <= 50) + puts "Ok" +} else { + puts "outside :(" +} +\fI\(-> Ok\fR + +set sqrs [lmap i [\fBlseq\fR 1 10] { expr {$i*$i} }] +\fI\(-> 1 4 9 16 25 36 49 64 81 100\fR .\" .CE .SH "SEE ALSO" diff --git a/generic/tcl.decls b/generic/tcl.decls index d52b710..3919119 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1442,7 +1442,7 @@ declare 392 { } declare 393 { int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, - void *clientData, Tcl_Size stackSize, int flags) + void *clientData, TCL_HASH_TYPE stackSize, int flags) } # Introduced in 8.3.2 diff --git a/generic/tclDecls.h b/generic/tclDecls.h index feb7a64..295680c 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1036,7 +1036,7 @@ EXTERN void Tcl_MutexFinalize(Tcl_Mutex *mutex); /* 393 */ EXTERN int Tcl_CreateThread(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, - Tcl_Size stackSize, int flags); + TCL_HASH_TYPE stackSize, int flags); /* 394 */ EXTERN Tcl_Size Tcl_ReadRaw(Tcl_Channel chan, char *dst, Tcl_Size bytesToRead); @@ -2272,7 +2272,7 @@ typedef struct TclStubs { int (*tcl_ProcObjCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 390 */ void (*tcl_ConditionFinalize) (Tcl_Condition *condPtr); /* 391 */ void (*tcl_MutexFinalize) (Tcl_Mutex *mutex); /* 392 */ - int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, Tcl_Size stackSize, int flags); /* 393 */ + int (*tcl_CreateThread) (Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, TCL_HASH_TYPE stackSize, int flags); /* 393 */ Tcl_Size (*tcl_ReadRaw) (Tcl_Channel chan, char *dst, Tcl_Size bytesToRead); /* 394 */ Tcl_Size (*tcl_WriteRaw) (Tcl_Channel chan, const char *src, Tcl_Size srcLen); /* 395 */ Tcl_Channel (*tcl_GetTopChannel) (Tcl_Channel chan); /* 396 */ diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index b5d6e56..d37d279 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -1071,7 +1071,7 @@ Tcl_DictObjRemove( *---------------------------------------------------------------------- */ -Tcl_Size +Tcl_Size TclDictGetSize(Tcl_Obj *dictPtr) { Dict *dict; diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 1663b82..88a568a 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -2052,7 +2052,7 @@ Tcl_CreateThread( Tcl_ThreadId *idPtr, /* Return, the ID of the thread */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread */ void *clientData, /* The one argument to Main() */ - Tcl_Size stackSize, /* Size of stack for the new thread */ + TCL_HASH_TYPE stackSize, /* Size of stack for the new thread */ int flags) /* Flags controlling behaviour of the new * thread. */ { diff --git a/generic/tclExecute.c b/generic/tclExecute.c index a60687e..8fc2ae6 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -365,7 +365,7 @@ VarHashCreateVar( #define OBJ_AT_DEPTH(n) *(tosPtr-(n)) -#define CURR_DEPTH ((size_t)(tosPtr - initTosPtr)) +#define CURR_DEPTH (tosPtr - initTosPtr) #define STACK_BASE(esPtr) ((esPtr)->stackWords - 1) @@ -378,9 +378,9 @@ VarHashCreateVar( #ifdef TCL_COMPILE_DEBUG # define TRACE(a) \ while (traceInstructions) { \ - fprintf(stdout, "%2" TCL_Z_MODIFIER "u: %2" TCL_Z_MODIFIER "u (%" TCL_Z_MODIFIER "u) %s ", iPtr->numLevels, \ + fprintf(stdout, "%2" TCL_SIZE_MODIFIER "d: %2" TCL_T_MODIFIER "d (%" TCL_T_MODIFIER "d) %s ", iPtr->numLevels, \ CURR_DEPTH, \ - (size_t)(pc - codePtr->codeStart), \ + (pc - codePtr->codeStart), \ GetOpcodeName(pc)); \ printf a; \ break; \ @@ -394,9 +394,9 @@ VarHashCreateVar( TRACE_APPEND(("ERROR: %.30s\n", O2S(Tcl_GetObjResult(interp)))); # define TRACE_WITH_OBJ(a, objPtr) \ while (traceInstructions) { \ - fprintf(stdout, "%2" TCL_Z_MODIFIER "u: %2" TCL_Z_MODIFIER "u (%" TCL_Z_MODIFIER "u) %s ", iPtr->numLevels, \ + fprintf(stdout, "%2" TCL_SIZE_MODIFIER "d: %2" TCL_T_MODIFIER "d (%" TCL_T_MODIFIER "d) %s ", iPtr->numLevels, \ CURR_DEPTH, \ - (size_t)(pc - codePtr->codeStart), \ + (pc - codePtr->codeStart), \ GetOpcodeName(pc)); \ printf a; \ TclPrintObject(stdout, objPtr, 30); \ @@ -635,7 +635,7 @@ static ExceptionRange * GetExceptRangeForPc(const unsigned char *pc, static const char * GetSrcInfoForPc(const unsigned char *pc, ByteCode *codePtr, Tcl_Size *lengthPtr, const unsigned char **pcBeg, int *cmdIdxPtr); -static Tcl_Obj ** GrowEvaluationStack(ExecEnv *eePtr, size_t growth, +static Tcl_Obj ** GrowEvaluationStack(ExecEnv *eePtr, TCL_HASH_TYPE growth, int move); static void IllegalExprOperandType(Tcl_Interp *interp, const unsigned char *pc, Tcl_Obj *opndPtr); @@ -643,8 +643,8 @@ static void InitByteCodeExecution(Tcl_Interp *interp); static inline int wordSkip(void *ptr); static void ReleaseDictIterator(Tcl_Obj *objPtr); /* Useful elsewhere, make available in tclInt.h or stubs? */ -static Tcl_Obj ** StackAllocWords(Tcl_Interp *interp, size_t numWords); -static Tcl_Obj ** StackReallocWords(Tcl_Interp *interp, size_t numWords); +static Tcl_Obj ** StackAllocWords(Tcl_Interp *interp, TCL_HASH_TYPE numWords); +static Tcl_Obj ** StackReallocWords(Tcl_Interp *interp, TCL_HASH_TYPE numWords); static Tcl_NRPostProc CopyCallback; static Tcl_NRPostProc ExprObjCallback; static Tcl_NRPostProc FinalizeOONext; @@ -792,7 +792,7 @@ ExecEnv * TclCreateExecEnv( Tcl_Interp *interp, /* Interpreter for which the execution * environment is being created. */ - size_t size) /* The initial stack size, in number of words + TCL_HASH_TYPE size) /* The initial stack size, in number of words * [sizeof(Tcl_Obj*)] */ { ExecEnv *eePtr = (ExecEnv *)Tcl_Alloc(sizeof(ExecEnv)); @@ -974,12 +974,12 @@ static Tcl_Obj ** GrowEvaluationStack( ExecEnv *eePtr, /* Points to the ExecEnv with an evaluation * stack to enlarge. */ - size_t growth1, /* How much larger than the current used + TCL_HASH_TYPE growth1, /* How much larger than the current used * size. */ int move) /* 1 if move words since last marker. */ { ExecStack *esPtr = eePtr->execStackPtr, *oldPtr = NULL; - size_t newBytes; + TCL_HASH_TYPE newBytes; Tcl_Size growth = growth1; Tcl_Size newElems, currElems, needed = growth - (esPtr->endPtr - esPtr->tosPtr); Tcl_Obj **markerPtr = esPtr->markerPtr, **memStart; @@ -1126,7 +1126,7 @@ GrowEvaluationStack( static Tcl_Obj ** StackAllocWords( Tcl_Interp *interp, - size_t numWords) + TCL_HASH_TYPE numWords) { /* * Note that GrowEvaluationStack sets a marker in the stack. This marker @@ -1144,7 +1144,7 @@ StackAllocWords( static Tcl_Obj ** StackReallocWords( Tcl_Interp *interp, - size_t numWords) + TCL_HASH_TYPE numWords) { Interp *iPtr = (Interp *) interp; ExecEnv *eePtr = iPtr->execEnvPtr; @@ -1223,13 +1223,13 @@ TclStackFree( void * TclStackAlloc( Tcl_Interp *interp, - Tcl_Size numBytes) + TCL_HASH_TYPE numBytes) { Interp *iPtr = (Interp *) interp; - Tcl_Size numWords; + TCL_HASH_TYPE numWords; if (iPtr == NULL || iPtr->execEnvPtr == NULL) { - return (void *) Tcl_Alloc(numBytes); + return Tcl_Alloc(numBytes); } numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); return StackAllocWords(interp, numWords); @@ -1239,13 +1239,13 @@ void * TclStackRealloc( Tcl_Interp *interp, void *ptr, - Tcl_Size numBytes) + TCL_HASH_TYPE numBytes) { Interp *iPtr = (Interp *) interp; ExecEnv *eePtr; ExecStack *esPtr; Tcl_Obj **markerPtr; - Tcl_Size numWords; + TCL_HASH_TYPE numWords; if (iPtr == NULL || iPtr->execEnvPtr == NULL) { return Tcl_Realloc(ptr, numBytes); @@ -1888,10 +1888,10 @@ TclNRExecuteByteCode( { Interp *iPtr = (Interp *) interp; TEBCdata *TD; - size_t size = sizeof(TEBCdata) - 1 + TCL_HASH_TYPE size = sizeof(TEBCdata) - 1 + (codePtr->maxStackDepth + codePtr->maxExceptDepth) * sizeof(void *); - size_t numWords = (size + sizeof(Tcl_Obj *) - 1) / sizeof(Tcl_Obj *); + TCL_HASH_TYPE numWords = (size + sizeof(Tcl_Obj *) - 1) / sizeof(Tcl_Obj *); TclPreserveByteCode(codePtr); @@ -2065,7 +2065,7 @@ TEBCresume( #ifdef TCL_COMPILE_DEBUG if (!pc && (tclTraceExec >= 2)) { PrintByteCodeInfo(codePtr); - fprintf(stdout, " Starting stack top=%" TCL_Z_MODIFIER "u\n", CURR_DEPTH); + fprintf(stdout, " Starting stack top=%" TCL_T_MODIFIER "d\n", CURR_DEPTH); fflush(stdout); } #endif @@ -2124,7 +2124,7 @@ TEBCresume( * instruction. */ - TRACE_WITH_OBJ(("%" TCL_Z_MODIFIER "u => ... after \"%.20s\": TCL_OK, result=", + TRACE_WITH_OBJ(("%" TCL_SIZE_MODIFIER "d => ... after \"%.20s\": TCL_OK, result=", objc, cmdNameBuf), Tcl_GetObjResult(interp)); /* @@ -2269,7 +2269,7 @@ TEBCresume( CHECK_STACK(); if (traceInstructions) { - fprintf(stdout, "%2" TCL_Z_MODIFIER "u: %2" TCL_Z_MODIFIER "u ", iPtr->numLevels, CURR_DEPTH); + fprintf(stdout, "%2" TCL_SIZE_MODIFIER "d: %2" TCL_T_MODIFIER "d ", iPtr->numLevels, CURR_DEPTH); TclPrintInstruction(codePtr, pc); fflush(stdout); } @@ -2389,7 +2389,7 @@ TEBCresume( if (traceInstructions) { TRACE_APPEND(("YIELD...\n")); } else { - fprintf(stdout, "%" TCL_Z_MODIFIER "d: (%" TCL_T_MODIFIER "u) yielding value \"%.30s\"\n", + fprintf(stdout, "%" TCL_SIZE_MODIFIER "d: (%" TCL_T_MODIFIER "d) yielding value \"%.30s\"\n", iPtr->numLevels, (pc - codePtr->codeStart), Tcl_GetString(OBJ_AT_TOS)); } @@ -2432,7 +2432,7 @@ TEBCresume( TRACE(("[%.30s] => YIELD...\n", O2S(valuePtr))); } else { /* FIXME: What is the right thing to trace? */ - fprintf(stdout, "%" TCL_Z_MODIFIER "d: (%" TCL_T_MODIFIER "u) yielding to [%.30s]\n", + fprintf(stdout, "%" TCL_SIZE_MODIFIER "d: (%" TCL_T_MODIFIER "d) yielding to [%.30s]\n", iPtr->numLevels, (pc - codePtr->codeStart), TclGetString(valuePtr)); } @@ -2636,10 +2636,10 @@ TEBCresume( */ TclNewObj(objPtr); - objPtr->internalRep.twoPtrValue.ptr2 = UINT2PTR(CURR_DEPTH); + objPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(CURR_DEPTH); objPtr->length = 0; PUSH_TAUX_OBJ(objPtr); - TRACE(("=> mark depth as %" TCL_Z_MODIFIER "u\n", CURR_DEPTH)); + TRACE(("=> mark depth as %" TCL_T_MODIFIER "d\n", CURR_DEPTH)); NEXT_INST_F(1, 0, 0); break; @@ -2651,13 +2651,13 @@ TEBCresume( */ CLANG_ASSERT(auxObjList); - objc = CURR_DEPTH - PTR2UINT(auxObjList->internalRep.twoPtrValue.ptr2); + objc = CURR_DEPTH - PTR2INT(auxObjList->internalRep.twoPtrValue.ptr2); POP_TAUX_OBJ(); #ifdef TCL_COMPILE_DEBUG /* Ugly abuse! */ starting = 1; #endif - TRACE(("=> drop %" TCL_Z_MODIFIER "u items\n", objc)); + TRACE(("=> drop %" TCL_SIZE_MODIFIER "d items\n", objc)); NEXT_INST_V(1, objc, 0); case INST_EXPAND_STKTOP: { @@ -2758,7 +2758,7 @@ TEBCresume( case INST_INVOKE_EXPANDED: CLANG_ASSERT(auxObjList); - objc = CURR_DEPTH - PTR2UINT(auxObjList->internalRep.twoPtrValue.ptr2); + objc = CURR_DEPTH - PTR2INT(auxObjList->internalRep.twoPtrValue.ptr2); POP_TAUX_OBJ(); if (objc) { pcAdjustment = 1; @@ -2792,9 +2792,9 @@ TEBCresume( if (traceInstructions) { strncpy(cmdNameBuf, TclGetString(objv[0]), 20); - TRACE(("%" TCL_Z_MODIFIER "u => call ", objc)); + TRACE(("%" TCL_SIZE_MODIFIER "d => call ", objc)); } else { - fprintf(stdout, "%" TCL_Z_MODIFIER "d: (%" TCL_T_MODIFIER "u) invoking ", iPtr->numLevels, + fprintf(stdout, "%" TCL_SIZE_MODIFIER "d: (%" TCL_T_MODIFIER "d) invoking ", iPtr->numLevels, (pc - codePtr->codeStart)); } for (i = 0; i < objc; i++) { @@ -4439,7 +4439,7 @@ TEBCresume( if (traceInstructions) { strncpy(cmdNameBuf, TclGetString(objv[0]), 20); } else { - fprintf(stdout, "%" TCL_Z_MODIFIER "d: (%" TCL_Z_MODIFIER "u) invoking ", + fprintf(stdout, "%" TCL_SIZE_MODIFIER "d: (%" TCL_T_MODIFIER "d) invoking ", iPtr->numLevels, (size_t)(pc - codePtr->codeStart)); } @@ -4541,8 +4541,8 @@ TEBCresume( if (traceInstructions) { strncpy(cmdNameBuf, TclGetString(objv[0]), 20); } else { - fprintf(stdout, "%" TCL_Z_MODIFIER "d: (%" TCL_Z_MODIFIER "u) invoking ", - iPtr->numLevels, (size_t)(pc - codePtr->codeStart)); + fprintf(stdout, "%" TCL_SIZE_MODIFIER "d: (%" TCL_Z_MODIFIER "u) invoking ", + iPtr->numLevels, (pc - codePtr->codeStart)); } for (i = 0; i < opnd; i++) { TclPrintObject(stdout, objv[i], 15); @@ -4660,7 +4660,7 @@ TEBCresume( goto gotError; } TclNewIntObj(objResultPtr, length); - TRACE_APPEND(("%" TCL_Z_MODIFIER "u\n", length)); + TRACE_APPEND(("%" TCL_SIZE_MODIFIER "d\n", length)); NEXT_INST_F(1, 1, 1); case INST_LIST_INDEX: /* lindex with objc == 3 */ @@ -4724,7 +4724,6 @@ TEBCresume( } } - DECACHE_STACK_INFO(); objResultPtr = TclLindexList(interp, valuePtr, value2Ptr); CACHE_STACK_INFO(); @@ -5078,7 +5077,7 @@ TEBCresume( case INST_LREPLACE4: { - size_t numToDelete, numNewElems; + TCL_HASH_TYPE numToDelete, numNewElems; int end_indicator; int haveSecondIndex, flags; Tcl_Obj *fromIdxObj, *toIdxObj; @@ -6557,7 +6556,7 @@ TEBCresume( if (TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL, valuePtr, TCL_LEAVE_ERR_MSG, varIndex)==NULL){ CACHE_STACK_INFO(); - TRACE_APPEND(("ERROR init. index temp %" TCL_Z_MODIFIER "u: %.30s", + TRACE_APPEND(("ERROR init. index temp %" TCL_SIZE_MODIFIER "d: %.30s", varIndex, O2S(Tcl_GetObjResult(interp)))); goto gotError; } @@ -6604,7 +6603,7 @@ TEBCresume( tmpPtr = OBJ_AT_DEPTH(1); infoPtr = (ForeachInfo *)tmpPtr->internalRep.twoPtrValue.ptr1; numLists = infoPtr->numLists; - TRACE_APPEND(("=> appending to list at depth %" TCL_Z_MODIFIER "u\n", 3 + numLists)); + TRACE_APPEND(("=> appending to list at depth %" TCL_SIZE_MODIFIER "d\n", 3 + numLists)); objPtr = OBJ_AT_DEPTH(3 + numLists); Tcl_ListObjAppendElement(NULL, objPtr, OBJ_AT_TOS); @@ -6619,9 +6618,9 @@ TEBCresume( * stack. */ - *(++catchTop) = (Tcl_Obj *)UINT2PTR(CURR_DEPTH); - TRACE(("%u => catchTop=%" TCL_Z_MODIFIER "u, stackTop=%" TCL_Z_MODIFIER "u\n", - TclGetUInt4AtPtr(pc+1), (size_t)(catchTop - initCatchTop - 1), + *(++catchTop) = (Tcl_Obj *)INT2PTR(CURR_DEPTH); + TRACE(("%u => catchTop=%" TCL_T_MODIFIER "d, stackTop=%" TCL_T_MODIFIER "d\n", + TclGetUInt4AtPtr(pc+1), (catchTop - initCatchTop - 1), CURR_DEPTH)); NEXT_INST_F(5, 0, 0); break; @@ -7432,7 +7431,7 @@ TEBCresume( if (result == TCL_BREAK) { result = TCL_OK; pc = (codePtr->codeStart + rangePtr->breakOffset); - TRACE_APPEND(("%s, range at %" TCL_Z_MODIFIER "u, new pc %" TCL_Z_MODIFIER "u\n", + TRACE_APPEND(("%s, range at %" TCL_SIZE_MODIFIER "d, new pc %" TCL_SIZE_MODIFIER "d\n", StringForResultCode(result), rangePtr->codeOffset, rangePtr->breakOffset)); NEXT_INST_F(0, 0, 0); @@ -7444,7 +7443,7 @@ TEBCresume( } result = TCL_OK; pc = (codePtr->codeStart + rangePtr->continueOffset); - TRACE_APPEND(("%s, range at %" TCL_Z_MODIFIER "u, new pc %" TCL_Z_MODIFIER "u\n", + TRACE_APPEND(("%s, range at %" TCL_SIZE_MODIFIER "d, new pc %" TCL_SIZE_MODIFIER "d\n", StringForResultCode(result), rangePtr->codeOffset, rangePtr->continueOffset)); NEXT_INST_F(0, 0, 0); @@ -7534,8 +7533,8 @@ TEBCresume( while (auxObjList) { if ((catchTop != initCatchTop) - && (PTR2UINT(*catchTop) > - PTR2UINT(auxObjList->internalRep.twoPtrValue.ptr2))) { + && (PTR2INT(*catchTop) > + PTR2INT(auxObjList->internalRep.twoPtrValue.ptr2))) { break; } POP_TAUX_OBJ(); @@ -7610,16 +7609,16 @@ TEBCresume( */ processCatch: - while (CURR_DEPTH > PTR2UINT(*catchTop)) { + while (CURR_DEPTH > PTR2INT(*catchTop)) { valuePtr = POP_OBJECT(); TclDecrRefCount(valuePtr); } #ifdef TCL_COMPILE_DEBUG if (traceInstructions) { - fprintf(stdout, " ... found catch at %" TCL_Z_MODIFIER "u, catchTop=%" TCL_Z_MODIFIER "u, " - "unwound to %" TCL_Z_MODIFIER "u, new pc %" TCL_Z_MODIFIER "u\n", - rangePtr->codeOffset, (size_t)(catchTop - initCatchTop - 1), - PTR2UINT(*catchTop), (size_t)rangePtr->catchOffset); + fprintf(stdout, " ... found catch at %" TCL_SIZE_MODIFIER "d, catchTop=%" TCL_T_MODIFIER "d, " + "unwound to %" TCL_T_MODIFIER "d, new pc %" TCL_SIZE_MODIFIER "d\n", + rangePtr->codeOffset, (catchTop - initCatchTop - 1), + PTR2INT(*catchTop), rangePtr->catchOffset); } #endif pc = (codePtr->codeStart + rangePtr->catchOffset); @@ -7655,9 +7654,9 @@ TEBCresume( if (tosPtr < initTosPtr) { fprintf(stderr, - "\nTclNRExecuteByteCode: abnormal return at pc %" TCL_Z_MODIFIER "u: " - "stack top %" TCL_Z_MODIFIER "u < entry stack top %d\n", - (size_t)(pc - codePtr->codeStart), + "\nTclNRExecuteByteCode: abnormal return at pc %" TCL_T_MODIFIER "d: " + "stack top %" TCL_T_MODIFIER "d < entry stack top %d\n", + (pc - codePtr->codeStart), CURR_DEPTH, 0); Tcl_Panic("TclNRExecuteByteCode execution failure: end stack top < start stack top"); } @@ -9183,7 +9182,7 @@ GetSrcInfoForPc( int bestCmdIdx = -1; /* The pc must point within the bytecode */ - assert (pcOffset < codePtr->numCodeBytes); + assert ((pcOffset >= 0) && (pcOffset < codePtr->numCodeBytes)); /* * Decode the code and source offset and length for each command. The @@ -9671,7 +9670,7 @@ EvalStatsCmd( Tcl_AppendPrintfToObj(objPtr, "Total literal objects\t\t%" TCL_Z_MODIFIER "u\n", statsPtr->numLiteralsCreated); - Tcl_AppendPrintfToObj(objPtr, "\nCurrent literal objects\t\t%" TCL_Z_MODIFIER "u (%0.1f%% of current objects)\n", + Tcl_AppendPrintfToObj(objPtr, "\nCurrent literal objects\t\t%" TCL_SIZE_MODIFIER "d (%0.1f%% of current objects)\n", globalTablePtr->numEntries, Percent(globalTablePtr->numEntries, tclObjsAlloced-tclObjsFreed)); Tcl_AppendPrintfToObj(objPtr, " ByteCode literals\t\t%" TCL_Z_MODIFIER "u (%0.1f%% of current literals)\n", @@ -9763,7 +9762,7 @@ EvalStatsCmd( for (i = 0; i <= maxSizeDecade; i++) { decadeHigh = (1 << (i+1)) - 1; sum += statsPtr->literalCount[i]; - Tcl_AppendPrintfToObj(objPtr, "\t%10" TCL_Z_MODIFIER "u\t\t%8.0f%%\n", + Tcl_AppendPrintfToObj(objPtr, "\t%10" TCL_SIZE_MODIFIER "d\t\t%8.0f%%\n", decadeHigh, Percent(sum, statsPtr->numLiteralsCreated)); } @@ -9796,7 +9795,7 @@ EvalStatsCmd( for (i = minSizeDecade; i <= maxSizeDecade; i++) { decadeHigh = (1 << (i+1)) - 1; sum += statsPtr->srcCount[i]; - Tcl_AppendPrintfToObj(objPtr, "\t%10" TCL_Z_MODIFIER "u\t\t%8.0f%%\n", + Tcl_AppendPrintfToObj(objPtr, "\t%10" TCL_SIZE_MODIFIER "d\t\t%8.0f%%\n", decadeHigh, Percent(sum, statsPtr->numCompilations)); } @@ -9820,7 +9819,7 @@ EvalStatsCmd( for (i = minSizeDecade; i <= maxSizeDecade; i++) { decadeHigh = (1 << (i+1)) - 1; sum += statsPtr->byteCodeCount[i]; - Tcl_AppendPrintfToObj(objPtr, "\t%10" TCL_Z_MODIFIER "u\t\t%8.0f%%\n", + Tcl_AppendPrintfToObj(objPtr, "\t%10" TCL_SIZE_MODIFIER "d\t\t%8.0f%%\n", decadeHigh, Percent(sum, statsPtr->numCompilations)); } diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 78e87ac..fcd0842 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -537,7 +537,7 @@ declare 214 { void TclSetObjNameOfExecutable(Tcl_Obj *name, Tcl_Encoding encoding) } declare 215 { - void *TclStackAlloc(Tcl_Interp *interp, Tcl_Size numBytes) + void *TclStackAlloc(Tcl_Interp *interp, TCL_HASH_TYPE numBytes) } declare 216 { void TclStackFree(Tcl_Interp *interp, void *freePtr) diff --git a/generic/tclInt.h b/generic/tclInt.h index c92e24b..7afdd24 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -105,12 +105,6 @@ #endif /* - * Maximum *signed* value that can be stored in a Tcl_Size type. This is - * primarily used for checking overflows in dynamically allocating memory. - */ -#define TCL_SIZE_SMAX ((((Tcl_Size) 1) << ((8*(Tcl_Size)sizeof(Tcl_Size)) - 1)) - 1) - -/* * Macros used to cast between pointers and integers (e.g. when storing an int * in ClientData), on 64-bit architectures they avoid gcc warning about "cast * to/from pointer from/to integer of different size". @@ -3423,7 +3417,7 @@ MODULE_SCOPE int TclCreateSocketAddress(Tcl_Interp *interp, const char **errorMsgPtr); MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr, Tcl_ThreadCreateProc *proc, void *clientData, - size_t stackSize, int flags); + TCL_HASH_TYPE stackSize, int flags); MODULE_SCOPE Tcl_Size TclpFindVariable(const char *name, Tcl_Size *lengthPtr); MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr, TCL_HASH_TYPE *lengthPtr, Tcl_Encoding *encodingPtr); @@ -3492,7 +3486,7 @@ MODULE_SCOPE void TclSpellFix(Tcl_Interp *interp, Tcl_Obj *const *objv, Tcl_Size objc, Tcl_Size subIdx, Tcl_Obj *bad, Tcl_Obj *fix); MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr, - Tcl_Size numBytes); + TCL_HASH_TYPE numBytes); typedef int (*memCmpFn_t)(const void*, const void*, size_t); MODULE_SCOPE int TclStringCmp(Tcl_Obj *value1Ptr, Tcl_Obj *value2Ptr, int checkEq, int nocase, Tcl_Size reqlength); diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 46479fb..3dfb252 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -451,7 +451,8 @@ EXTERN Tcl_Obj * TclGetObjNameOfExecutable(void); EXTERN void TclSetObjNameOfExecutable(Tcl_Obj *name, Tcl_Encoding encoding); /* 215 */ -EXTERN void * TclStackAlloc(Tcl_Interp *interp, Tcl_Size numBytes); +EXTERN void * TclStackAlloc(Tcl_Interp *interp, + TCL_HASH_TYPE numBytes); /* 216 */ EXTERN void TclStackFree(Tcl_Interp *interp, void *freePtr); /* 217 */ @@ -803,7 +804,7 @@ typedef struct TclIntStubs { void (*tclpFindExecutable) (const char *argv0); /* 212 */ Tcl_Obj * (*tclGetObjNameOfExecutable) (void); /* 213 */ void (*tclSetObjNameOfExecutable) (Tcl_Obj *name, Tcl_Encoding encoding); /* 214 */ - void * (*tclStackAlloc) (Tcl_Interp *interp, Tcl_Size numBytes); /* 215 */ + void * (*tclStackAlloc) (Tcl_Interp *interp, TCL_HASH_TYPE numBytes); /* 215 */ void (*tclStackFree) (Tcl_Interp *interp, void *freePtr); /* 216 */ int (*tclPushStackFrame) (Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr, Tcl_Namespace *namespacePtr, int isProcCallFrame); /* 217 */ void (*tclPopStackFrame) (Tcl_Interp *interp); /* 218 */ diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 5864ebc..be807cd 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -151,7 +151,7 @@ GrowStringBuffer( if (objPtr->bytes == &tclEmptyString) { objPtr->bytes = NULL; } - /* + /* * In code below, note 'capacity' and 'needed' include terminating nul, * while stringPtr->allocated does not. */ @@ -196,7 +196,7 @@ GrowUnicodeBuffer( maxChars -= 1; /* End nul not included */ } else { - /* + /* * First allocation - just big enough. Note needed does * not include terminating nul but STRING_SIZE does */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index b4189fd..5426bdf 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1042,10 +1042,10 @@ TclScanElement( * needs protection or escape. */ int requireEscape = 0; /* Force use of CONVERT_ESCAPE mode. For some * reason bare or brace-quoted form fails. */ - int extra = 0; /* Count of number of extra bytes needed for + Tcl_Size extra = 0; /* Count of number of extra bytes needed for * formatted element, assuming we use escape * sequences in formatting. */ - TCL_HASH_TYPE bytesNeeded; /* Buffer length computed to complete the + Tcl_Size bytesNeeded; /* Buffer length computed to complete the * element formatting in the selected mode. */ #if COMPAT int preferEscape = 0; /* Use preferences to track whether to use */ diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index 78aa8ec..c658d71 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -1271,7 +1271,7 @@ proc output-directive {line} { ## proc merge-copyrights {l1 l2} { set merge {} - set re1 {^Copyright +(?:\(c\)|\\\(co|©) +(\w.*?)(?:all rights reserved)?(?:\. )*$} + set re1 {^Copyright +(?:\(c\)|\\\(co|©|©) +(\w.*?)(?:all rights reserved)?(?:\. )*$} set re2 {^(\d+) +(?:by +)?(\w.*)$} ;# date who set re3 {^(\d+)-(\d+) +(?:by +)?(\w.*)$} ;# from to who set re4 {^(\d+), *(\d+) +(?:by +)?(\w.*)$} ;# date1 date2 who diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index f4466b5..7c45fa9 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -29,7 +29,7 @@ set ::CSSFILE "docs.css" ## Source the utility functions that provide most of the ## implementation of the transformation from nroff to html. ## -source [file join [file dirname [info script]] tcltk-man2html-utils.tcl] +source -encoding utf-8 [file join [file dirname [info script]] tcltk-man2html-utils.tcl] proc getversion {tclh {name {}}} { if {[file exists $tclh]} { diff --git a/unix/Makefile.in b/unix/Makefile.in index b0d6e83..5b6c542 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -2450,7 +2450,7 @@ html-tk: ${NATIVE_TCLSH} @EXTRA_BUILD_HTML@ BUILD_HTML = \ - @${NATIVE_TCLSH} $(TOOL_DIR)/tcltk-man2html.tcl \ + @${NATIVE_TCLSH} -encoding utf-8 $(TOOL_DIR)/tcltk-man2html.tcl \ --useversion=$(MAJOR_VERSION).$(MINOR_VERSION) \ --htmldir="$(HTML_INSTALL_DIR)" \ --srcdir=$(TOP_DIR) $(BUILD_HTML_FLAGS) diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index cf3b7a1..5d357c9 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -214,7 +214,7 @@ TclpThreadCreate( Tcl_ThreadId *idPtr, /* Return, the ID of the thread */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread */ void *clientData, /* The one argument to Main() */ - size_t stackSize, /* Size of stack for the new thread */ + TCL_HASH_TYPE stackSize, /* Size of stack for the new thread */ int flags) /* Flags controlling behaviour of the new * thread. */ { @@ -228,7 +228,7 @@ TclpThreadCreate( #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE if (stackSize != TCL_THREAD_STACK_DEFAULT) { - pthread_attr_setstacksize(&attr, stackSize); + pthread_attr_setstacksize(&attr, (size_t)stackSize); #ifdef TCL_THREAD_STACK_MIN } else { /* @@ -247,7 +247,7 @@ TclpThreadCreate( result = pthread_attr_getstacksize(&attr, &size); if (!result && (size < TCL_THREAD_STACK_MIN)) { - pthread_attr_setstacksize(&attr, (size_t) TCL_THREAD_STACK_MIN); + pthread_attr_setstacksize(&attr, (size_t)TCL_THREAD_STACK_MIN); } #endif /* TCL_THREAD_STACK_MIN */ } diff --git a/win/Makefile.in b/win/Makefile.in index edfda72..2bde8b6 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -1010,7 +1010,7 @@ runtest: tcltest # `make shell SCRIPT=foo.tcl` shell: binaries @TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \ - $(WINE) ./$(TCLSH) $(SCRIPT) + $(WINE) ./$(TCLSH) -encoding utf-8 $(SCRIPT) # This target can be used to run tclsh inside either gdb or insight gdb: binaries diff --git a/win/makefile.vc b/win/makefile.vc index 4333a2a..ceb2903e 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -677,7 +677,7 @@ CHMFILE=$(HTMLDIR)\$(HTMLBASE).chm htmlhelp: chmsetup $(CHMFILE)
$(CHMFILE): $(DOCDIR)\*
- @$(TCLSH) $(TOOLSDIR)\tcltk-man2html.tcl "--htmldir=$(HTMLDIR)"
+ @$(TCLSH) -encoding utf-8 $(TOOLSDIR)\tcltk-man2html.tcl "--htmldir=$(HTMLDIR)"
@echo Compiling HTML help project
-"$(HHC)" <<$(HHPFILE) >NUL
[OPTIONS]
diff --git a/win/tclWinDde.c b/win/tclWinDde.c index 697aae6..3377bfa 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -313,12 +313,12 @@ DdeSetServerName( Tcl_Obj *handlerPtr) /* Name of the optional proc/command to handle * incoming Dde eval's */ { - int suffix, offset; + int suffix; RegisteredInterp *riPtr, *prevPtr; Tcl_DString dString; const WCHAR *actualName; Tcl_Obj *srvListPtr = NULL, **srvPtrPtr = NULL; - Tcl_Size n, srvCount = 0; + Tcl_Size n, srvCount = 0, offset; int lastSuffix, r = TCL_OK; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); @@ -942,8 +942,8 @@ DdeServerProc( */ HSZPAIR *returnPtr; - int i; - int numItems; + Tcl_Size i; + DWORD numItems; for (i = 0, riPtr = tsdPtr->interpListPtr; riPtr != NULL; i++, riPtr = riPtr->nextPtr) { @@ -952,12 +952,15 @@ DdeServerProc( */ } - numItems = i; + if ((size_t)i >= UINT_MAX/sizeof(HSZPAIR)) { + return NULL; + } + numItems = (DWORD)i; ddeReturn = DdeCreateDataHandle(ddeInstance, NULL, - (numItems + 1) * sizeof(HSZPAIR), 0, 0, 0, 0); + (numItems + 1) * (DWORD)sizeof(HSZPAIR), 0, 0, 0, 0); returnPtr = (HSZPAIR *) DdeAccessData(ddeReturn, &dlen); len = dlen; - for (i = 0, riPtr = tsdPtr->interpListPtr; i < numItems; + for (i = 0, riPtr = tsdPtr->interpListPtr; i < (Tcl_Size)numItems; i++, riPtr = riPtr->nextPtr) { returnPtr[i].hszSvc = DdeCreateStringHandleW(ddeInstance, TCL_DDE_SERVICE_NAME, CP_WINUNICODE); @@ -1645,7 +1648,7 @@ DdeObjCmd( if ((tmp >= sizeof(WCHAR)) && !dataString[tmp / sizeof(WCHAR) - 1]) { - tmp -= sizeof(WCHAR); + tmp -= (DWORD)sizeof(WCHAR); } Tcl_DStringInit(&dsBuf); Tcl_WCharToUtfDString(dataString, tmp>>1, &dsBuf); diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index ecc592b..c7f0ba7 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -204,7 +204,7 @@ TclpThreadCreate( Tcl_ThreadId *idPtr, /* Return, the ID of the thread. */ Tcl_ThreadCreateProc *proc, /* Main() function of the thread. */ void *clientData, /* The one argument to Main(). */ - size_t stackSize, /* Size of stack for the new thread. */ + TCL_HASH_TYPE stackSize, /* Size of stack for the new thread. */ int flags) /* Flags controlling behaviour of the new * thread. */ { @@ -223,11 +223,11 @@ TclpThreadCreate( */ #if defined(_MSC_VER) || defined(__MSVCRT__) - tHandle = (HANDLE) _beginthreadex(NULL, (unsigned) stackSize, + tHandle = (HANDLE) _beginthreadex(NULL, (unsigned)stackSize, (Tcl_ThreadCreateProc*) TclWinThreadStart, winThreadPtr, 0, (unsigned *)idPtr); #else - tHandle = CreateThread(NULL, (DWORD) stackSize, + tHandle = CreateThread(NULL, (DWORD)stackSize, TclWinThreadStart, winThreadPtr, 0, (LPDWORD)idPtr); #endif @@ -725,7 +725,7 @@ Tcl_ConditionWait( if (timePtr == NULL) { wtime = INFINITE; } else { - wtime = (DWORD)timePtr->sec * 1000 + (unsigned long)timePtr->usec / 1000; + wtime = (DWORD)timePtr->sec * 1000 + (DWORD)timePtr->usec / 1000; } /* |