diff options
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | generic/tclInt.decls | 22 | ||||
-rw-r--r-- | generic/tclInt.h | 447 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 14 | ||||
-rw-r--r-- | generic/tclPort.h | 14 | ||||
-rw-r--r-- | generic/tclTest.c | 10 | ||||
-rw-r--r-- | win/.cvsignore | 42 | ||||
-rw-r--r-- | win/cat.c | 10 | ||||
-rw-r--r-- | win/tclWinDde.c | 3 | ||||
-rw-r--r-- | win/tclWinError.c | 6 | ||||
-rw-r--r-- | win/tclWinFile.c | 32 | ||||
-rw-r--r-- | win/tclWinPipe.c | 12 | ||||
-rw-r--r-- | win/tclWinPort.h | 45 | ||||
-rw-r--r-- | win/tclWinReg.c | 31 | ||||
-rw-r--r-- | win/tclWinSerial.c | 18 | ||||
-rw-r--r-- | win/tclWinSock.c | 6 | ||||
-rw-r--r-- | win/tclWinTest.c | 4 | ||||
-rw-r--r-- | win/tclWinThrd.c | 28 |
18 files changed, 409 insertions, 357 deletions
@@ -1,3 +1,22 @@ +2010-02-01 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclInt.decls Various CYGWIN-related fixes + * generic/tclInt.h backported from HEAD. Still + * generic/tclIntPlatDecls.h configure script not modified, + * generic/tclPort.h so CYGWIN build is still + * generic/tclTest/c disabled. Reason: although the + * win/cat.c build succeeds with those changes, + * win/tclWinDde.c many tests still fail. + * win/tclWinError.c + * win/tclWinFile.c + * win/tclWinPipe.c + * win/tclWinPort.h + * win/tclWinReg.c + * win/tclWinSerial.c + * win/tclWinSock.c + * win/tclWinTest.c + * win/tclWinThrd.c + 2010-01-29 Jan Nijtmans <nijtmans@users.sf.net> * generic/tcl.h Use correct TCL_LL_MODIFIER for CYGWIN. @@ -28,6 +47,7 @@ internal representation when not needed. Thanks to Alexandre Ferrieux for this fix. +>>>>>>> 1.3975.2.291 2010-01-06 Jan Nijtmans <nijtmans@users.sf.net> * generic/tclCompExpr.c: Warning: array subscript has type 'char' @@ -159,7 +179,7 @@ 2009-11-16 Alexandre Ferrieux <ferrieux@users.sourceforge.net> * generic/tclEncoding.c: Fix [Bug 2891556] and improve test to detect - * tests/econding.test: similar manifestations in the future. + * tests/decoding.test: similar manifestations in the future. 2009-11-12 Don Porter <dgp@users.sourceforge.net> diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 07e7ddb..182fd75 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -13,10 +13,10 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tclInt.decls,v 1.121.2.2 2009/10/18 11:21:38 mistachkin Exp $ +# RCS: @(#) $Id: tclInt.decls,v 1.121.2.3 2010/01/31 23:51:36 nijtmans Exp $ library tcl - + # Define the unsupported generic interfaces. interface tclInt @@ -644,7 +644,7 @@ declare 162 generic { void TclChannelEventScriptInvoker(ClientData clientData, int flags) } -# ALERT: The result of 'TclGetInstructionTable' is actually an +# ALERT: The result of 'TclGetInstructionTable' is actually a # "InstructionDesc*" but we do not want to describe this structure in # "tclInt.h". It is described in "tclCompile.h". Use a cast to the # correct type when calling this procedure. @@ -870,7 +870,7 @@ declare 216 generic { } declare 217 generic { int TclPushStackFrame(Tcl_Interp *interp, Tcl_CallFrame **framePtrPtr, - Tcl_Namespace *namespacePtr, int isProcCallFrame ) + Tcl_Namespace *namespacePtr, int isProcCallFrame) } declare 218 generic { void TclPopStackFrame(Tcl_Interp *interp) @@ -930,6 +930,7 @@ declare 235 generic { } +# TIP 337 made this one public declare 236 generic { void TclBackgroundException(Tcl_Interp *interp, int code) } @@ -950,10 +951,10 @@ interface tclIntPlat # Windows specific functions declare 0 win { - void TclWinConvertError(DWORD errCode) + void TclWinConvertError(unsigned long errCode) } declare 1 win { - void TclWinConvertWSAError(DWORD errCode) + void TclWinConvertWSAError(unsigned long errCode) } declare 2 win { struct servent *TclWinGetServByName(CONST char *nm, @@ -1022,7 +1023,7 @@ declare 19 win { TclFile TclpOpenFile(CONST char *fname, int mode) } declare 20 win { - void TclWinAddProcess(HANDLE hProcess, DWORD id) + void TclWinAddProcess(void *hProcess, unsigned long id) } # removed permanently for 8.4 @@ -1060,7 +1061,7 @@ declare 28 win { void TclWinResetInterfaces(void) } declare 29 win { - int TclWinCPUID( unsigned int index, unsigned int *regs ) + int TclWinCPUID(unsigned int index, unsigned int *regs) } ################################ @@ -1153,3 +1154,8 @@ declare 18 macosx { declare 19 macosx { void TclMacOSXNotifierAddRunLoopMode(CONST void *runLoopMode) } + + +# Local Variables: +# mode: tcl +# End: diff --git a/generic/tclInt.h b/generic/tclInt.h index 10da682..9aa4da2 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -13,14 +13,14 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.362.2.10 2009/10/18 11:21:38 mistachkin Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.362.2.11 2010/01/31 23:51:36 nijtmans Exp $ */ #ifndef _TCLINT #define _TCLINT /* - * Some numerics configuration options + * Some numerics configuration options. */ #undef NO_WIDE_TYPE @@ -35,12 +35,7 @@ * declaration in tcl.h is needed by stdlib.h in some configurations. */ -#ifdef HAVE_TCL_CONFIG_H -#include "tclConfig.h" -#endif -#ifndef _TCL -#include "tcl.h" -#endif +#include "tclPort.h" #include <stdio.h> @@ -121,19 +116,19 @@ typedef int ptrdiff_t; #if !defined(INT2PTR) && !defined(PTR2INT) # if defined(HAVE_INTPTR_T) || defined(intptr_t) -# define INT2PTR(p) ((void*)(intptr_t)(p)) +# define INT2PTR(p) ((void *)(intptr_t)(p)) # define PTR2INT(p) ((int)(intptr_t)(p)) # else -# define INT2PTR(p) ((void*)(p)) +# define INT2PTR(p) ((void *)(p)) # define PTR2INT(p) ((int)(p)) # endif #endif #if !defined(UINT2PTR) && !defined(PTR2UINT) # if defined(HAVE_UINTPTR_T) || defined(uintptr_t) -# define UINT2PTR(p) ((void*)(uintptr_t)(p)) +# define UINT2PTR(p) ((void *)(uintptr_t)(p)) # define PTR2UINT(p) ((unsigned int)(uintptr_t)(p)) # else -# define UINT2PTR(p) ((void*)(p)) +# define UINT2PTR(p) ((void *)(p)) # define PTR2UINT(p) ((unsigned int)(p)) # endif #endif @@ -161,14 +156,14 @@ typedef struct Tcl_ResolvedVarInfo { Tcl_ResolveVarDeleteProc *deleteProc; } Tcl_ResolvedVarInfo; -typedef int (Tcl_ResolveCompiledVarProc) (Tcl_Interp *interp, +typedef int (Tcl_ResolveCompiledVarProc)(Tcl_Interp *interp, CONST84 char *name, int length, Tcl_Namespace *context, Tcl_ResolvedVarInfo **rPtr); -typedef int (Tcl_ResolveVarProc) (Tcl_Interp *interp, CONST84 char *name, +typedef int (Tcl_ResolveVarProc)(Tcl_Interp *interp, CONST84 char *name, Tcl_Namespace *context, int flags, Tcl_Var *rPtr); -typedef int (Tcl_ResolveCmdProc) (Tcl_Interp *interp, CONST84 char *name, +typedef int (Tcl_ResolveCmdProc)(Tcl_Interp *interp, CONST84 char *name, Tcl_Namespace *context, int flags, Tcl_Command *rPtr); typedef struct Tcl_ResolverInfo { @@ -273,9 +268,9 @@ typedef struct Namespace { * is currently allocated. */ int cmdRefEpoch; /* Incremented if a newly added command * shadows a command for which this namespace - * has already cached a Command * pointer; - * this causes all its cached Command* - * pointers to be invalidated. */ + * has already cached a Command* pointer; this + * causes all its cached Command* pointers to + * be invalidated. */ int resolverEpoch; /* Incremented whenever (a) the name * resolution rules change for this namespace * or (b) a newly added command shadows a @@ -365,7 +360,7 @@ struct NamespacePathEntry { #define NS_DYING 0x01 #define NS_DEAD 0x02 -#define NS_KILLED 0x04 +#define NS_KILLED 0x04 /* * Flags passed to TclGetNamespaceForQualName: @@ -584,8 +579,8 @@ typedef struct VarInHash { * local variable that was assigned a slot in a * procedure frame by the compiler so the Var * storage is part of the call frame. - * VAR_DEAD_HASH 1 means that this var's entry in the hashtable - * has already been deleted. + * VAR_DEAD_HASH 1 means that this var's entry in the hashtable + * has already been deleted. * VAR_ARRAY_ELEMENT - 1 means that this variable is an array * element, so it is not legal for it to be an * array itself (the VAR_ARRAY flag had better @@ -622,8 +617,8 @@ typedef struct VarInHash { * name. * VAR_RESOLVED - 1 if name resolution has been done for this * variable. - * VAR_IS_ARGS 1 if this variable is the last argument and is - * named "args". + * VAR_IS_ARGS 1 if this variable is the last argument and is + * named "args". */ /* @@ -636,35 +631,33 @@ typedef struct VarInHash { * in precompiled scripts keep working. */ - /* Type of value (0 is scalar) */ #define VAR_ARRAY 0x1 #define VAR_LINK 0x2 /* Type of storage (0 is compiled local) */ #define VAR_IN_HASHTABLE 0x4 -#define VAR_DEAD_HASH 0x8 +#define VAR_DEAD_HASH 0x8 #define VAR_ARRAY_ELEMENT 0x1000 -#define VAR_NAMESPACE_VAR 0x80 /* KEEP OLD VALUE for Itcl */ +#define VAR_NAMESPACE_VAR 0x80 /* KEEP OLD VALUE for Itcl */ #define VAR_ALL_HASH \ (VAR_IN_HASHTABLE|VAR_DEAD_HASH|VAR_NAMESPACE_VAR|VAR_ARRAY_ELEMENT) -/* Trace and search state */ +/* Trace and search state. */ -#define VAR_TRACED_READ 0x10 /* TCL_TRACE_READS */ -#define VAR_TRACED_WRITE 0x20 /* TCL_TRACE_WRITES */ -#define VAR_TRACED_UNSET 0x40 /* TCL_TRACE_UNSETS */ -#define VAR_TRACED_ARRAY 0x800 /* TCL_TRACE_ARRAY */ -#define VAR_TRACE_ACTIVE 0x2000 -#define VAR_SEARCH_ACTIVE 0x4000 +#define VAR_TRACED_READ 0x10 /* TCL_TRACE_READS */ +#define VAR_TRACED_WRITE 0x20 /* TCL_TRACE_WRITES */ +#define VAR_TRACED_UNSET 0x40 /* TCL_TRACE_UNSETS */ +#define VAR_TRACED_ARRAY 0x800 /* TCL_TRACE_ARRAY */ +#define VAR_TRACE_ACTIVE 0x2000 +#define VAR_SEARCH_ACTIVE 0x4000 #define VAR_ALL_TRACES \ (VAR_TRACED_READ|VAR_TRACED_WRITE|VAR_TRACED_ARRAY|VAR_TRACED_UNSET) - -/* Special handling on initialisation (only CompiledLocal) */ -#define VAR_ARGUMENT 0x100 /* KEEP OLD VALUE! See tclProc.c */ -#define VAR_TEMPORARY 0x200 /* KEEP OLD VALUE! See tclProc.c */ +/* Special handling on initialisation (only CompiledLocal). */ +#define VAR_ARGUMENT 0x100 /* KEEP OLD VALUE! See tclProc.c */ +#define VAR_TEMPORARY 0x200 /* KEEP OLD VALUE! See tclProc.c */ #define VAR_IS_ARGS 0x400 #define VAR_RESOLVED 0x8000 @@ -761,7 +754,7 @@ typedef struct VarInHash { ((varPtr)->flags & VAR_TRACE_ACTIVE) #define TclIsVarTraced(varPtr) \ - ((varPtr)->flags & VAR_ALL_TRACES) + ((varPtr)->flags & VAR_ALL_TRACES) #define TclIsVarInHash(varPtr) \ ((varPtr)->flags & VAR_IN_HASHTABLE) @@ -771,14 +764,14 @@ typedef struct VarInHash { #define TclGetVarNsPtr(varPtr) \ (TclIsVarInHash(varPtr) \ - ? ((TclVarHashTable *) ((((VarInHash *) (varPtr))->entry.tablePtr)))->nsPtr \ - : NULL) + ? ((TclVarHashTable *) ((((VarInHash *) (varPtr))->entry.tablePtr)))->nsPtr \ + : NULL) #define VarHashRefCount(varPtr) \ ((VarInHash *) (varPtr))->refCount /* - * Macros for direct variable access by TEBC + * Macros for direct variable access by TEBC. */ #define TclIsVarDirectReadable(varPtr) \ @@ -794,16 +787,15 @@ typedef struct VarInHash { #define TclIsVarDirectReadable2(varPtr, arrayPtr) \ (TclIsVarDirectReadable(varPtr) &&\ - (!(arrayPtr) || !((arrayPtr)->flags & VAR_TRACED_READ))) + (!(arrayPtr) || !((arrayPtr)->flags & VAR_TRACED_READ))) #define TclIsVarDirectWritable2(varPtr, arrayPtr) \ (TclIsVarDirectWritable(varPtr) &&\ - (!(arrayPtr) || !((arrayPtr)->flags & VAR_TRACED_WRITE))) + (!(arrayPtr) || !((arrayPtr)->flags & VAR_TRACED_WRITE))) #define TclIsVarDirectModifyable2(varPtr, arrayPtr) \ (TclIsVarDirectModifyable(varPtr) &&\ - (!(arrayPtr) || !((arrayPtr)->flags & (VAR_TRACED_READ|VAR_TRACED_WRITE)))) - + (!(arrayPtr) || !((arrayPtr)->flags & (VAR_TRACED_READ|VAR_TRACED_WRITE)))) /* *---------------------------------------------------------------- @@ -917,9 +909,9 @@ typedef struct Trace { ClientData clientData; /* Arbitrary value to pass to proc. */ struct Trace *nextPtr; /* Next in list of traces for this interp. */ int flags; /* Flags governing the trace - see - * Tcl_CreateObjTrace for details */ - Tcl_CmdObjTraceDeleteProc* delProc; - /* Procedure to call when trace is deleted */ + * Tcl_CreateObjTrace for details. */ + Tcl_CmdObjTraceDeleteProc *delProc; + /* Procedure to call when trace is deleted. */ } Trace; /* @@ -952,8 +944,8 @@ typedef struct ActiveInterpTrace { * TCL_TRACE_LEAVE_EXEC - triggers leave/leavestep traces. * - passed to Tcl_CreateObjTrace to set up * "leavestep" traces. - * */ + #define TCL_TRACE_ENTER_EXEC 1 #define TCL_TRACE_LEAVE_EXEC 2 @@ -1034,7 +1026,7 @@ typedef struct CallFrame { * (local variables assigned entries ["slots"] * in the compiledLocals array below). */ TclVarHashTable *varTablePtr; - /* Hash table containing local variables not + /* Hash table containing local variables not * recognized by the compiler, or created at * execution time through, e.g., upvar. * Initially NULL and created if needed. */ @@ -1056,7 +1048,7 @@ typedef struct CallFrame { LocalCache *localCachePtr; } CallFrame; -#define FRAME_IS_PROC 0x1 +#define FRAME_IS_PROC 0x1 #define FRAME_IS_LAMBDA 0x2 /* @@ -1083,15 +1075,13 @@ typedef struct CmdFrame { */ int type; /* Values see below. */ - int level; /* #Frames in stack, prevent O(n) scan of - * list. */ + 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; - CallFrame *framePtr; /* Procedure activation record, may be * NULL. */ - struct CmdFrame *nextPtr; /* Link to calling frame */ - + struct CmdFrame *nextPtr; /* Link to calling frame. */ /* * Data needed for Eval vs TEBC * @@ -1128,30 +1118,33 @@ typedef struct CmdFrame { * in. */ } eval; struct { - const void *codePtr;/* Byte code currently executed */ - const char *pc; /* and instruction pointer. */ + const void *codePtr;/* Byte code currently executed... */ + const char *pc; /* ... and instruction pointer. */ } tebc; } data; union { struct { - const char *cmd; /* The executed command, if possible */ - int len; /* And its length */ + const char *cmd; /* The executed command, if possible... */ + int len; /* ... and its length. */ } str; - Tcl_Obj *listPtr; /* Tcl_EvalObjEx, cmd list */ + Tcl_Obj *listPtr; /* Tcl_EvalObjEx, cmd list. */ } cmd; } CmdFrame; typedef struct CFWord { - CmdFrame* framePtr; /* CmdFrame to acess */ - int word; /* Index of the word in the command */ - int refCount; /* #times the word is on the stack */ + CmdFrame *framePtr; /* CmdFrame to access. */ + int word; /* Index of the word in the command. */ + int refCount; /* Number of times the word is on the + * stack. */ } CFWord; typedef struct CFWordBC { - CmdFrame* framePtr; /* CmdFrame to acess */ - int pc; /* Instruction pointer of a command in ExtCmdLoc.loc[.] */ - int word; /* Index of word in ExtCmdLoc.loc[cmd]->line[.] */ - struct CFWordBC* prevPtr; + CmdFrame *framePtr; /* CmdFrame to access. */ + int pc; /* Instruction pointer of a command in + * ExtCmdLoc.loc[.] */ + int word; /* Index of word in + * ExtCmdLoc.loc[cmd]->line[.] */ + struct CFWordBC *prevPtr; /* Previous entry in stack for same Tcl_Obj. */ } CFWordBC; /* @@ -1172,16 +1165,17 @@ typedef struct CFWordBC { * the function TclThreadFinalizeObjects(), in the same file. */ -#define CLL_END (-1) +#define CLL_END (-1) typedef struct ContLineLoc { - int num; /* Number of entries in loc, not counting the final -1 - * marker entry */ - int loc[1]; /* Table of locations, as character offsets. The table - * is allocated as part of the structure, i.e. the loc - * array extends behind the nominal end of the - * structure. An entry containing the value -1 is put - * after the last location, as end-marker/sentinel. */ + int num; /* Number of entries in loc, not counting the + * final -1 marker entry. */ + int loc[1]; /* Table of locations, as character offsets. + * The table is allocated as part of the + * structure, extending behind the nominal end + * of the structure. An entry containing the + * value -1 is put after the last location, as + * end-marker/sentinel. */ } ContLineLoc; /* @@ -1202,16 +1196,15 @@ typedef struct ContLineLoc { * types, per the context of the byte code in execution. */ -#define TCL_LOCATION_EVAL (0) /* Location in a dynamic eval script */ -#define TCL_LOCATION_EVAL_LIST (1) /* Location in a dynamic eval script, - * list-path */ -#define TCL_LOCATION_BC (2) /* Location in byte code */ -#define TCL_LOCATION_PREBC (3) /* Location in precompiled byte code, no - * location */ -#define TCL_LOCATION_SOURCE (4) /* Location in a file */ -#define TCL_LOCATION_PROC (5) /* Location in a dynamic proc */ - -#define TCL_LOCATION_LAST (6) /* Number of values in the enum */ +#define TCL_LOCATION_EVAL (0) /* Location in a dynamic eval script. */ +#define TCL_LOCATION_EVAL_LIST (1) /* Location in a dynamic eval script, + * list-path. */ +#define TCL_LOCATION_BC (2) /* Location in byte code. */ +#define TCL_LOCATION_PREBC (3) /* Location in precompiled byte code, no + * location. */ +#define TCL_LOCATION_SOURCE (4) /* Location in a file. */ +#define TCL_LOCATION_PROC (5) /* Location in a dynamic proc. */ +#define TCL_LOCATION_LAST (6) /* Number of values in the enum. */ /* * Structure passed to describe procedure-like "procedures" that are not @@ -1272,7 +1265,6 @@ MODULE_SCOPE void TclThreadDataKeySet(Tcl_ThreadDataKey *keyPtr, #define TCL_TSD_INIT(keyPtr) \ (ThreadSpecificData *)Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData)) - /* *---------------------------------------------------------------- * Data structures related to bytecode compilation and execution. These are @@ -1310,7 +1302,7 @@ struct CompileEnv; #define TCL_OUT_LINE_COMPILE TCL_ERROR -typedef int (CompileProc) (Tcl_Interp *interp, Tcl_Parse *parsePtr, +typedef int (CompileProc)(Tcl_Interp *interp, Tcl_Parse *parsePtr, struct Command *cmdPtr, struct CompileEnv *compEnvPtr); /* @@ -1318,7 +1310,7 @@ typedef int (CompileProc) (Tcl_Interp *interp, Tcl_Parse *parsePtr, * SetByteCodeFromAny. */ -typedef int (CompileHookProc) (Tcl_Interp *interp, +typedef int (CompileHookProc)(Tcl_Interp *interp, struct CompileEnv *compEnvPtr, ClientData clientData); /* @@ -1437,7 +1429,8 @@ typedef struct ByteCodeStats { /* * Structure used in implementation of those core ensembles which are - * partially compiled. + * partially compiled. Used as an array of these, with a terminating field + * whose 'name' is NULL. */ typedef struct { @@ -1559,9 +1552,9 @@ typedef struct Command { * (these last two flags are defined in tcl.h) */ -#define CMD_IS_DELETED 0x1 -#define CMD_TRACE_ACTIVE 0x2 -#define CMD_HAS_EXEC_TRACES 0x4 +#define CMD_IS_DELETED 0x1 +#define CMD_TRACE_ACTIVE 0x2 +#define CMD_HAS_EXEC_TRACES 0x4 /* *---------------------------------------------------------------- @@ -1648,7 +1641,8 @@ typedef struct Interp { int errorLine; /* When TCL_ERROR is returned, this gives the * line number in the command where the error * occurred (1 means first line). */ - struct TclStubs *stubTable; /* Pointer to the exported Tcl stub table. On + struct TclStubs *stubTable; + /* Pointer to the exported Tcl stub table. On * previous versions of Tcl this is a pointer * to the objResultPtr or a pointer to a * buckets array in a hash table. We therefore @@ -1690,10 +1684,11 @@ typedef struct Interp { ActiveVarTrace *activeVarTracePtr; /* First in list of active traces for interp, * or NULL if no active traces. */ - int returnCode; /* [return -code] parameter */ - CallFrame *rootFramePtr; /* Global frame pointer for this interpreter */ + int returnCode; /* [return -code] parameter. */ + CallFrame *rootFramePtr; /* Global frame pointer for this + * interpreter. */ Namespace *lookupNsPtr; /* Namespace to use ONLY on the next - * TCL_EVAL_INVOKE call to Tcl_EvalObjv */ + * TCL_EVAL_INVOKE call to Tcl_EvalObjv. */ /* * Information used by Tcl_AppendResult to keep track of partial results. @@ -1773,7 +1768,7 @@ typedef struct Interp { Tcl_Obj *objResultPtr; /* If the last command returned an object * result, this points to it. Should not be * accessed directly; see comment above. */ - Tcl_ThreadId threadId; /* ID of thread that owns the interpreter */ + Tcl_ThreadId threadId; /* ID of thread that owns the interpreter. */ ActiveCommandTrace *activeCmdTracePtr; /* First in list of active command traces for @@ -1782,19 +1777,22 @@ typedef struct Interp { /* First in list of active traces for interp, * or NULL if no active traces. */ - int tracesForbiddingInline; /* Count of traces (in the list headed by + int tracesForbiddingInline; /* Count of traces (in the list headed by * tracePtr) that forbid inline bytecode - * compilation */ + * compilation. */ + + /* + * Fields used to manage extensible return options (TIP 90). + */ - /* Fields used to manage extensible return options (TIP 90) */ Tcl_Obj *returnOpts; /* A dictionary holding the options to the - * last [return] command */ + * last [return] command. */ - Tcl_Obj *errorInfo; /* errorInfo value (now as a Tcl_Obj) */ - Tcl_Obj *eiVar; /* cached ref to ::errorInfo variable */ - Tcl_Obj *errorCode; /* errorCode value (now as a Tcl_Obj) */ - Tcl_Obj *ecVar; /* cached ref to ::errorInfo variable */ - int returnLevel; /* [return -level] parameter */ + Tcl_Obj *errorInfo; /* errorInfo value (now as a Tcl_Obj). */ + Tcl_Obj *eiVar; /* cached ref to ::errorInfo variable. */ + Tcl_Obj *errorCode; /* errorCode value (now as a Tcl_Obj). */ + Tcl_Obj *ecVar; /* cached ref to ::errorInfo variable. */ + int returnLevel; /* [return -level] parameter. */ /* * Resource limiting framework support (TIP#143). @@ -1852,7 +1850,7 @@ typedef struct Interp { } ensembleRewrite; /* - * TIP #219 ... Global info for the I/O system ... + * TIP #219: Global info for the I/O system. */ Tcl_Obj *chanMsg; /* Error message set by channel drivers, for @@ -1861,15 +1859,18 @@ typedef struct Interp { * NULL), takes precedence over a POSIX error * code returned by a channel operation. */ - /* TIP #280 */ - CmdFrame *cmdFramePtr; /* Points to the command frame containing - * the location information for the current + /* + * Source code origin information (TIP #280). + */ + + CmdFrame *cmdFramePtr; /* Points to the command frame containing the + * location information for the current * command. */ const CmdFrame *invokeCmdFramePtr; /* Points to the command frame which is the * invoking context of the bytecode compiler. * NULL when the byte code compiler is not - * active */ + * active. */ int invokeWord; /* Index of the word in the command which * is getting compiled. */ Tcl_HashTable *linePBodyPtr;/* This table remembers for each statically @@ -1881,9 +1882,10 @@ typedef struct Interp { * object the location information for its * body. It is keyed by the address of the * Proc structure for a procedure. The values - * are "struct ExtCmdLoc*" (See tclCompile.h) */ - Tcl_HashTable* lineLABCPtr; - Tcl_HashTable* lineLAPtr; /* This table remembers for each argument of a + * are "struct ExtCmdLoc*". (See + * tclCompile.h) */ + Tcl_HashTable *lineLABCPtr; + Tcl_HashTable *lineLAPtr; /* This table remembers for each argument of a * command on the execution stack the index of * the argument in the command, and the * location data of the command. It is keyed @@ -1896,8 +1898,7 @@ typedef struct Interp { * invoking command. Alt view: An index to the * CmdFrame stack keyed by command argument * holders. */ - ContLineLoc* scriptCLLocPtr; - /* This table points to the location data for + ContLineLoc *scriptCLLocPtr;/* This table points to the location data for * invisible continuation lines in the script, * if any. This pointer is set by the function * TclEvalObjEx() in file "tclBasic.c", and @@ -1914,13 +1915,13 @@ typedef struct Interp { int packagePrefer; /* Current package selection mode. */ /* - * Hashtables for variable traces and searches + * Hashtables for variable traces and searches. */ Tcl_HashTable varTraces; /* Hashtable holding the start of a variable's * active trace list; varPtr is the key. */ Tcl_HashTable varSearches; /* Hashtable holding the start of a variable's - * active searches list; varPtr is the key */ + * active searches list; varPtr is the key. */ /* * The thread-specific data ekeko: cache pointers or values that * (a) do not change during the thread's lifetime @@ -1965,7 +1966,6 @@ typedef struct Interp { #define TclAsyncReady(iPtr) \ *((iPtr)->asyncReadyPtr) - /* * General list of interpreters. Doubly linked for easier removal of items * deep in the list. @@ -2013,8 +2013,8 @@ typedef struct InterpList { */ #define TCL_ALLOW_EXCEPTIONS 4 -#define TCL_EVAL_FILE 2 -#define TCL_EVAL_CTX 8 +#define TCL_EVAL_FILE 2 +#define TCL_EVAL_CTX 8 /* * Flag bits for Interp structures: @@ -2050,14 +2050,14 @@ typedef struct InterpList { * or 8 (formerly ERROR_CODE_SET). */ -#define DELETED 1 -#define ERR_ALREADY_LOGGED 4 -#define DONT_COMPILE_CMDS_INLINE 0x20 -#define RAND_SEED_INITIALIZED 0x40 -#define SAFE_INTERP 0x80 -#define INTERP_TRACE_IN_PROGRESS 0x200 -#define INTERP_ALTERNATE_WRONG_ARGS 0x400 -#define ERR_LEGACY_COPY 0x800 +#define DELETED 1 +#define ERR_ALREADY_LOGGED 4 +#define DONT_COMPILE_CMDS_INLINE 0x20 +#define RAND_SEED_INITIALIZED 0x40 +#define SAFE_INTERP 0x80 +#define INTERP_TRACE_IN_PROGRESS 0x200 +#define INTERP_ALTERNATE_WRONG_ARGS 0x400 +#define ERR_LEGACY_COPY 0x800 /* * Maximum number of levels of nesting permitted in Tcl commands (used to @@ -2076,9 +2076,10 @@ struct LimitHandler { /* The handler callback. */ ClientData clientData; /* Opaque argument to the handler callback. */ Tcl_LimitHandlerDeleteProc *deleteProc; - /* How to delete the clientData */ - LimitHandler *prevPtr; /* Previous item in linked list of handlers */ - LimitHandler *nextPtr; /* Next item in linked list of handlers */ + /* How to delete the clientData. */ + LimitHandler *prevPtr; /* Previous item in linked list of + * handlers. */ + LimitHandler *nextPtr; /* Next item in linked list of handlers. */ }; /* @@ -2104,7 +2105,7 @@ struct LimitHandler { /* * This macro is used to properly align the memory allocated by Tcl, giving - * the same alignment as the native malloc + * the same alignment as the native malloc. */ #if defined(__APPLE__) @@ -2131,7 +2132,6 @@ struct LimitHandler { #define TCL_ALIGN(x) (((int)(x) + 7) & ~7) - /* * The following enum values are used to specify the runtime platform setting * of the tclPlatform variable. @@ -2145,7 +2145,7 @@ typedef enum { /* * The following enum values are used to indicate the translation of a Tcl * channel. Declared here so that each platform can define - * TCL_PLATFORM_TRANSLATION to the native translation on that platform + * TCL_PLATFORM_TRANSLATION to the native translation on that platform. */ typedef enum TclEolTranslation { @@ -2287,7 +2287,7 @@ typedef struct List { */ #define TCL_FILESYSTEM_VERSION_2 ((Tcl_FSVersion) 0x2) -typedef ClientData (TclFSGetCwdProc2) (ClientData clientData); +typedef ClientData (TclFSGetCwdProc2)(ClientData clientData); /* * The following types are used for getting and storing platform-specific file @@ -2297,9 +2297,9 @@ typedef ClientData (TclFSGetCwdProc2) (ClientData clientData); * tclFCmd.c. */ -typedef int (TclGetFileAttrProc) (Tcl_Interp *interp, int objIndex, +typedef int (TclGetFileAttrProc)(Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attrObjPtrPtr); -typedef int (TclSetFileAttrProc) (Tcl_Interp *interp, int objIndex, +typedef int (TclSetFileAttrProc)(Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj *attrObjPtr); typedef struct TclFileAttrProcs { @@ -2337,9 +2337,9 @@ typedef enum Tcl_PathPart { *---------------------------------------------------------------- */ -typedef int (TclStatProc_) (CONST char *path, struct stat *buf); -typedef int (TclAccessProc_) (CONST char *path, int mode); -typedef Tcl_Channel (TclOpenFileChannelProc_) (Tcl_Interp *interp, +typedef int (TclStatProc_)(CONST char *path, struct stat *buf); +typedef int (TclAccessProc_)(CONST char *path, int mode); +typedef Tcl_Channel (TclOpenFileChannelProc_)(Tcl_Interp *interp, CONST char *fileName, CONST char *modeString, int permissions); /* @@ -2357,7 +2357,7 @@ typedef Tcl_ObjCmdProc *TclObjCmdProcType; *---------------------------------------------------------------- */ -typedef void (TclInitProcessGlobalValueProc) (char **valuePtr, int *lengthPtr, +typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, int *lengthPtr, Tcl_Encoding *encodingPtr); /* @@ -2392,17 +2392,19 @@ typedef struct ProcessGlobalValue { */ #define TCL_PARSE_DECIMAL_ONLY 1 - /* Leading zero doesn't denote octal or hex */ + /* Leading zero doesn't denote octal or + * hex. */ #define TCL_PARSE_OCTAL_ONLY 2 - /* Parse octal even without prefix */ + /* Parse octal even without prefix. */ #define TCL_PARSE_HEXADECIMAL_ONLY 4 - /* Parse hexadecimal even without prefix */ + /* Parse hexadecimal even without prefix. */ #define TCL_PARSE_INTEGER_ONLY 8 - /* Disable floating point parsing */ + /* Disable floating point parsing. */ #define TCL_PARSE_SCAN_PREFIXES 16 - /* Use [scan] rules dealing with 0? prefixes */ + /* Use [scan] rules dealing with 0? + * prefixes. */ #define TCL_PARSE_NO_WHITESPACE 32 - /* Reject leading/trailing whitespace */ + /* Reject leading/trailing whitespace. */ /* *---------------------------------------------------------------------- @@ -2422,9 +2424,9 @@ typedef struct ProcessGlobalValue { *---------------------------------------------------------------- */ -MODULE_SCOPE char * tclNativeExecutableName; -MODULE_SCOPE int tclFindExecutableSearchDone; -MODULE_SCOPE char * tclMemDumpFileName; +MODULE_SCOPE char *tclNativeExecutableName; +MODULE_SCOPE int tclFindExecutableSearchDone; +MODULE_SCOPE char *tclMemDumpFileName; MODULE_SCOPE TclPlatformType tclPlatform; MODULE_SCOPE Tcl_NotifierProcs tclOriginalNotifier; @@ -2433,9 +2435,9 @@ MODULE_SCOPE Tcl_NotifierProcs tclOriginalNotifier; * Data for the time hooks, if any. */ -MODULE_SCOPE Tcl_GetTimeProc* tclGetTimeProcPtr; -MODULE_SCOPE Tcl_ScaleTimeProc* tclScaleTimeProcPtr; -MODULE_SCOPE ClientData tclTimeClientData; +MODULE_SCOPE Tcl_GetTimeProc *tclGetTimeProcPtr; +MODULE_SCOPE Tcl_ScaleTimeProc *tclScaleTimeProcPtr; +MODULE_SCOPE ClientData tclTimeClientData; /* * Variables denoting the Tcl object types defined in the core. @@ -2505,13 +2507,13 @@ MODULE_SCOPE void TclArgumentEnter(Tcl_Interp* interp, MODULE_SCOPE void TclArgumentRelease(Tcl_Interp* interp, Tcl_Obj* objv[], int objc); MODULE_SCOPE void TclArgumentGet(Tcl_Interp* interp, Tcl_Obj* obj, - CmdFrame** cfPtrPtr, int* wordPtr); -MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp* interp, - Tcl_Obj* objv[], int objc, - void* codePtr, CmdFrame* cfPtr, int pc); -MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp* interp, + CmdFrame **cfPtrPtr, int *wordPtr); +MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp *interp, Tcl_Obj* objv[], int objc, - void* codePtr, int pc); + void *codePtr, CmdFrame *cfPtr, int pc); +MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp, + Tcl_Obj *objv[], int objc, + void *codePtr, int pc); MODULE_SCOPE int TclArraySet(Tcl_Interp *interp, Tcl_Obj *arrayNameObj, Tcl_Obj *arrayElemObj); MODULE_SCOPE double TclBignumToDouble(mp_int *bignum); @@ -2519,21 +2521,24 @@ MODULE_SCOPE int TclByteArrayMatch(const unsigned char *string, int strLen, const unsigned char *pattern, int ptnLen, int flags); MODULE_SCOPE double TclCeil(mp_int *a); -MODULE_SCOPE int TclCheckBadOctal(Tcl_Interp *interp,const char *value); +MODULE_SCOPE int TclCheckBadOctal(Tcl_Interp *interp, const char *value); MODULE_SCOPE int TclChanCaughtErrorBypass(Tcl_Interp *interp, Tcl_Channel chan); MODULE_SCOPE void TclCleanupLiteralTable(Tcl_Interp *interp, LiteralTable *tablePtr); -MODULE_SCOPE ContLineLoc* TclContinuationsEnter(Tcl_Obj* objPtr, int num, int* loc); -MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj* objPtr, int start, int* clNext); -MODULE_SCOPE ContLineLoc* TclContinuationsGet(Tcl_Obj* objPtr); -MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj* objPtr, Tcl_Obj* originObjPtr); +MODULE_SCOPE ContLineLoc* TclContinuationsEnter(Tcl_Obj *objPtr, int num, + int *loc); +MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr, + int start, int *clNext); +MODULE_SCOPE ContLineLoc* TclContinuationsGet(Tcl_Obj *objPtr); +MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr, + Tcl_Obj *originObjPtr); MODULE_SCOPE int TclDoubleDigits(char *buf, double value, int *signum); -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, +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, int numBytes, int flags, int line, - int* clNextOuter, CONST char* outerScript); + int *clNextOuter, CONST char *outerScript); MODULE_SCOPE int TclFileAttrsCmd(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TclFileCopyCmd(Tcl_Interp *interp, @@ -2544,10 +2549,10 @@ MODULE_SCOPE int TclFileMakeDirsCmd(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TclFileRenameCmd(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE void TclCreateLateExitHandler (Tcl_ExitProc * proc, - ClientData clientData); -MODULE_SCOPE void TclDeleteLateExitHandler (Tcl_ExitProc * proc, - ClientData clientData); +MODULE_SCOPE void TclCreateLateExitHandler(Tcl_ExitProc *proc, + ClientData clientData); +MODULE_SCOPE void TclDeleteLateExitHandler(Tcl_ExitProc *proc, + ClientData clientData); MODULE_SCOPE void TclFinalizeAllocSubsystem(void); MODULE_SCOPE void TclFinalizeAsync(void); MODULE_SCOPE void TclFinalizeDoubleConversion(void); @@ -2572,7 +2577,7 @@ MODULE_SCOPE void TclFormatNaN(double value, char *buffer); MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr, const char *attributeName, int *indexPtr); MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle); -MODULE_SCOPE int * TclGetAsyncReadyPtr(void); +MODULE_SCOPE int * TclGetAsyncReadyPtr(void); MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp); MODULE_SCOPE int TclGetChannelFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Channel *chanPtr, @@ -2622,8 +2627,8 @@ MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp, MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr, int indexCount, Tcl_Obj *const indexArray[]); /* TIP #280 */ -MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, int line, int n, - int *lines, Tcl_Obj* const* elems); +MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, int line, int n, + int *lines, Tcl_Obj *const *elems); MODULE_SCOPE Tcl_Obj * TclListObjCopy(Tcl_Interp *interp, Tcl_Obj *listPtr); MODULE_SCOPE int TclLoadFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, int symc, const char *symbols[], @@ -2638,16 +2643,16 @@ MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *valuePtr); MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name, const EnsembleImplMap map[]); -MODULE_SCOPE int TclMarkList(Tcl_Interp *interp, const char *list, +MODULE_SCOPE int TclMarkList(Tcl_Interp *interp, const char *list, const char *end, int *argcPtr, const int **argszPtr, const char ***argvPtr); MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Tcl_Obj **optionsPtrPtr, int *codePtr, int *levelPtr); MODULE_SCOPE int TclNokia770Doubles(); -MODULE_SCOPE void TclObjVarErrMsg(Tcl_Interp *interp, Tcl_Obj *part1Ptr, - Tcl_Obj *part2Ptr, const char *operation, - const char *reason, int index); +MODULE_SCOPE void TclObjVarErrMsg(Tcl_Interp *interp, Tcl_Obj *part1Ptr, + Tcl_Obj *part2Ptr, const char *operation, + const char *reason, int index); MODULE_SCOPE int TclObjInvokeNamespace(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Tcl_Namespace *nsPtr, int flags); @@ -2703,22 +2708,26 @@ MODULE_SCOPE void TclpNativeJoinPath(Tcl_Obj *prefix, char *joining); MODULE_SCOPE Tcl_Obj * TclpNativeSplitPath(Tcl_Obj *pathPtr, int *lenPtr); MODULE_SCOPE Tcl_PathType TclpGetNativePathType(Tcl_Obj *pathPtr, int *driveNameLengthPtr, Tcl_Obj **driveNameRef); -MODULE_SCOPE int TclCrossFilesystemCopy(Tcl_Interp *interp, +MODULE_SCOPE int TclCrossFilesystemCopy(Tcl_Interp *interp, Tcl_Obj *source, Tcl_Obj *target); MODULE_SCOPE int TclpMatchInDirectory(Tcl_Interp *interp, Tcl_Obj *resultPtr, Tcl_Obj *pathPtr, const char *pattern, Tcl_GlobTypeData *types); MODULE_SCOPE ClientData TclpGetNativeCwd(ClientData clientData); MODULE_SCOPE Tcl_FSDupInternalRepProc TclNativeDupInternalRep; -MODULE_SCOPE Tcl_Obj* TclpObjLink(Tcl_Obj *pathPtr, Tcl_Obj *toPtr, +MODULE_SCOPE Tcl_Obj * TclpObjLink(Tcl_Obj *pathPtr, Tcl_Obj *toPtr, int linkType); MODULE_SCOPE int TclpObjChdir(Tcl_Obj *pathPtr); MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_PathPart portion); +#ifndef TclpPanic MODULE_SCOPE void TclpPanic(const char *format, ...); +#endif MODULE_SCOPE char * TclpReadlink(const char *fileName, Tcl_DString *linkPtr); +#ifndef TclpReleaseFile MODULE_SCOPE void TclpReleaseFile(TclFile file); +#endif MODULE_SCOPE void TclpSetInterfaces(void); MODULE_SCOPE void TclpSetVariables(Tcl_Interp *interp); MODULE_SCOPE void TclpUnloadFile(Tcl_LoadHandle loadHandle); @@ -2751,7 +2760,7 @@ MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj, MODULE_SCOPE Tcl_Obj * TclStringObjReverse(Tcl_Obj *objPtr); MODULE_SCOPE int TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr, int count, int *tokensLeftPtr, int line, - int* clNextOuter, CONST char* outerScript); + int *clNextOuter, CONST char *outerScript); MODULE_SCOPE void TclTransferResult(Tcl_Interp *sourceInterp, int result, Tcl_Interp *targetInterp); MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(ClientData clientData); @@ -2763,7 +2772,7 @@ MODULE_SCOPE int TclpDlopen(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_FSUnloadFileProc **unloadProcPtr); MODULE_SCOPE int TclpUtime(Tcl_Obj *pathPtr, struct utimbuf *tval); #ifdef TCL_LOAD_FROM_MEMORY -MODULE_SCOPE void* TclpLoadMemoryGetBuffer(Tcl_Interp *interp, int size); +MODULE_SCOPE void * TclpLoadMemoryGetBuffer(Tcl_Interp *interp, int size); MODULE_SCOPE int TclpLoadMemory(Tcl_Interp *interp, void *buffer, int size, int codeSize, Tcl_LoadHandle *loadHandle, Tcl_FSUnloadFileProc **unloadProcPtr); @@ -3126,10 +3135,10 @@ MODULE_SCOPE int TclCompileLsetCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, struct CompileEnv *envPtr); MODULE_SCOPE int TclCompileNamespaceCmd(Tcl_Interp *interp, - Tcl_Parse *parsePtr, Command *cmdPtr, + Tcl_Parse *parsePtr, Command *cmdPtr, struct CompileEnv *envPtr); MODULE_SCOPE int TclCompileNoOp(Tcl_Interp *interp, - Tcl_Parse *parsePtr, Command *cmdPtr, + Tcl_Parse *parsePtr, Command *cmdPtr, struct CompileEnv *envPtr); MODULE_SCOPE int TclCompileRegexpCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, @@ -3159,10 +3168,10 @@ MODULE_SCOPE int TclCompileSwitchCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, struct CompileEnv *envPtr); MODULE_SCOPE int TclCompileUpvarCmd(Tcl_Interp *interp, - Tcl_Parse *parsePtr, Command *cmdPtr, + Tcl_Parse *parsePtr, Command *cmdPtr, struct CompileEnv *envPtr); MODULE_SCOPE int TclCompileVariableCmd(Tcl_Interp *interp, - Tcl_Parse *parsePtr, Command *cmdPtr, + Tcl_Parse *parsePtr, Command *cmdPtr, struct CompileEnv *envPtr); MODULE_SCOPE int TclCompileWhileCmd(Tcl_Interp *interp, Tcl_Parse *parsePtr, Command *cmdPtr, @@ -3315,7 +3324,7 @@ MODULE_SCOPE int TclCompileStreqOpCmd(Tcl_Interp *interp, MODULE_SCOPE Var * TclObjLookupVarEx(Tcl_Interp * interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags, - const char * msg, const int createPart1, + const char *msg, const int createPart1, const int createPart2, Var **arrayPtrPtr); MODULE_SCOPE Var * TclLookupArrayElement(Tcl_Interp *interp, Tcl_Obj *arrayNamePtr, Tcl_Obj *elNamePtr, @@ -3333,8 +3342,8 @@ MODULE_SCOPE Tcl_Obj * TclPtrIncrObjVar(Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, const int flags, int index); -MODULE_SCOPE int TclPtrObjMakeUpvar(Tcl_Interp *interp, Var *otherPtr, - Tcl_Obj *myNamePtr, int myFlags, int index); +MODULE_SCOPE int TclPtrObjMakeUpvar(Tcl_Interp *interp, Var *otherPtr, + Tcl_Obj *myNamePtr, int myFlags, int index); MODULE_SCOPE void TclInvalidateNsPath(Namespace *nsPtr); /* @@ -3411,18 +3420,18 @@ MODULE_SCOPE unsigned TclHashObjKey(Tcl_HashTable *tablePtr, void *keyPtr); * Invalidate the string rep first so we can use the bytes value for our * pointer chain, and signal an obj deletion (as opposed to shimmering) with * 'length == -1'. - * Use empty 'if ; else' to handle use in unbraced outer if/else conditions + * Use empty 'if ; else' to handle use in unbraced outer if/else conditions. */ # define TclDecrRefCount(objPtr) \ if (--(objPtr)->refCount > 0) ; else { \ if (!(objPtr)->typePtr || !(objPtr)->typePtr->freeIntRepProc) { \ TCL_DTRACE_OBJ_FREE(objPtr); \ - if ((objPtr)->bytes \ - && ((objPtr)->bytes != tclEmptyStringRep)) { \ - ckfree((char *) (objPtr)->bytes); \ + if ((objPtr)->bytes \ + && ((objPtr)->bytes != tclEmptyStringRep)) { \ + ckfree((char *) (objPtr)->bytes); \ } \ - (objPtr)->length = -1; \ + (objPtr)->length = -1; \ TclFreeObjStorage(objPtr); \ TclIncrObjsFreed(); \ } else { \ @@ -3436,7 +3445,7 @@ MODULE_SCOPE unsigned TclHashObjKey(Tcl_HashTable *tablePtr, void *keyPtr); * The PURIFY mode is like the regular mode, but instead of doing block * Tcl_Obj allocation and keeping a freed list for efficiency, it always * allocates and frees a single Tcl_Obj so that tools like Purify can better - * track memory leaks + * track memory leaks. */ # define TclAllocObjStorage(objPtr) \ @@ -3556,7 +3565,6 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file, #define TclGetString(objPtr) \ ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString((objPtr))) - #define TclGetStringFromObj(objPtr, lenPtr) \ ((objPtr)->bytes \ ? (*(lenPtr) = (objPtr)->length, (objPtr)->bytes) \ @@ -3589,17 +3597,17 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file, #define TclInvalidateStringRep(objPtr) \ if (objPtr->bytes != NULL) { \ - if (objPtr->bytes != tclEmptyStringRep) {\ - ckfree((char *) objPtr->bytes);\ - }\ - objPtr->bytes = NULL;\ - }\ + if (objPtr->bytes != tclEmptyStringRep) { \ + ckfree((char *) objPtr->bytes); \ + } \ + objPtr->bytes = NULL; \ + } /* *---------------------------------------------------------------- - * Macros used by the Tcl core to grow Tcl_Token arrays. They use - * the same growth algorithm as used in tclStringObj.c for growing - * strings. The ANSI C "prototype" for this macro is: + * Macros used by the Tcl core to grow Tcl_Token arrays. They use the same + * growth algorithm as used in tclStringObj.c for growing strings. The ANSI C + * "prototype" for this macro is: * * MODULE_SCOPE void TclGrowTokenArray(Tcl_Token *tokenPtr, int used, * int available, int append, @@ -3628,14 +3636,14 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file, if (allocated > TCL_MAX_TOKENS) { \ allocated = TCL_MAX_TOKENS; \ } \ - newPtr = (Tcl_Token *) attemptckrealloc( (char *) oldPtr, \ + newPtr = (Tcl_Token *) attemptckrealloc((char *) oldPtr, \ (unsigned int) (allocated * sizeof(Tcl_Token))); \ if (newPtr == NULL) { \ allocated = needed + (append) + TCL_MIN_TOKEN_GROWTH; \ if (allocated > TCL_MAX_TOKENS) { \ allocated = TCL_MAX_TOKENS; \ } \ - newPtr = (Tcl_Token *) ckrealloc( (char *) oldPtr, \ + newPtr = (Tcl_Token *) ckrealloc((char *) oldPtr, \ (unsigned int) (allocated * sizeof(Tcl_Token))); \ } \ (available) = allocated; \ @@ -3656,7 +3664,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file, *---------------------------------------------------------------- * Macro used by the Tcl core get a unicode char from a utf string. It checks * to see if we have a one-byte utf char before calling the real - * Tcl_UtfToUniChar, as this will save a lot of time for primarily ascii + * Tcl_UtfToUniChar, as this will save a lot of time for primarily ASCII * string handling. The macro's expression result is 1 for the 1-byte case or * the result of Tcl_UtfToUniChar. The ANSI C "prototype" for this macro is: * @@ -3841,7 +3849,7 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, TCL_DTRACE_OBJ_CREATE(objPtr) #else /* TCL_MEM_DEBUG */ -#define TclNewIntObj(objPtr, i) \ +#define TclNewIntObj(objPtr, i) \ (objPtr) = Tcl_NewIntObj(i) #define TclNewLongObj(objPtr, l) \ @@ -3874,21 +3882,21 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, */ #ifdef _MSC_VER -# define TclIsInfinite(d) ( ! (_finite((d))) ) +# define TclIsInfinite(d) (!(_finite((d)))) # define TclIsNaN(d) (_isnan((d))) #else -# define TclIsInfinite(d) ( (d) > DBL_MAX || (d) < -DBL_MAX ) +# define TclIsInfinite(d) ((d) > DBL_MAX || (d) < -DBL_MAX) # ifdef NO_ISNAN -# define TclIsNaN(d) ((d) != (d)) +# define TclIsNaN(d) ((d) != (d)) # else -# define TclIsNaN(d) (isnan(d)) +# define TclIsNaN(d) (isnan(d)) # endif #endif /* * ---------------------------------------------------------------------- - * Macro to use to find the offset of a field in a structure. - * Computes number of bytes from beginning of structure to a given field. + * Macro to use to find the offset of a field in a structure. Computes number + * of bytes from beginning of structure to a given field. */ #ifdef offsetof @@ -3899,7 +3907,7 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, /* *---------------------------------------------------------------- - * Inline version of Tcl_GetCurrentNamespace and Tcl_GetGlobalNamespace + * Inline version of Tcl_GetCurrentNamespace and Tcl_GetGlobalNamespace. */ #define TclGetCurrentNamespace(interp) \ @@ -3943,13 +3951,12 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, ? 1 : 0))) -#include "tclPort.h" #include "tclIntDecls.h" #include "tclIntPlatDecls.h" #include "tclTomMathDecls.h" #endif /* _TCLINT */ - + /* * Local Variables: * mode: c diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index a89c8f0..8e2e5d0 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -9,7 +9,7 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.32.2.1 2009/04/10 18:02:42 das Exp $ + * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.32.2.2 2010/01/31 23:51:36 nijtmans Exp $ */ #ifndef _TCLINTPLATDECLS @@ -124,12 +124,12 @@ EXTERN int TclUnixCopyFile (CONST char * src, CONST char * dst, #ifndef TclWinConvertError_TCL_DECLARED #define TclWinConvertError_TCL_DECLARED /* 0 */ -EXTERN void TclWinConvertError (DWORD errCode); +EXTERN void TclWinConvertError (unsigned long errCode); #endif #ifndef TclWinConvertWSAError_TCL_DECLARED #define TclWinConvertWSAError_TCL_DECLARED /* 1 */ -EXTERN void TclWinConvertWSAError (DWORD errCode); +EXTERN void TclWinConvertWSAError (unsigned long errCode); #endif #ifndef TclWinGetServByName_TCL_DECLARED #define TclWinGetServByName_TCL_DECLARED @@ -218,7 +218,7 @@ EXTERN TclFile TclpOpenFile (CONST char * fname, int mode); #ifndef TclWinAddProcess_TCL_DECLARED #define TclWinAddProcess_TCL_DECLARED /* 20 */ -EXTERN void TclWinAddProcess (HANDLE hProcess, DWORD id); +EXTERN void TclWinAddProcess (void * hProcess, unsigned long id); #endif /* Slot 21 is reserved */ #ifndef TclpCreateTempFile_TCL_DECLARED @@ -398,8 +398,8 @@ typedef struct TclIntPlatStubs { int (*tclUnixCopyFile) (CONST char * src, CONST char * dst, CONST Tcl_StatBuf * statBufPtr, int dontCopyAtts); /* 14 */ #endif /* UNIX */ #ifdef __WIN32__ /* WIN */ - void (*tclWinConvertError) (DWORD errCode); /* 0 */ - void (*tclWinConvertWSAError) (DWORD errCode); /* 1 */ + void (*tclWinConvertError) (unsigned long errCode); /* 0 */ + void (*tclWinConvertWSAError) (unsigned long errCode); /* 1 */ struct servent * (*tclWinGetServByName) (CONST char * nm, CONST char * proto); /* 2 */ int (*tclWinGetSockOpt) (int s, int level, int optname, char FAR * optval, int FAR * optlen); /* 3 */ HINSTANCE (*tclWinGetTclInstance) (void); /* 4 */ @@ -418,7 +418,7 @@ typedef struct TclIntPlatStubs { void *reserved17; TclFile (*tclpMakeFile) (Tcl_Channel channel, int direction); /* 18 */ TclFile (*tclpOpenFile) (CONST char * fname, int mode); /* 19 */ - void (*tclWinAddProcess) (HANDLE hProcess, DWORD id); /* 20 */ + void (*tclWinAddProcess) (void * hProcess, unsigned long id); /* 20 */ void *reserved21; TclFile (*tclpCreateTempFile) (CONST char * contents); /* 22 */ char * (*tclpGetTZName) (int isdst); /* 23 */ diff --git a/generic/tclPort.h b/generic/tclPort.h index f2cdfb4..91cc57b 100644 --- a/generic/tclPort.h +++ b/generic/tclPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclPort.h,v 1.15.10.2 2010/01/06 22:02:05 nijtmans Exp $ + * RCS: @(#) $Id: tclPort.h,v 1.15.10.3 2010/01/31 23:51:36 nijtmans Exp $ */ #ifndef _TCLPORT @@ -19,11 +19,11 @@ #ifdef HAVE_TCL_CONFIG_H #include "tclConfig.h" #endif -#include "tcl.h" - -#if defined(__WIN32__) +#if defined(_WIN32) # include "tclWinPort.h" -#else +#endif +#include "tcl.h" +#if !defined(_WIN32) # include "tclUnixPort.h" #endif @@ -33,8 +33,8 @@ /* On Cygwin, the environment is imported from the Cygwin DLL. */ DLLIMPORT extern char **__cygwin_environ; DLLIMPORT extern int cygwin_conv_to_win32_path(const char *, char *); -# define environ __cygwin_environ -# define timezone _timezone +# define environ __cygwin_environ +# define timezone _timezone #endif #if !defined(LLONG_MIN) diff --git a/generic/tclTest.c b/generic/tclTest.c index 7320f51..7d9835a 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.114.2.5 2010/01/29 09:38:48 nijtmans Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.114.2.6 2010/01/31 23:51:36 nijtmans Exp $ */ #define TCL_TEST @@ -2212,11 +2212,11 @@ ExitProcOdd( ClientData clientData) /* Integer value to print. */ { char buf[16 + TCL_INTEGER_SPACE]; - size_t len; + int len; sprintf(buf, "odd %d\n", PTR2INT(clientData)); len = strlen(buf); - if (write(1, buf, len) != len) { + if (len != (int) write(1, buf, len)) { Tcl_Panic("Tcl_FinalizeNotifier: unable to write q to triggerPipe"); } } @@ -2226,11 +2226,11 @@ ExitProcEven( ClientData clientData) /* Integer value to print. */ { char buf[16 + TCL_INTEGER_SPACE]; - size_t len; + int len; sprintf(buf, "even %d\n", PTR2INT(clientData)); len = strlen(buf); - if (write(1, buf, len) != len) { + if (len != (int) write(1, buf, len)) { Tcl_Panic("Tcl_FinalizeNotifier: unable to write q to triggerPipe"); } } diff --git a/win/.cvsignore b/win/.cvsignore index 72c5007..1ebb703 100644 --- a/win/.cvsignore +++ b/win/.cvsignore @@ -1,18 +1,24 @@ -Debug
-Release
-*.opt
-*.ncb
-*.plg
-*.00?
-*.o
-*.obj
-*.i
-*.asm
-*.dll
-*.exe
-Makefile
-tcl.hpj
-tclConfig.sh
-.#*
-tcl.sln
-tcl.suo
+Debug +Release +*.opt +*.ncb +*.plg +*.00? +*.o +*.obj +*.i +*.asm +*.dll +*.exe +Makefile +tcl.hpj +tclConfig.sh +.#* +tcl.sln +tcl.suo +autom4te.cache +config.status +*.a +*.lib +*.exp +*.res @@ -8,11 +8,15 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: cat.c,v 1.3 2005/11/04 00:06:49 dkf Exp $ + * RCS: @(#) $Id: cat.c,v 1.3.10.1 2010/01/31 23:51:37 nijtmans Exp $ */ #include <stdio.h> -#include <io.h> +#ifdef __CYGWIN__ +# include <unistd.h> +#else +# include <io.h> +#endif #include <string.h> int @@ -20,7 +24,7 @@ main(void) { char buf[1024]; int n; - char *err; + const char *err; while (1) { n = read(0, buf, sizeof(buf)); diff --git a/win/tclWinDde.c b/win/tclWinDde.c index bcd086e..46e0e55 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -9,13 +9,12 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinDde.c,v 1.31 2006/09/26 00:05:03 patthoyts Exp $ + * RCS: @(#) $Id: tclWinDde.c,v 1.31.8.1 2010/01/31 23:51:37 nijtmans Exp $ */ #include "tclInt.h" #include <dde.h> #include <ddeml.h> -#include <tchar.h> /* * TCL_STORAGE_CLASS is set unconditionally to DLLEXPORT because the Dde_Init diff --git a/win/tclWinError.c b/win/tclWinError.c index 05661a2..7cf0ca4 100644 --- a/win/tclWinError.c +++ b/win/tclWinError.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinError.c,v 1.7 2005/11/04 00:06:50 dkf Exp $ + * RCS: @(#) $Id: tclWinError.c,v 1.7.10.1 2010/01/31 23:51:37 nijtmans Exp $ */ #include "tclInt.h" @@ -354,7 +354,7 @@ static int wsaErrorTable[] = { void TclWinConvertError( - DWORD errCode) /* Win32 error code. */ + unsigned long errCode) /* Win32 error code. */ { if (errCode >= tableLen) { Tcl_SetErrno(EINVAL); @@ -381,7 +381,7 @@ TclWinConvertError( void TclWinConvertWSAError( - DWORD errCode) /* Win32 error code. */ + unsigned long errCode) /* Win32 error code. */ { if ((errCode >= WSAEWOULDBLOCK) && (errCode <= WSAEREMOTE)) { Tcl_SetErrno(wsaErrorTable[errCode - WSAEWOULDBLOCK]); diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 6e6b713..7399e22 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.95.2.2 2009/03/18 17:13:45 dgp Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.95.2.3 2010/01/31 23:51:37 nijtmans Exp $ */ /* #define _WIN32_WINNT 0x0500 */ @@ -226,7 +226,7 @@ WinLink( { WCHAR tempFileName[MAX_PATH]; TCHAR *tempFilePart; - int attr; + DWORD attr; /* * Get the full path referenced by the target. @@ -247,7 +247,7 @@ WinLink( */ attr = (*tclWinProcs->getFileAttributesProc)(linkSourcePath); - if (attr != 0xffffffff) { + if (attr != INVALID_FILE_ATTRIBUTES) { Tcl_SetErrno(EEXIST); return -1; } @@ -271,7 +271,7 @@ WinLink( */ attr = (*tclWinProcs->getFileAttributesProc)(linkTargetPath); - if (attr == 0xffffffff) { + if (attr == INVALID_FILE_ATTRIBUTES) { /* * The target doesn't exist. */ @@ -347,7 +347,7 @@ WinReadLink( { WCHAR tempFileName[MAX_PATH]; TCHAR *tempFilePart; - int attr; + DWORD attr; /* * Get the full path referenced by the target. @@ -368,7 +368,7 @@ WinReadLink( */ attr = (*tclWinProcs->getFileAttributesProc)(linkSourcePath); - if (attr == 0xffffffff) { + if (attr == INVALID_FILE_ATTRIBUTES) { /* * The source doesn't exist. */ @@ -1262,8 +1262,8 @@ WinIsReserved( } } - } else if (!stricmp(path, "prn") || !stricmp(path, "nul") - || !stricmp(path, "aux")) { + } else if (!strcasecmp(path, "prn") || !strcasecmp(path, "nul") + || !strcasecmp(path, "aux")) { /* * Have match for 'prn', 'nul' or 'aux'. */ @@ -1627,7 +1627,7 @@ NativeAccess( } /* - * Now size contains the size of buffer needed + * Now size contains the size of buffer needed. */ sdPtr = (SECURITY_DESCRIPTOR *) HeapAlloc(GetProcessHeap(), 0, size); @@ -1637,7 +1637,7 @@ NativeAccess( } /* - * Call GetFileSecurity() for real + * Call GetFileSecurity() for real. */ if (!(*tclWinProcs->getFileSecurityProc)(nativePath, @@ -1776,9 +1776,9 @@ NativeIsExec( * Use wide-char case-insensitive comparison */ - if ((_wcsicmp(path+len-3, L"exe") == 0) - || (_wcsicmp(path+len-3, L"com") == 0) - || (_wcsicmp(path+len-3, L"bat") == 0)) { + if ((wcscasecmp(path+len-3, L"exe") == 0) + || (wcscasecmp(path+len-3, L"com") == 0) + || (wcscasecmp(path+len-3, L"bat") == 0)) { return 1; } } else { @@ -1797,9 +1797,9 @@ NativeIsExec( * executable, whereas access did not. */ - if ((stricmp(p, "exe") == 0) - || (stricmp(p, "com") == 0) - || (stricmp(p, "bat") == 0)) { + if ((strcasecmp(p, "exe") == 0) + || (strcasecmp(p, "com") == 0) + || (strcasecmp(p, "bat") == 0)) { /* * File that ends with .exe, .com, or .bat is executable. */ diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index b27a762..5cf3a86 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -9,13 +9,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPipe.c,v 1.65 2007/02/20 23:24:07 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.65.4.1 2010/01/31 23:51:37 nijtmans Exp $ */ #include "tclWinInt.h" -#include <fcntl.h> -#include <io.h> #include <sys/stat.h> /* @@ -1424,7 +1422,7 @@ ApplicationType( Tcl_DStringFree(&ds); ext = strrchr(fullName, '.'); - if ((ext != NULL) && (stricmp(ext, ".bat") == 0)) { + if ((ext != NULL) && (strcasecmp(ext, ".bat") == 0)) { applType = APPL_DOS; break; } @@ -1448,7 +1446,7 @@ ApplicationType( */ CloseHandle(hFile); - if ((ext != NULL) && (stricmp(ext, ".com") == 0)) { + if ((ext != NULL) && (strcasecmp(ext, ".com") == 0)) { applType = APPL_DOS; break; } @@ -2647,8 +2645,8 @@ Tcl_WaitPid( void TclWinAddProcess( - HANDLE hProcess, /* Handle to process */ - DWORD id) /* Global process identifier */ + void *hProcess, /* Handle to process */ + unsigned long id) /* Global process identifier */ { ProcInfo *procPtr = (ProcInfo *) ckalloc(sizeof(ProcInfo)); diff --git a/win/tclWinPort.h b/win/tclWinPort.h index bca0b7e..039ba33 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -10,12 +10,22 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinPort.h,v 1.50 2007/12/13 15:28:44 dgp Exp $ + * RCS: @(#) $Id: tclWinPort.h,v 1.50.2.1 2010/01/31 23:51:37 nijtmans Exp $ */ #ifndef _TCLWINPORT #define _TCLWINPORT +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#undef WIN32_LEAN_AND_MEAN + +/* + * Ask for the winsock function typedefs, also. + */ +#define INCL_WINSOCK_API_TYPEDEFS 1 +#include <winsock2.h> + #ifdef CHECK_UNICODE_CALLS # define _UNICODE # define UNICODE @@ -32,13 +42,17 @@ *--------------------------------------------------------------------------- */ +#ifdef __CYGWIN__ +# include <unistd.h> +# include <wchar.h> +#else +# include <io.h> +#endif #include <stdio.h> #include <stdlib.h> - #include <errno.h> #include <fcntl.h> #include <float.h> -#include <io.h> #include <malloc.h> #include <process.h> #include <signal.h> @@ -48,8 +62,11 @@ * These string functions are not defined with the same names on Windows. */ +#ifndef __CYGWIN__ +#define wcscasecmp _wcsicmp #define strcasecmp stricmp #define strncasecmp strnicmp +#endif /* * Need to block out these includes for building extensions with MetroWerks @@ -68,16 +85,6 @@ #include <time.h> -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#undef WIN32_LEAN_AND_MEAN - -/* - * Ask for the winsock function typedefs, also. - */ -#define INCL_WINSOCK_API_TYPEDEFS 1 -#include <winsock2.h> - /* * Define EINPROGRESS in terms of WSAEINPROGRESS. */ @@ -395,15 +402,13 @@ #ifdef __CYGWIN__ /* On Cygwin, the environment is imported from the Cygwin DLL. */ - DLLIMPORT extern char **__cygwin_environ; -# define environ __cygwin_environ # define putenv TclCygwinPutenv # define timezone _timezone #endif /* __CYGWIN__ */ #ifdef __WATCOMC__ - /* + /* * OpenWatcom uses a wine derived winsock2.h that is missing the * LPFN_* typedefs. */ @@ -432,8 +437,8 @@ /* *--------------------------------------------------------------------------- - * The following macros and declarations represent the interface between - * generic and windows-specific parts of Tcl. Some of the macros may + * The following macros and declarations represent the interface between + * generic and windows-specific parts of Tcl. Some of the macros may * override functions declared in tclInt.h. *--------------------------------------------------------------------------- */ @@ -507,14 +512,14 @@ /* - * The following macros have trivial definitions, allowing generic code to + * The following macros have trivial definitions, allowing generic code to * address platform-specific issues. */ #define TclpReleaseFile(file) ckfree((char *) file) /* - * The following macros and declarations wrap the C runtime library + * The following macros and declarations wrap the C runtime library * functions. */ diff --git a/win/tclWinReg.c b/win/tclWinReg.c index 05dbd7d..b7dce1d 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinReg.c,v 1.40 2007/05/15 16:12:53 dgp Exp $ + * RCS: @(#) $Id: tclWinReg.c,v 1.40.4.1 2010/01/31 23:51:37 nijtmans Exp $ */ #include "tclInt.h" @@ -615,17 +615,17 @@ GetKeyNames( return TCL_ERROR; } - /* + /* * Determine how big a buffer is needed for enumerating subkeys, and * how many subkeys there are */ result = (*regWinProcs->regQueryInfoKeyProc) - (key, NULL, NULL, NULL, &subKeyCount, &maxSubKeyLen, NULL, NULL, + (key, NULL, NULL, NULL, &subKeyCount, &maxSubKeyLen, NULL, NULL, NULL, NULL, NULL, NULL); if (result != ERROR_SUCCESS) { Tcl_SetObjResult(interp, Tcl_NewObj()); - Tcl_AppendResult(interp, "unable to query key \"", + Tcl_AppendResult(interp, "unable to query key \"", Tcl_GetString(keyNameObj), "\": ", NULL); AppendSystemError(interp, result); RegCloseKey(key); @@ -744,7 +744,7 @@ GetType( * know about the type, just use the numeric value. */ - if (type > lastType || type < 0) { + if (type > lastType) { Tcl_SetObjResult(interp, Tcl_NewIntObj((int) type)); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj(typeNames[type], -1)); @@ -878,7 +878,7 @@ GetValue( */ Tcl_SetObjResult(interp, Tcl_NewByteArrayObj( - Tcl_DStringValue(&data), (int) length)); + (BYTE *) Tcl_DStringValue(&data), (int) length)); } Tcl_DStringFree(&data); return result; @@ -1375,9 +1375,9 @@ SetValue( Tcl_DStringFree(&buf); } else if (type == REG_SZ || type == REG_EXPAND_SZ) { Tcl_DString buf; - char *data = Tcl_GetStringFromObj(dataObj, &length); + CONST char *data = Tcl_GetStringFromObj(dataObj, &length); - data = (char *) Tcl_WinUtfToTChar(data, length, &buf); + data = Tcl_WinUtfToTChar(data, length, &buf); /* * Include the null in the length, padding if needed for Unicode. @@ -1392,15 +1392,15 @@ SetValue( (DWORD) type, (BYTE *) data, (DWORD) length); Tcl_DStringFree(&buf); } else { - char *data; + BYTE *data; /* * Store binary data in the registry. */ - data = Tcl_GetByteArrayFromObj(dataObj, &length); + data = (BYTE *) Tcl_GetByteArrayFromObj(dataObj, &length); result = (*regWinProcs->regSetValueExProc)(key, valueName, 0, - (DWORD) type, (BYTE *) data, (DWORD) length); + (DWORD) type, data, (DWORD) length); } Tcl_DStringFree(&nameBuf); @@ -1438,10 +1438,11 @@ BroadcastValue( int objc, /* Number of arguments. */ Tcl_Obj *CONST objv[]) /* Argument values. */ { - LRESULT result, sendResult; + LRESULT result; + DWORD sendResult; UINT timeout = 3000; int len; - char *str; + CONST char *str; Tcl_Obj *objPtr; if ((objc != 3) && (objc != 5)) { @@ -1600,8 +1601,8 @@ ConvertDWORD( * Check to see if the low bit is in the first byte. */ - localType = (*((char*)(&order)) == 1) ? REG_DWORD : REG_DWORD_BIG_ENDIAN; - return (type != localType) ? SWAPLONG(value) : value; + localType = (*((char*) &order) == 1) ? REG_DWORD : REG_DWORD_BIG_ENDIAN; + return (type != localType) ? (DWORD) SWAPLONG(value) : value; } /* diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 39c7e05..04ccf9b 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -11,13 +11,11 @@ * * Serial functionality implemented by Rolf.Schroedter@dlr.de * - * RCS: @(#) $Id: tclWinSerial.c,v 1.36 2008/01/14 00:11:44 hobbs Exp $ + * RCS: @(#) $Id: tclWinSerial.c,v 1.36.2.1 2010/01/31 23:51:37 nijtmans Exp $ */ #include "tclWinInt.h" -#include <fcntl.h> -#include <io.h> #include <sys/stat.h> /* @@ -1744,16 +1742,16 @@ SerialSetOptionProc( dcb.XonLim = (WORD) (infoPtr->sysBufRead*1/2); dcb.XoffLim = (WORD) (infoPtr->sysBufRead*1/4); - if (strnicmp(value, "NONE", vlen) == 0) { + if (strncasecmp(value, "NONE", vlen) == 0) { /* * Leave all handshake options disabled. */ - } else if (strnicmp(value, "XONXOFF", vlen) == 0) { + } else if (strncasecmp(value, "XONXOFF", vlen) == 0) { dcb.fOutX = dcb.fInX = TRUE; - } else if (strnicmp(value, "RTSCTS", vlen) == 0) { + } else if (strncasecmp(value, "RTSCTS", vlen) == 0) { dcb.fOutxCtsFlow = TRUE; dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; - } else if (strnicmp(value, "DTRDSR", vlen) == 0) { + } else if (strncasecmp(value, "DTRDSR", vlen) == 0) { dcb.fOutxDsrFlow = TRUE; dcb.fDtrControl = DTR_CONTROL_HANDSHAKE; } else { @@ -1863,7 +1861,7 @@ SerialSetOptionProc( result = TCL_ERROR; break; } - if (strnicmp(argv[i], "DTR", strlen(argv[i])) == 0) { + if (strncasecmp(argv[i], "DTR", strlen(argv[i])) == 0) { if (!EscapeCommFunction(infoPtr->handle, (DWORD) (flag ? SETDTR : CLRDTR))) { if (interp != NULL) { @@ -1872,7 +1870,7 @@ SerialSetOptionProc( result = TCL_ERROR; break; } - } else if (strnicmp(argv[i], "RTS", strlen(argv[i])) == 0) { + } else if (strncasecmp(argv[i], "RTS", strlen(argv[i])) == 0) { if (!EscapeCommFunction(infoPtr->handle, (DWORD) (flag ? SETRTS : CLRRTS))) { if (interp != NULL) { @@ -1881,7 +1879,7 @@ SerialSetOptionProc( result = TCL_ERROR; break; } - } else if (strnicmp(argv[i], "BREAK", strlen(argv[i])) == 0) { + } else if (strncasecmp(argv[i], "BREAK", strlen(argv[i])) == 0) { if (!EscapeCommFunction(infoPtr->handle, (DWORD) (flag ? SETBREAK : CLRBREAK))) { if (interp != NULL) { diff --git a/win/tclWinSock.c b/win/tclWinSock.c index b26d697..bd615a8 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinSock.c,v 1.62.2.2 2009/04/27 21:45:20 ferrieux Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.62.2.3 2010/01/31 23:51:37 nijtmans Exp $ */ #include "tclWinInt.h" @@ -1768,7 +1768,7 @@ TcpSetOptionProc( sock = infoPtr->socket; #ifdef TCL_FEATURE_KEEPALIVE_NAGLE - if (!stricmp(optionName, "-keepalive")) { + if (!strcasecmp(optionName, "-keepalive")) { BOOL val = FALSE; int boolVar, rtn; @@ -1789,7 +1789,7 @@ TcpSetOptionProc( return TCL_ERROR; } return TCL_OK; - } else if (!stricmp(optionName, "-nagle")) { + } else if (!strcasecmp(optionName, "-nagle")) { BOOL val = FALSE; int boolVar, rtn; diff --git a/win/tclWinTest.c b/win/tclWinTest.c index adea787..a3ea423 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinTest.c,v 1.22.2.1 2008/10/07 20:51:47 nijtmans Exp $ + * RCS: @(#) $Id: tclWinTest.c,v 1.22.2.2 2010/01/31 23:51:37 nijtmans Exp $ */ #include "tclInt.h" @@ -754,7 +754,7 @@ TestplatformChmod( done: if (secDesc) { - ckfree(secDesc); + ckfree((char *) secDesc); } if (newAcl) { ckfree((char *) newAcl); diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 22ba966..442e292 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -9,13 +9,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinThrd.c,v 1.43.4.1 2008/12/21 20:13:49 dgp Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.43.4.2 2010/01/31 23:51:37 nijtmans Exp $ */ #include "tclWinInt.h" -#include <fcntl.h> -#include <io.h> #include <sys/stat.h> /* @@ -43,8 +41,10 @@ static CRITICAL_SECTION initLock; #ifdef TCL_THREADS -static CRITICAL_SECTION allocLock; -static Tcl_Mutex allocLockPtr = (Tcl_Mutex) &allocLock; +static struct Tcl_Mutex_ { + CRITICAL_SECTION crit; +} allocLock; +static Tcl_Mutex allocLockPtr = &allocLock; static int allocOnce = 0; #endif /* TCL_THREADS */ @@ -155,7 +155,7 @@ TclpThreadCreate( EnterCriticalSection(&joinLock); *idPtr = 0; /* must initialize as Tcl_Thread is a pointer and - * on WIN64 sizeof void* != sizeof unsigned + * on WIN64 sizeof void* != sizeof unsigned */ #if defined(_MSC_VER) || defined(__MSVCRT__) || defined(__BORLANDC__) @@ -412,7 +412,7 @@ Tcl_GetAllocMutex(void) { #ifdef TCL_THREADS if (!allocOnce) { - InitializeCriticalSection(&allocLock); + InitializeCriticalSection(&allocLock.crit); allocOnce = 1; } return &allocLockPtr; @@ -454,7 +454,7 @@ TclFinalizeLock(void) #ifdef TCL_THREADS if (allocOnce) { - DeleteCriticalSection(&allocLock); + DeleteCriticalSection(&allocLock.crit); allocOnce = 0; } #endif @@ -495,6 +495,7 @@ Tcl_MutexLock( Tcl_Mutex *mutexPtr) /* The lock */ { CRITICAL_SECTION *csPtr; + if (*mutexPtr == NULL) { MASTER_LOCK; @@ -535,6 +536,7 @@ Tcl_MutexUnlock( Tcl_Mutex *mutexPtr) /* The lock */ { CRITICAL_SECTION *csPtr = *((CRITICAL_SECTION **)mutexPtr); + LeaveCriticalSection(csPtr); } @@ -560,6 +562,7 @@ TclpFinalizeMutex( Tcl_Mutex *mutexPtr) { CRITICAL_SECTION *csPtr = *(CRITICAL_SECTION **)mutexPtr; + if (csPtr != NULL) { DeleteCriticalSection(csPtr); ckfree((char *) csPtr); @@ -645,11 +648,11 @@ Tcl_ConditionWait( */ if (*condPtr == NULL) { - winCondPtr = (WinCondition *)ckalloc(sizeof(WinCondition)); + winCondPtr = (WinCondition *) ckalloc(sizeof(WinCondition)); InitializeCriticalSection(&winCondPtr->condLock); winCondPtr->firstPtr = NULL; winCondPtr->lastPtr = NULL; - *condPtr = (Tcl_Condition)winCondPtr; + *condPtr = (Tcl_Condition) winCondPtr; TclRememberCondition(condPtr); } MASTER_UNLOCK; @@ -759,6 +762,7 @@ Tcl_ConditionNotify( { WinCondition *winCondPtr; ThreadSpecificData *tsdPtr; + if (*condPtr != NULL) { winCondPtr = *((WinCondition **)condPtr); @@ -815,6 +819,7 @@ FinalizeConditionEvent( ClientData data) { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) data; + tsdPtr->flags = WIN_THREAD_UNINIT; CloseHandle(tsdPtr->condEvent); } @@ -858,6 +863,9 @@ TclpFinalizeCondition( } } + + + /* * Additions by AOL for specialized thread memory allocator. */ |