diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-08-04 19:06:56 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-08-04 19:06:56 (GMT) |
| commit | fa96cac29f10b30e6fb499800598cc35ba2a19d3 (patch) | |
| tree | 0786f1348044b9dee6e871de4d2399f36f596c91 | |
| parent | b8117727ea202b0bdb4566ec994df5a4faaf93d8 (diff) | |
| parent | aeaba6971a969d6e628e5fd35f4cfca4fb2c683b (diff) | |
| download | tcl-fa96cac29f10b30e6fb499800598cc35ba2a19d3.zip tcl-fa96cac29f10b30e6fb499800598cc35ba2a19d3.tar.gz tcl-fa96cac29f10b30e6fb499800598cc35ba2a19d3.tar.bz2 | |
Merge 8.7
| -rw-r--r-- | doc/Encoding.3 | 11 | ||||
| -rw-r--r-- | generic/tcl.decls | 2 | ||||
| -rw-r--r-- | generic/tclCompile.h | 32 | ||||
| -rw-r--r-- | generic/tclEncoding.c | 5 | ||||
| -rw-r--r-- | generic/tclInt.h | 24 | ||||
| -rw-r--r-- | generic/tclPlatDecls.h | 4 | ||||
| -rw-r--r-- | generic/tclTest.c | 41 | ||||
| -rw-r--r-- | generic/tclTestObj.c | 35 | ||||
| -rw-r--r-- | generic/tclZipfs.c | 13 | ||||
| -rw-r--r-- | tests/chanio.test | 10 | ||||
| -rw-r--r-- | tests/io.test | 75 | ||||
| -rw-r--r-- | tests/listObj.test | 33 | ||||
| -rwxr-xr-x | unix/configure | 5 | ||||
| -rwxr-xr-x | unix/installManPage | 9 | ||||
| -rw-r--r-- | unix/tcl.m4 | 5 | ||||
| -rw-r--r-- | win/Makefile.in | 2 | ||||
| -rwxr-xr-x | win/configure | 25 | ||||
| -rw-r--r-- | win/configure.ac | 20 | ||||
| -rw-r--r-- | win/makefile.vc | 10 | ||||
| -rw-r--r-- | win/tclConfig.sh.in | 17 |
20 files changed, 233 insertions, 145 deletions
diff --git a/doc/Encoding.3 b/doc/Encoding.3 index 80bab73..ce729b9 100644 --- a/doc/Encoding.3 +++ b/doc/Encoding.3 @@ -230,17 +230,16 @@ used. The return value is a pointer to the value stored in the DString. be used to specify the profile to be used for the transform. The \fBTCL_ENCODING_START\fR and \fBTCL_ENCODING_END\fR bits in \fBflags\fR are ignored as the function assumes the entire source string to be decoded is passed -into the function. On success, the function returns \fBTCL_ERROR\fR with the -converted string stored in \fB*dstPtr\fR. For errors other than conversion -errors, such as invalid flags, the function returns \fBTCL_OK\fR with an error +into the function. On success, the function returns \fBTCL_OK\fR with the +converted string stored in \fB*dstPtr\fR. For errors \fIother than conversion +errors\fR, such as invalid flags, the function returns \fBTCL_ERROR\fR with an error message in \fBinterp\fR if it is not NULL. -.PP For conversion errors, \fBTcl_ExternalToUtfDStringEx\fR returns one of the \fBTCL_CONVERT_*\fR errors listed below for \fBTcl_ExternalToUtf\fR. When one of these conversion errors is returned, an error message is stored in \fBinterp\fR only if \fBerrorIdxPtr\fR is NULL. Otherwise, no error message -is stored as the function expects the caller is interested whatever is -decoded to that point and not treating this as an immediate error condition. +is stored as the function expects the caller is interested the decoded data +up to that point and not treating this as an immediate error condition. The index of the error location is stored in \fB*errorIdxPtr\fR. .PP The caller must call \fBTcl_DStringFree\fR to free up the \fB*dstPtr\fR resources diff --git a/generic/tcl.decls b/generic/tcl.decls index 7d22e20..5cf0f34 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2540,7 +2540,7 @@ declare 3 win { declare 0 macosx { int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp, const char *bundleName, int hasResourceFile, - int maxPathLen, char *libraryPath) + Tcl_Size maxPathLen, char *libraryPath) } declare 1 macosx { int Tcl_MacOSXOpenVersionedBundleResources(Tcl_Interp *interp, diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 87fb783..e3d8d4f 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -183,16 +183,16 @@ typedef struct { typedef struct { Tcl_Size srcOffset; /* Command location to find the entry. */ Tcl_Size nline; /* Number of words in the command */ - int *line; /* Line information for all words in the + Tcl_Size *line; /* Line information for all words in the * command. */ - int **next; /* Transient information used by the compiler + Tcl_Size **next; /* Transient information used by the compiler * for tracking of hidden continuation * lines. */ } ECL; typedef struct { int type; /* Context type. */ - int start; /* Starting line for compiled script. Needed + Tcl_Size start; /* Starting line for compiled script. Needed * for the extended recompile check in * tclCompileObj. */ Tcl_Obj *path; /* Path of the sourced file the command is @@ -382,7 +382,7 @@ typedef struct CompileEnv { * encountered that have not yet been paired * with a corresponding * INST_INVOKE_EXPANDED. */ - int *clNext; /* If not NULL, it refers to the next slot in + Tcl_Size *clNext; /* If not NULL, it refers to the next slot in * clLoc to check for an invisible * continuation line. */ } CompileEnv; @@ -1095,7 +1095,7 @@ MODULE_SCOPE ByteCode * TclCompileObj(Tcl_Interp *interp, Tcl_Obj *objPtr, */ MODULE_SCOPE int TclAttemptCompileProc(Tcl_Interp *interp, - Tcl_Parse *parsePtr, int depth, Command *cmdPtr, + Tcl_Parse *parsePtr, Tcl_Size depth, Command *cmdPtr, CompileEnv *envPtr); MODULE_SCOPE void TclCleanupStackForBreakContinue(CompileEnv *envPtr, ExceptionAux *auxPtr); @@ -1103,7 +1103,7 @@ MODULE_SCOPE void TclCompileCmdWord(Tcl_Interp *interp, Tcl_Token *tokenPtr, int count, CompileEnv *envPtr); MODULE_SCOPE void TclCompileExpr(Tcl_Interp *interp, const char *script, - int numBytes, CompileEnv *envPtr, int optimize); + Tcl_Size numBytes, CompileEnv *envPtr, int optimize); MODULE_SCOPE void TclCompileExprWords(Tcl_Interp *interp, Tcl_Token *tokenPtr, int numWords, CompileEnv *envPtr); @@ -1111,7 +1111,7 @@ MODULE_SCOPE void TclCompileInvocation(Tcl_Interp *interp, Tcl_Token *tokenPtr, Tcl_Obj *cmdObj, int numWords, CompileEnv *envPtr); MODULE_SCOPE void TclCompileScript(Tcl_Interp *interp, - const char *script, int numBytes, + const char *script, Tcl_Size numBytes, CompileEnv *envPtr); MODULE_SCOPE void TclCompileSyntaxError(Tcl_Interp *interp, CompileEnv *envPtr); @@ -1120,13 +1120,13 @@ MODULE_SCOPE void TclCompileTokens(Tcl_Interp *interp, CompileEnv *envPtr); MODULE_SCOPE void TclCompileVarSubst(Tcl_Interp *interp, Tcl_Token *tokenPtr, CompileEnv *envPtr); -MODULE_SCOPE int TclCreateAuxData(void *clientData, +MODULE_SCOPE Tcl_Size TclCreateAuxData(void *clientData, const AuxDataType *typePtr, CompileEnv *envPtr); -MODULE_SCOPE int TclCreateExceptRange(ExceptionRangeType type, +MODULE_SCOPE Tcl_Size TclCreateExceptRange(ExceptionRangeType type, CompileEnv *envPtr); MODULE_SCOPE ExecEnv * TclCreateExecEnv(Tcl_Interp *interp, int size); MODULE_SCOPE Tcl_Obj * TclCreateLiteral(Interp *iPtr, const char *bytes, - int length, TCL_HASH_TYPE hash, int *newPtr, + Tcl_Size length, TCL_HASH_TYPE hash, int *newPtr, Namespace *nsPtr, int flags, LiteralEntry **globalPtrPtr); MODULE_SCOPE void TclDeleteExecEnv(ExecEnv *eePtr); @@ -1141,7 +1141,7 @@ MODULE_SCOPE void TclExpandJumpFixupArray(JumpFixupArray *fixupArrayPtr); MODULE_SCOPE int TclNRExecuteByteCode(Tcl_Interp *interp, ByteCode *codePtr); MODULE_SCOPE Tcl_Obj * TclFetchLiteral(CompileEnv *envPtr, TCL_HASH_TYPE index); -MODULE_SCOPE int TclFindCompiledLocal(const char *name, int nameChars, +MODULE_SCOPE Tcl_Size TclFindCompiledLocal(const char *name, Tcl_Size nameChars, int create, CompileEnv *envPtr); MODULE_SCOPE int TclFixupForwardJump(CompileEnv *envPtr, JumpFixup *jumpFixupPtr, int jumpDist, @@ -1182,9 +1182,9 @@ MODULE_SCOPE void TclPrintByteCodeObj(Tcl_Interp *interp, MODULE_SCOPE int TclPrintInstruction(ByteCode *codePtr, const unsigned char *pc); MODULE_SCOPE void TclPrintObject(FILE *outFile, - Tcl_Obj *objPtr, int maxChars); + Tcl_Obj *objPtr, Tcl_Size maxChars); MODULE_SCOPE void TclPrintSource(FILE *outFile, - const char *string, int maxChars); + const char *string, Tcl_Size maxChars); MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, @@ -1206,13 +1206,13 @@ MODULE_SCOPE int TclWordKnownAtCompileTime(Tcl_Token *tokenPtr, Tcl_Obj *valuePtr); MODULE_SCOPE void TclLogCommandInfo(Tcl_Interp *interp, const char *script, const char *command, - int length, const unsigned char *pc, + Tcl_Size length, const unsigned char *pc, Tcl_Obj **tosPtr); MODULE_SCOPE Tcl_Obj *TclGetInnerContext(Tcl_Interp *interp, const unsigned char *pc, Tcl_Obj **tosPtr); MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); MODULE_SCOPE int TclPushProcCallFrame(void *clientData, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int isLambda); /* @@ -1544,7 +1544,7 @@ MODULE_SCOPE int TclPushProcCallFrame(void *clientData, * these macros are: * * static void PushLiteral(CompileEnv *envPtr, - * const char *string, int length); + * const char *string, Tcl_Size length); * static void PushStringLiteral(CompileEnv *envPtr, * const char *string); */ diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 83510cc..18e81f9 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -186,6 +186,7 @@ TCL_DECLARE_MUTEX(encodingMutex) static Tcl_Encoding defaultEncoding = NULL; static Tcl_Encoding systemEncoding = NULL; Tcl_Encoding tclIdentityEncoding = NULL; +Tcl_Encoding tclUtf8Encoding = NULL; /* * Names of encoding profiles and corresponding integer values. @@ -601,7 +602,7 @@ TclInitEncodingSubsystem(void) type.freeProc = NULL; type.nullSize = 1; type.clientData = INT2PTR(ENCODING_UTF); - Tcl_CreateEncoding(&type); + tclUtf8Encoding = Tcl_CreateEncoding(&type); type.clientData = NULL; type.encodingName = "cesu-8"; Tcl_CreateEncoding(&type); @@ -723,6 +724,8 @@ TclFinalizeEncodingSubsystem(void) defaultEncoding = NULL; FreeEncoding(tclIdentityEncoding); tclIdentityEncoding = NULL; + FreeEncoding(tclUtf8Encoding); + tclUtf8Encoding = NULL; hPtr = Tcl_FirstHashEntry(&encodingTable, &search); while (hPtr != NULL) { diff --git a/generic/tclInt.h b/generic/tclInt.h index 1a2205f..49f9232 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1225,7 +1225,7 @@ typedef struct CmdFrame { int type; /* Values see below. */ int level; /* Number of frames in stack, prevent O(n) * scan of list. */ - int *line; /* Lines the words of the command start on. */ + Tcl_Size *line; /* Lines the words of the command start on. */ Tcl_Size nline; CallFrame *framePtr; /* Procedure activation record, may be * NULL. */ @@ -1320,7 +1320,7 @@ typedef struct CFWordBC { typedef struct ContLineLoc { Tcl_Size num; /* Number of entries in loc, not counting the * final -1 marker entry. */ - int loc[TCLFLEXARRAY];/* Table of locations, as character offsets. + Tcl_Size loc[TCLFLEXARRAY];/* 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 @@ -2909,6 +2909,7 @@ MODULE_SCOPE TclPlatformType tclPlatform; */ MODULE_SCOPE Tcl_Encoding tclIdentityEncoding; +MODULE_SCOPE Tcl_Encoding tclUtf8Encoding; MODULE_SCOPE int TclEncodingProfileNameToId(Tcl_Interp *interp, const char *profileName, @@ -3087,7 +3088,7 @@ MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr, const unsigned char *bytes, Tcl_Size len); MODULE_SCOPE int TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); -MODULE_SCOPE void TclAdvanceContinuations(Tcl_Size *line, int **next, +MODULE_SCOPE void TclAdvanceContinuations(Tcl_Size *line, Tcl_Size **next, int loc); MODULE_SCOPE void TclAdvanceLines(Tcl_Size *line, const char *start, const char *end); @@ -3097,7 +3098,7 @@ MODULE_SCOPE void TclArgumentRelease(Tcl_Interp *interp, Tcl_Obj *objv[], int objc); MODULE_SCOPE void TclArgumentBCEnter(Tcl_Interp *interp, Tcl_Obj *objv[], int objc, - void *codePtr, CmdFrame *cfPtr, int cmd, Tcl_Size pc); + void *codePtr, CmdFrame *cfPtr, Tcl_Size cmd, Tcl_Size pc); MODULE_SCOPE void TclArgumentBCRelease(Tcl_Interp *interp, CmdFrame *cfPtr); MODULE_SCOPE void TclArgumentGet(Tcl_Interp *interp, Tcl_Obj *obj, @@ -3124,9 +3125,9 @@ MODULE_SCOPE Tcl_NRPostProc TclClearRootEnsemble; MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr, Tcl_Obj *value2Ptr); MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, Tcl_Size num, - int *loc); + Tcl_Size *loc); MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr, - int start, int *clNext); + Tcl_Size start, Tcl_Size *clNext); MODULE_SCOPE ContLineLoc *TclContinuationsGet(Tcl_Obj *objPtr); MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr, Tcl_Obj *originObjPtr); @@ -3150,7 +3151,7 @@ MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp, /* TIP #280 - Modified token based evaluation, with line information. */ MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script, Tcl_Size numBytes, int flags, Tcl_Size line, - int *clNextOuter, const char *outerScript); + Tcl_Size *clNextOuter, const char *outerScript); MODULE_SCOPE Tcl_ObjCmdProc TclFileAttrsCmd; MODULE_SCOPE Tcl_ObjCmdProc TclFileCopyCmd; MODULE_SCOPE Tcl_ObjCmdProc TclFileDeleteCmd; @@ -3270,8 +3271,8 @@ MODULE_SCOPE Tcl_Obj * TclLindexList(Tcl_Interp *interp, MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Size indexCount, Tcl_Obj *const indexArray[]); /* TIP #280 */ -MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, Tcl_Size line, int n, - int *lines, Tcl_Obj *const *elems); +MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, Tcl_Size line, Tcl_Size n, + Tcl_Size *lines, Tcl_Obj *const *elems); MODULE_SCOPE int TclListObjAppendElements(Tcl_Interp *interp, Tcl_Obj *toObj, Tcl_Size elemCount, Tcl_Obj *const elemObjv[]); @@ -3435,7 +3436,7 @@ MODULE_SCOPE void TclSubstParse(Tcl_Interp *interp, const char *bytes, Tcl_InterpState *statePtr); MODULE_SCOPE int TclSubstTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr, Tcl_Size count, int *tokensLeftPtr, Tcl_Size line, - int *clNextOuter, const char *outerScript); + Tcl_Size *clNextOuter, const char *outerScript); MODULE_SCOPE Tcl_Size TclTrim(const char *bytes, Tcl_Size numBytes, const char *trim, Tcl_Size numTrim, Tcl_Size *trimRight); MODULE_SCOPE Tcl_Size TclTrimLeft(const char *bytes, Tcl_Size numBytes, @@ -4231,7 +4232,7 @@ MODULE_SCOPE Tcl_Obj * TclGetArrayDefault(Var *arrayPtr); */ MODULE_SCOPE int TclIndexEncode(Tcl_Interp *interp, Tcl_Obj *objPtr, - Tcl_Size before, Tcl_Size after, int *indexPtr); + int before, int after, int *indexPtr); MODULE_SCOPE Tcl_Size TclIndexDecode(int encoded, Tcl_Size endValue); /* Constants used in index value encoding routines. */ @@ -4839,7 +4840,6 @@ MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_Init; MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit; - /* *---------------------------------------------------------------- * Macro used by the Tcl core to check whether a pattern has any characters diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index 659c3e6..8d1eee1 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -73,7 +73,7 @@ EXTERN void Tcl_WinConvertError(unsigned errCode); /* 0 */ EXTERN int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp, const char *bundleName, int hasResourceFile, - int maxPathLen, char *libraryPath); + Tcl_Size maxPathLen, char *libraryPath); /* 1 */ EXTERN int Tcl_MacOSXOpenVersionedBundleResources( Tcl_Interp *interp, const char *bundleName, @@ -96,7 +96,7 @@ typedef struct TclPlatStubs { void (*tcl_WinConvertError) (unsigned errCode); /* 3 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */ + int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, Tcl_Size maxPathLen, char *libraryPath); /* 0 */ int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, Tcl_Size maxPathLen, char *libraryPath); /* 1 */ void (*tcl_MacOSXNotifierAddRunLoopMode) (const void *runLoopMode); /* 2 */ #endif /* MACOSX */ diff --git a/generic/tclTest.c b/generic/tclTest.c index ef9997a..dcf21b7 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -236,10 +236,7 @@ static Tcl_ResolveCompiledVarProc InterpCompiledVarResolver; static void MainLoop(void); static Tcl_CmdProc NoopCmd; static Tcl_ObjCmdProc NoopObjCmd; -static int ObjTraceProc(void *clientData, - Tcl_Interp *interp, int level, const char *command, - Tcl_Command commandToken, int objc, - Tcl_Obj *const objv[]); +static Tcl_CmdObjTraceProc2 ObjTraceProc; static void ObjTraceDeleteProc(void *clientData); static void PrintParse(Tcl_Interp *interp, Tcl_Parse *parsePtr); static void SpecialFree(char *blockPtr); @@ -315,7 +312,7 @@ static Tcl_CmdProc TestsetplatformCmd; static Tcl_CmdProc TeststaticlibraryCmd; static Tcl_CmdProc TesttranslatefilenameCmd; static Tcl_CmdProc TestupvarCmd; -static Tcl_ObjCmdProc TestWrongNumArgsObjCmd; +static Tcl_ObjCmdProc2 TestWrongNumArgsObjCmd; static Tcl_ObjCmdProc TestGetIndexFromObjStructObjCmd; static Tcl_CmdProc TestChannelCmd; static Tcl_CmdProc TestChannelEventCmd; @@ -600,7 +597,7 @@ Tcltest_Init( Tcl_CreateObjCommand(interp, "testbytestring", TestbytestringObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "teststringbytes", TeststringbytesObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testutf16string", Testutf16stringObjCmd, NULL, NULL); - Tcl_CreateObjCommand(interp, "testwrongnumargs", TestWrongNumArgsObjCmd, + Tcl_CreateObjCommand2(interp, "testwrongnumargs", TestWrongNumArgsObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testfilesystem", TestFilesystemObjCmd, NULL, NULL); @@ -1170,6 +1167,8 @@ TestcmdinfoObjCmd( Tcl_AppendResult(interp, " stringProc", NULL); } else if (info.isNativeObjectProc == 1) { Tcl_AppendResult(interp, " nativeObjectProc", NULL); + } else if (info.isNativeObjectProc == 2) { + Tcl_AppendResult(interp, " nativeObjectProc2", NULL); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf("Invalid isNativeObjectProc value %d", info.isNativeObjectProc)); @@ -1302,7 +1301,7 @@ TestcmdtokenCmd( return TCL_ERROR; } if (strcmp(argv[1], "create") == 0) { - refPtr = (TestCommandTokenRef *)Tcl_Alloc(sizeof(TestCommandTokenRef)); + refPtr = (TestCommandTokenRef *)ckalloc(sizeof(TestCommandTokenRef)); refPtr->token = Tcl_CreateCommand(interp, argv[2], CmdProc0, refPtr, CmdDelProc0); refPtr->id = nextCommandTokenRefId; @@ -1426,7 +1425,7 @@ TestcmdtraceCmd( static int deleteCalled; deleteCalled = 0; - cmdTrace = Tcl_CreateObjTrace(interp, 50000, + cmdTrace = Tcl_CreateObjTrace2(interp, 50000, TCL_ALLOW_INLINE_COMPILATION, ObjTraceProc, &deleteCalled, ObjTraceDeleteProc); result = Tcl_EvalEx(interp, argv[2], TCL_INDEX_NONE, 0); @@ -1509,10 +1508,10 @@ static int ObjTraceProc( TCL_UNUSED(void *), Tcl_Interp *interp, /* Tcl interpreter */ - TCL_UNUSED(int) /*level*/, + TCL_UNUSED(Tcl_Size) /* level */, const char *command, TCL_UNUSED(Tcl_Command), - TCL_UNUSED(int) /*objc*/, + TCL_UNUSED(Tcl_Size) /*objc*/, Tcl_Obj *const objv[]) /* Argument objects. */ { const char *word = Tcl_GetString(objv[0]); @@ -2026,7 +2025,7 @@ TestdstringCmd( static void SpecialFree( char *blockPtr /* Block to free. */ ) { - ckfree(blockPtr - 16); + ckfree((char *)blockPtr - 16); } /* @@ -4594,7 +4593,7 @@ TestregexpObjCmd( Tcl_Obj *newPtr, *varPtr, *valuePtr; varPtr = objv[i]; - ii = ((cflags®_EXPECT) && i == objc-1) ? TCL_INDEX_NONE : i; + ii = ((cflags®_EXPECT) && i == objc-1) ? TCL_INDEX_NONE : (Tcl_Size)i; if (indices) { Tcl_Obj *objs[2]; @@ -5727,7 +5726,10 @@ TestbytestringObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { - Tcl_Size n = 0; + struct { + Tcl_Size n; + int m; /* This variable should not be overwritten */ + } x = {0, 1}; const char *p; if (objc != 2) { @@ -5735,11 +5737,15 @@ TestbytestringObjCmd( return TCL_ERROR; } - p = (const char *)Tcl_GetBytesFromObj(interp, objv[1], &n); + p = (const char *)Tcl_GetBytesFromObj(interp, objv[1], &x.n); if (p == NULL) { return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(p, n)); + if (x.m != 1) { + Tcl_AppendResult(interp, "Tcl_GetBytesFromObj() overwrites variable", NULL); + return TCL_ERROR; + } + Tcl_SetObjResult(interp, Tcl_NewStringObj(p, x.n)); return TCL_OK; } @@ -7917,7 +7923,7 @@ TestHashSystemHashCmd( Tcl_SetHashValue(hPtr, INT2PTR(i+42)); } - if (hash.numEntries != limit) { + if (hash.numEntries != (Tcl_Size)limit) { Tcl_AppendResult(interp, "unexpected maximal size", NULL); Tcl_DeleteHashTable(&hash); return TCL_ERROR; @@ -8656,7 +8662,7 @@ MyCompiledVarFetch( } hPtr = Tcl_CreateHashEntry((Tcl_HashTable *) &iPtr->globalNsPtr->varTable, - (char *) resVarInfo->nameObj, &isNewVar); + (char *)resVarInfo->nameObj, &isNewVar); if (hPtr) { var = (Tcl_Var) TclVarHashGetValue(hPtr); } else { @@ -8825,4 +8831,3 @@ int TestApplyLambdaObjCmd ( * indent-tabs-mode: nil * End: */ - diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 3b21eaf..123bea7 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -101,7 +101,7 @@ TclObjTest_Init( */ Tcl_Obj **varPtr; - varPtr = (Tcl_Obj **) ckalloc(NUMBER_OF_OBJECT_VARS *sizeof(varPtr[0])); + varPtr = (Tcl_Obj **)ckalloc(NUMBER_OF_OBJECT_VARS *sizeof(varPtr[0])); if (!varPtr) { return TCL_ERROR; } @@ -893,6 +893,7 @@ TestlistobjCmd( "replace", "indexmemcheck", "getelementsmemcheck", + "index", NULL }; enum listobjCmdIndex { @@ -901,6 +902,7 @@ TestlistobjCmd( LISTOBJ_REPLACE, LISTOBJ_INDEXMEMCHECK, LISTOBJ_GETELEMENTSMEMCHECK, + LISTOBJ_INDEX, } cmdIndex; Tcl_Size varIndex; /* Variable number converted to binary */ @@ -982,6 +984,7 @@ TestlistobjCmd( TCL_INDEX_NONE)); /* Keep looping since we are also looping for leaks */ } + Tcl_DecrRefCount(objP); } break; @@ -1008,6 +1011,26 @@ TestlistobjCmd( } } break; + case LISTOBJ_INDEX: + /* + * Tcl_ListObjIndex semantics differ from lindex for out of bounds. + * Hence this explicit test. + */ + if (objc != 4) { + Tcl_WrongNumArgs(interp, 2, objv, + "varIndex listIndex"); + return TCL_ERROR; + } + if (Tcl_GetIntForIndex(interp, objv[3], TCL_INDEX_NONE, &first) != TCL_OK) { + return TCL_ERROR; + } else { + Tcl_Obj *objP; + if (Tcl_ListObjIndex(interp, varPtr[varIndex], first, &objP) != TCL_OK) { + return TCL_ERROR; + } + Tcl_SetObjResult(interp, objP ? objP : Tcl_NewStringObj("null", -1)); + } + break; } return TCL_OK; } @@ -1041,15 +1064,15 @@ TestobjCmd( const Tcl_ObjType *targetType; Tcl_Obj **varPtr; const char *subcommands[] = { - "freeallvars", "bug3598580", "types", - "objtype", "newobj", "set", + "freeallvars", "bug3598580", + "types", "objtype", "newobj", "set", "assign", "convert", "duplicate", "invalidateStringRep", "refcount", "type", NULL }; enum testobjCmdIndex { - TESTOBJ_FREEALLVARS, TESTOBJ_BUG3598580, TESTOBJ_TYPES, - TESTOBJ_OBJTYPE, TESTOBJ_NEWOBJ, TESTOBJ_SET, + TESTOBJ_FREEALLVARS, TESTOBJ_BUG3598580, + TESTOBJ_TYPES, TESTOBJ_OBJTYPE, TESTOBJ_NEWOBJ, TESTOBJ_SET, TESTOBJ_ASSIGN, TESTOBJ_CONVERT, TESTOBJ_DUPLICATE, TESTOBJ_INVALIDATESTRINGREP, TESTOBJ_REFCOUNT, TESTOBJ_TYPE, } cmdIndex; @@ -1513,7 +1536,7 @@ TeststringobjCmd( Tcl_SetObjResult(interp, varPtr[varIndex]); break; case 13: /* newunicode*/ - unicode = (unsigned short *) ckalloc(((unsigned)objc - 3) * sizeof(unsigned short)); + unicode = (unsigned short *)ckalloc(((unsigned)objc - 3) * sizeof(unsigned short)); for (i = 0; i < (objc - 3); ++i) { int val; if (Tcl_GetIntFromObj(interp, objv[i + 3], &val) != TCL_OK) { diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 33cf503..0f65e04 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -273,15 +273,11 @@ static struct { * they are believed to not be UTF-8; only * written to from Tcl code in a trusted * interpreter, so not protected by mutex. */ - Tcl_Encoding utf8; /* The UTF-8 encoding that we prefer to use - * for the strings (especially filenames) - * embedded in a ZIP. Other encodings are used - * dynamically. */ int idCount; /* Counter for channel names */ Tcl_HashTable fileHash; /* File name to ZipEntry mapping */ Tcl_HashTable zipHash; /* Mount to ZipFile mapping */ } ZipFS = { - 0, 0, 0, DEFAULT_WRITE_MAX_SIZE, NULL, NULL, 0, + 0, 0, 0, DEFAULT_WRITE_MAX_SIZE, NULL, 0, {0,{0,0,0,0},0,0,0,0,0,0,0,0,0}, {0,{0,0,0,0},0,0,0,0,0,0,0,0,0} }; @@ -758,7 +754,7 @@ DecodeZipEntryText( while (1) { int srcRead, dstWrote; - int result = Tcl_ExternalToUtf(NULL, ZipFS.utf8, src, srcLen, flags, + int result = Tcl_ExternalToUtf(NULL, tclUtf8Encoding, src, srcLen, flags, &state, dst, dstLen, &srcRead, &dstWrote, NULL); int soFar = dst + dstWrote - Tcl_DStringValue(dstPtr); @@ -1875,7 +1871,6 @@ ZipfsSetup(void) ZipFS.fallbackEntryEncoding = (char *) ckalloc(strlen(ZIPFS_FALLBACK_ENCODING) + 1); strcpy(ZipFS.fallbackEntryEncoding, ZIPFS_FALLBACK_ENCODING); - ZipFS.utf8 = Tcl_GetEncoding(NULL, "utf-8"); ZipFS.initialized = 1; Tcl_CreateExitHandler(ZipfsExitHandler, NULL); } @@ -2555,7 +2550,7 @@ ZipAddFile( * crazy enough to embed NULs in filenames, they deserve what they get! */ - zpathExt = Tcl_UtfToExternalDString(ZipFS.utf8, zpathTcl, -1, &zpathDs); + zpathExt = Tcl_UtfToExternalDString(tclUtf8Encoding, zpathTcl, -1, &zpathDs); zpathlen = strlen(zpathExt); if (zpathlen + ZIP_CENTRAL_HEADER_LEN > bufsize) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3224,7 +3219,7 @@ ZipFSMkZipOrImg( } z = (ZipEntry *) Tcl_GetHashValue(hPtr); - name = Tcl_UtfToExternalDString(ZipFS.utf8, z->name, -1, &ds); + name = Tcl_UtfToExternalDString(tclUtf8Encoding, z->name, -1, &ds); len = Tcl_DStringLength(&ds); SerializeCentralDirectoryEntry(start, end, (unsigned char *) buf, z, len); diff --git a/tests/chanio.test b/tests/chanio.test index c5d3aca..f3461f0 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -1098,7 +1098,7 @@ test chan-io-7.3 {FilterInputBytes: split up character at EOF} -setup { chan puts -nonewline $f "1234567890123\x82\x4F\x82\x50\x82" chan close $f set f [open $path(test1)] - chan configure $f -encoding shiftjis + chan configure $f -encoding shiftjis -profile tcl8 lappend x [chan gets $f line] $line lappend x [chan tell $f] [testchannel inputbuffered $f] [chan eof $f] lappend x [chan gets $f line] $line @@ -6875,7 +6875,7 @@ test chan-io-52.9 {TclCopyChannel & encodings} {fcopy} { [file size $path(utf8-fcopy.txt)] \ [file size $path(utf8-rp.txt)] } {3 5 5} -test chan-io-52.10 {TclCopyChannel & encodings} {fcopy notWinCI} { +test chan-io-52.10 {TclCopyChannel & encodings} -constraints {fcopy notWinCI} -body { # encoding to binary (=> implies that the internal utf-8 is written) set in [open $path(kyrillic.txt) r] set out [open $path(utf8-fcopy.txt) w] @@ -6883,10 +6883,12 @@ test chan-io-52.10 {TclCopyChannel & encodings} {fcopy notWinCI} { # -translation binary is also -encoding binary chan configure $out -translation binary chan copy $in $out + file size $path(utf8-fcopy.txt) +} -cleanup { chan close $in chan close $out - file size $path(utf8-fcopy.txt) -} 5 + unset in out +} -result 5 test chan-io-52.11 {TclCopyChannel & encodings} -setup { set f [open $path(utf8-fcopy.txt) w] fconfigure $f -encoding utf-8 -translation lf diff --git a/tests/io.test b/tests/io.test index ca636ce..6d985ee 100644 --- a/tests/io.test +++ b/tests/io.test @@ -1555,20 +1555,34 @@ test io-12.9 {ReadChars: multibyte chars split} -body { puts -nonewline $f [string repeat a 9]\xC2 close $f set f [open $path(test1)] - fconfigure $f -encoding utf-8 -buffersize 10 + fconfigure $f -encoding utf-8 -profile tcl8 -buffersize 10 set in [read $f] - close $f + read $f scan [string index $in end] %c } -cleanup { catch {close $f} } -result 194 -test io-12.10 {ReadChars: multibyte chars split} -body { +test io-12.11 {ReadChars: multibyte chars split} -body { + set f [open $path(test1) w] + fconfigure $f -translation binary + puts -nonewline $f [string repeat a 9]\xC2 + close $f + set f [open $path(test1)] + fconfigure $f -encoding utf-8 -profile strict -buffersize 10 + set in [read $f] + close $f + scan [string index $in end] %c +} -cleanup { + catch {close $f} +} -returnCodes 1 -match glob -result {error reading "file*":\ + invalid or incomplete multibyte or wide character} +test io-12.12 {ReadChars: multibyte chars split} -body { set f [open $path(test1) w] fconfigure $f -translation binary puts -nonewline $f [string repeat a 9]\xC2 close $f set f [open $path(test1)] - fconfigure $f -encoding utf-8 -buffersize 11 + fconfigure $f -encoding utf-8 -profile tcl8 -buffersize 11 set in [read $f] close $f scan [string index $in end] %c @@ -5765,7 +5779,7 @@ test io-39.21 {Tcl_SetChannelOption, setting read mode independently} \ close $s2 set modes } {auto crlf} -test io-39.22 {Tcl_SetChannelOption, invariance} {unix} { +test io-39.22 {Tcl_SetChannelOption, invariance} -constraints {unix} -body { file delete $path(test1) set f1 [open $path(test1) w+] set l "" @@ -5776,8 +5790,8 @@ test io-39.22 {Tcl_SetChannelOption, invariance} {unix} { lappend l [fconfigure $f1 -eofchar] close $f1 set l -} {{{} {}} {O G} {D D}} -test io-39.22a {Tcl_SetChannelOption, invariance} { +} -result {{{} {}} {O G} {D D}} +test io-39.22a {Tcl_SetChannelOption, invariance} -body { file delete $path(test1) set f1 [open $path(test1) w+] set l [list] @@ -5788,7 +5802,7 @@ test io-39.22a {Tcl_SetChannelOption, invariance} { lappend l [list [catch {fconfigure $f1 -eofchar {1 2 3}} msg] $msg] close $f1 set l -} {{O G} {D D} {1 {bad value for -eofchar: should be a list of zero, one, or two elements}}} +} -result {{O G} {D D} {1 {bad value for -eofchar: should be a list of zero, one, or two elements}}} test io-39.23 {Tcl_GetChannelOption, server socket is not readable or writable, it should still have valid -eofchar and -translation options } { set l [list] @@ -6367,7 +6381,7 @@ test io-47.3 {deleting fileevent on interpreter delete} {testfevent fileevent} { fileevent $f readable {script 1} fileevent $f2 readable {script 2} testfevent cmd "fileevent $f3 readable {script 3} - fileevent $f4 readable {script 4}" + fileevent $f4 readable {script 4}" testfevent delete set x [list [fileevent $f readable] [fileevent $f2 readable] \ [fileevent $f3 readable] [fileevent $f4 readable]] @@ -7435,7 +7449,7 @@ test io-52.9 {TclCopyChannel & encodings} {fcopy} { [file size $path(utf8-fcopy.txt)] \ [file size $path(utf8-rp.txt)] } {3 5 5} -test io-52.10 {TclCopyChannel & encodings} {fcopy notWinCI} { +test io-52.10 {TclCopyChannel & encodings} -constraints {fcopy notWinCI} -body { # encoding to binary (=> implies that the # internal utf-8 is written) @@ -7447,11 +7461,12 @@ test io-52.10 {TclCopyChannel & encodings} {fcopy notWinCI} { fconfigure $out -translation binary fcopy $in $out - close $in - close $out file size $path(utf8-fcopy.txt) -} 5 +} -cleanup { + close $in + close $out +} -result 5 test io-52.11 {TclCopyChannel & encodings} -setup { set out [open $path(utf8-fcopy.txt) w] fconfigure $out -encoding utf-8 -translation lf @@ -9213,6 +9228,7 @@ test io-75.7 { } -cleanup { close $f removeFile io-75.7 + unset msg f fn } -match glob -result {1 {error reading "file*":\ invalid or incomplete multibyte or wide character}} @@ -9250,17 +9266,16 @@ test io-75.8.eoflater {invalid utf-8 encoding eof handling (-profile strict)} -s fconfigure $f -encoding utf-8 -buffering none -eofchar \x1A \ -translation lf -profile strict } -body { - set res [list [catch {read $f} cres] [eof $f]] + set res [list [catch {read $f} msg] [eof $f]] chan configure $f -encoding iso8859-1 lappend res [read $f 1] chan configure $f -encoding utf-8 - catch {read $f 1} cres - lappend res $cres - close $f - set res + lappend res [catch {read $f 1} msg] $msg } -cleanup { + close $f removeFile io-75.8 -} -match glob -result "1 0 \x81 {error reading \"*\":\ + unset res msg fn f +} -match glob -result "1 0 \x81 1 {error reading \"*\":\ invalid or incomplete multibyte or wide character}" @@ -9269,7 +9284,6 @@ test io-strict-multibyte-eof { See issue 25cdcb7e8fb381fb } -setup { - set res {} set chan [file tempfile]; fconfigure $chan -encoding binary puts -nonewline $chan \x81\x1A @@ -9277,10 +9291,10 @@ test io-strict-multibyte-eof { seek $chan 0 chan configure $chan -encoding utf-8 -profile strict } -body { - list [catch {read $chan 1} cres] $cres + list [catch {read $chan 1} msg] $msg } -cleanup { close $chan - unset res + unset msg chan } -match glob -result {1 {error reading "*":\ invalid or incomplete multibyte or wide character}} @@ -9296,6 +9310,7 @@ test io-75.9 {unrepresentable character write passes and is replaced by ?} -setu } -cleanup { close $f removeFile io-75.9 + unset f } -match glob -result [list {A} {error writing "*":\ invalid or incomplete multibyte or wide character}] @@ -9317,6 +9332,7 @@ test io-75.10 {incomplete multibyte encoding read is ignored} -setup { } -cleanup { close $f removeFile io-75.10 + unset d hd } -result 41c0 # The current result returns the orphan byte as byte. # This may be expected due to special utf-8 handling. @@ -9341,6 +9357,7 @@ test io-75.11 {shiftjis encoding error read results in raw bytes} -setup { } -cleanup { close $f removeFile io-75.11 + unset d hd msg f } -match glob -result {41 1 {error reading "file*":\ invalid or incomplete multibyte or wide character}} @@ -9381,6 +9398,7 @@ test io-75.13 { } -cleanup { close $f removeFile io-75.13 + unset d hd msg f fn } -match glob -result {41 1 {error reading "file*":\ invalid or incomplete multibyte or wide character}} @@ -9398,14 +9416,16 @@ test io-75.14 { fconfigure $chan -encoding utf-8 -buffering none -eofchar {} \ -translation auto -profile strict } -body { + set res [gets $chan] lappend res [gets $chan] - lappend res [gets $chan] - lappend res [catch {gets $chan} cres] $cres + lappend res [catch {gets $chan} msg] $msg chan configure $chan -profile tcl8 lappend res [gets $chan] lappend res [gets $chan] - close $chan return $res +} -cleanup { + close $chan + unset chan res msg } -match glob -result {a b 1 {error reading "*":\ invalid or incomplete multibyte or wide character} cÀ d} @@ -9425,8 +9445,8 @@ test io-75.15 { fconfigure $chan -encoding utf-8 -profile strict lappend res [gets $chan] lappend res [gets $chan] - lappend res [catch {gets $chan} cres] $cres - lappend res [catch {gets $chan} cres] $cres + lappend res [catch {gets $chan} msg] $msg + lappend res [catch {gets $chan} msg] $msg chan configure $chan -translation binary set data [read $chan 4] foreach char [split $data {}] { @@ -9439,6 +9459,7 @@ test io-75.15 { return $res } -cleanup { close $chan + unset chan res msg data } -match glob -result {hello AB 1 {error reading "*": invalid or incomplete multibyte or wide character}\ 1 {error reading "*": invalid or incomplete multibyte or wide character} 43 44 c0 40 EF GHI} diff --git a/tests/listObj.test b/tests/listObj.test index 0f43648..55fc089 100644 --- a/tests/listObj.test +++ b/tests/listObj.test @@ -278,6 +278,39 @@ test listobj-13.3 {Tcl_ListObjElements memory leaks for lseq} -constraints { }] $errorMessage } -result {0 {}} +# Tests for Tcl_ListObjIndex as sematics are different from lindex for +# out of bounds indices. Out of bounds should return a null pointer and +# not empty string. +test listobj-14.1 {Tcl_ListObjIndex out-of-bounds index for native lists} -constraints { + testobj +} -setup { + testobj set 1 [list a b c] +} -cleanup { + testobj freeallvars +} -body { + list [testlistobj index 1 -1] [testlistobj index 1 3] +} -result {null null} + +test listobj-14.2 {Tcl_ListObjIndex out-of-bounds index for native lists with spans} -constraints { + testobj +} -setup { + testobj set 1 [testlistrep new 1000 100 100] +} -cleanup { + testobj freeallvars +} -body { + list [testlistobj index 1 -1] [testlistobj index 1 1000] +} -result {null null} + +test listobj-14.3 {Tcl_ListObjIndex out-of-bounds index for lseq} -constraints { + testobj +} -setup { + testobj set 1 [lseq 3] +} -cleanup { + testobj freeallvars +} -body { + list [testlistobj index 1 -1] [testlistobj index 1 3] +} -result {null null} + # cleanup ::tcltest::cleanupTests return diff --git a/unix/configure b/unix/configure index 426954a..eb63649 100755 --- a/unix/configure +++ b/unix/configure @@ -5773,9 +5773,6 @@ fi DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" - TCL_NEEDS_EXP_FILE=1 - TCL_EXPORT_FILE_SUFFIX='${VERSION}.dll.a' - SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$@.a" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Cygwin version of gcc" >&5 printf %s "checking for Cygwin version of gcc... " >&6; } if test ${ac_cv_cygwin+y} @@ -7161,7 +7158,7 @@ then : if test "${SHLIB_SUFFIX}" = ".dll" then : - INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;' + INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"' DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)" else $as_nop diff --git a/unix/installManPage b/unix/installManPage index 86f9860..3d5fa7b 100755 --- a/unix/installManPage +++ b/unix/installManPage @@ -5,13 +5,14 @@ ### Gzip=: -SymOrLoc="" +Sym="" +Loc="" Gz="" Suffix="" while true; do case $1 in - -s | --symlinks ) SymOrLoc="-s " ;; + -s | --symlinks ) Sym="-s " ;; -z | --compress ) Gzip=$2; shift ;; -e | --extension ) Gz=$2; shift ;; -x | --suffix ) Suffix=$2; shift ;; @@ -47,7 +48,7 @@ if test -d "$Dir" ; then : ; else echo "target directory must exist" exit 1 fi -test -z "$SymOrLoc" && SymOrLoc="$Dir/" +test -z "$Sym" && Loc="$Dir/" ######################################################################## ### Extract Target Names from Manual Page @@ -132,7 +133,7 @@ for Target in $Names; do chmod 644 "$Dir/$First" $Gzip "$Dir/$First" else - ln $SymOrLoc"$First$Gz" "$Dir/$Target$Gz" + ln $Sym"$Loc$First$Gz" "$Dir/$Target$Gz" fi done diff --git a/unix/tcl.m4 b/unix/tcl.m4 index ecfec69..68048f4 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1087,9 +1087,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ DL_LIBS="-ldl" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" - TCL_NEEDS_EXP_FILE=1 - TCL_EXPORT_FILE_SUFFIX='${VERSION}.dll.a' - SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$[@].a" AC_CACHE_CHECK(for Cygwin version of gcc, ac_cv_cygwin, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -1805,7 +1802,7 @@ dnl # preprocessing tests use only CPPFLAGS. LIB_SUFFIX=${SHARED_LIB_SUFFIX} MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [ - INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;' + INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"' DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)" ], [ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"' diff --git a/win/Makefile.in b/win/Makefile.in index 75c34cb..367ed79 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -824,7 +824,7 @@ install-binaries: binaries $(COPY) $$i "$(BIN_INSTALL_DIR)"; \ fi; \ done - @for i in tclConfig.sh tclooConfig.sh $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE); \ + @for i in tclConfig.sh tclooConfig.sh $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) @ZLIB_LIBS@ @TOMMATH_LIBS@; \ do \ if [ -f $$i ]; then \ echo "Installing $$i to $(LIB_INSTALL_DIR)/"; \ diff --git a/win/configure b/win/configure index 4db921a..f154f32 100755 --- a/win/configure +++ b/win/configure @@ -661,10 +661,8 @@ TCL_DDE_MINOR_VERSION TCL_DDE_MAJOR_VERSION TCL_DDE_VERSION TCL_PACKAGE_PATH -TCL_LIB_VERSIONS_OK TCL_EXP_FILE TCL_BUILD_EXP_FILE -TCL_NEEDS_EXP_FILE TCL_LD_SEARCH_FLAGS TCL_CC_SEARCH_FLAGS TCL_BUILD_LIB_SPEC @@ -693,7 +691,6 @@ CC_EXENAME CC_OBJNAME DEPARG EXTRA_CFLAGS -CFG_TCL_EXPORT_FILE_SUFFIX CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_SHARED_LIB_SUFFIX TCL_BIN_DIR @@ -739,6 +736,8 @@ ZIP_PROG TCLSH_PROG EXEEXT_FOR_BUILD CC_FOR_BUILD +TCL_TOMMATH_LIB_NAME +TCL_ZLIB_LIB_NAME TOMMATH_OBJS ZLIB_OBJS TOMMATH_LIBS @@ -4887,6 +4886,8 @@ else $as_nop tcl_ok=yes fi +zlib_lib_name=zdll.lib +tommath_lib_name=tommath.lib if test "$tcl_ok" = "yes" then : @@ -4913,6 +4914,8 @@ then : TOMMATH_LIBS=\${TOMMATH_DIR_NATIVE}/win64-arm/libtommath.dll.a + zlib_lib_name=libz.dll.a + tommath_lib_name=libtommath.dll.a else $as_nop @@ -4932,6 +4935,8 @@ then : TOMMATH_LIBS=\${TOMMATH_DIR_NATIVE}/win64/libtommath.dll.a + zlib_lib_name=libz.dll.a + tommath_lib_name=libtommath.dll.a else $as_nop @@ -4964,6 +4969,9 @@ fi printf "%s\n" "#define HAVE_ZLIB 1" >>confdefs.h +TCL_ZLIB_LIB_NAME=$zlib_lib_name + +TCL_TOMMATH_LIB_NAME=$tommath_lib_name ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" " #include <stdint.h> @@ -5787,23 +5795,23 @@ eval "TCL_BUILD_STUB_LIB_PATH=\"`$CYGPATH $(pwd)`/${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_PATH=\"${libdir}/${TCL_STUB_LIB_FILE}\"" if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then + eval "TCL_LIB_FLAG=\"${LIBPREFIX}tcl${VER}${LIBSUFFIX}\"" eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${LIBSUFFIX}\"" else + eval "TCL_LIB_FLAG=\"-ltcl${VER}${FLAGSUFFIX}\"" eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${DLLSUFFIX}.a\"" fi -eval "TCL_BUILD_LIB_SPEC=\"-L`$CYGPATH $(pwd)` -ltcl${VER}${FLAGSUFFIX}\"" -eval "TCL_LIB_SPEC=\"-L${libdir} -ltcl${VER}${FLAGSUFFIX}\"" +eval "TCL_BUILD_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TCL_LIB_FLAG}\"" +eval "TCL_LIB_SPEC=\"-L${libdir} ${TCL_LIB_FLAG}\"" # Install time header dir can be set via --includedir eval "TCL_INCLUDE_SPEC=\"-I${includedir}\"" TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" -TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX} CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX} -CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX} #-------------------------------------------------------------------- # Adjust the defines for how the resources are built depending @@ -5871,7 +5879,6 @@ TCL_WIN_VERSION="$TCL_VERSION.$TCL_RELEASE_LEVEL.`echo $TCL_PATCH_LEVEL | tr -d - # win/tcl.m4 doesn't set (CFLAGS) @@ -5918,8 +5925,6 @@ TCL_WIN_VERSION="$TCL_VERSION.$TCL_RELEASE_LEVEL.`echo $TCL_PATCH_LEVEL | tr -d - - # win only diff --git a/win/configure.ac b/win/configure.ac index 01f70b4..8391161 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -135,6 +135,8 @@ AS_IF([test "${enable_shared+set}" = "set"], [ ], [ tcl_ok=yes ]) +zlib_lib_name=zdll.lib +tommath_lib_name=tommath.lib AS_IF([test "$tcl_ok" = "yes"], [ AC_SUBST(ZLIB_DLL_FILE,[\${ZLIB_DLL_FILE}]) AC_SUBST(TOMMATH_DLL_FILE,[\${TOMMATH_DLL_FILE}]) @@ -145,6 +147,8 @@ AS_IF([test "$tcl_ok" = "yes"], [ AS_IF([test "$GCC" == "yes"],[ AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64-arm/libz.dll.a]) AC_SUBST(TOMMATH_LIBS,[\${TOMMATH_DIR_NATIVE}/win64-arm/libtommath.dll.a]) + zlib_lib_name=libz.dll.a + tommath_lib_name=libtommath.dll.a ], [ AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64-arm/zdll.lib]) AC_SUBST(TOMMATH_LIBS,[\${TOMMATH_DIR_NATIVE}/win64-arm/tommath.lib]) @@ -153,6 +157,8 @@ AS_IF([test "$tcl_ok" = "yes"], [ AS_IF([test "$GCC" == "yes"],[ AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/libz.dll.a]) AC_SUBST(TOMMATH_LIBS,[\${TOMMATH_DIR_NATIVE}/win64/libtommath.dll.a]) + zlib_lib_name=libz.dll.a + tommath_lib_name=libtommath.dll.a ], [ AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR_NATIVE}/win64/zdll.lib]) AC_SUBST(TOMMATH_LIBS,[\${TOMMATH_DIR_NATIVE}/win64/tommath.lib]) @@ -167,7 +173,8 @@ AS_IF([test "$tcl_ok" = "yes"], [ AC_SUBST(TOMMATH_OBJS,[\${TOMMATH_OBJS}]) ]) AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?]) - +AC_SUBST(TCL_ZLIB_LIB_NAME, $zlib_lib_name) +AC_SUBST(TCL_TOMMATH_LIB_NAME, $tommath_lib_name) AC_CHECK_TYPES([intptr_t, uintptr_t],,,[[ #include <stdint.h> ]]) @@ -335,23 +342,23 @@ eval "TCL_BUILD_STUB_LIB_PATH=\"`$CYGPATH $(pwd)`/${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_PATH=\"${libdir}/${TCL_STUB_LIB_FILE}\"" if test ${SHARED_BUILD} = 0 -o "$GCC" != "yes" ; then + eval "TCL_LIB_FLAG=\"${LIBPREFIX}tcl${VER}${LIBSUFFIX}\"" eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${LIBSUFFIX}\"" else + eval "TCL_LIB_FLAG=\"-ltcl${VER}${FLAGSUFFIX}\"" eval "TCL_LIB_FILE=\"${LIBPREFIX}tcl${VER}${DLLSUFFIX}.a\"" fi -eval "TCL_BUILD_LIB_SPEC=\"-L`$CYGPATH $(pwd)` -ltcl${VER}${FLAGSUFFIX}\"" -eval "TCL_LIB_SPEC=\"-L${libdir} -ltcl${VER}${FLAGSUFFIX}\"" +eval "TCL_BUILD_LIB_SPEC=\"-L`$CYGPATH $(pwd)` ${TCL_LIB_FLAG}\"" +eval "TCL_LIB_SPEC=\"-L${libdir} ${TCL_LIB_FLAG}\"" # Install time header dir can be set via --includedir eval "TCL_INCLUDE_SPEC=\"-I${includedir}\"" TCL_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" -TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX} CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX} -CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX} #-------------------------------------------------------------------- # Adjust the defines for how the resources are built depending @@ -418,7 +425,6 @@ AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_BIN_DIR) AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX) AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX) -AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX) # win/tcl.m4 doesn't set (CFLAGS) AC_SUBST(CFLAGS_DEFAULT) @@ -461,11 +467,9 @@ AC_SUBST(MAKE_EXE) AC_SUBST(TCL_BUILD_LIB_SPEC) AC_SUBST(TCL_CC_SEARCH_FLAGS) AC_SUBST(TCL_LD_SEARCH_FLAGS) -AC_SUBST(TCL_NEEDS_EXP_FILE) AC_SUBST(TCL_BUILD_EXP_FILE) AC_SUBST(TCL_EXP_FILE) AC_SUBST(DL_LIBS) -AC_SUBST(TCL_LIB_VERSIONS_OK) AC_SUBST(TCL_PACKAGE_PATH) # win only diff --git a/win/makefile.vc b/win/makefile.vc index 625337d..27ee064 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -744,7 +744,6 @@ $(OUT_DIR)\tclConfig.sh: $(WIN_DIR)\tclConfig.sh.in @LDFLAGS_DEBUG@ -nologo -machine:$(MACHINE) -debug -debugtype:cv
@LDFLAGS_OPTIMIZE@ -nologo -machine:$(MACHINE) -release -opt:ref -opt:icf,3
@TCL_LIB_FILE@ $(PROJECT)$(VERSION)$(SUFX).lib
-@TCL_NEEDS_EXP_FILE@
@LIBS@ $(baselibs) $(PRJ_LIBS)
@prefix@ $(_INSTALLDIR)
@exec_prefix@ $(BIN_INSTALL_DIR)
@@ -762,11 +761,10 @@ $(OUT_DIR)\tclConfig.sh: $(WIN_DIR)\tclConfig.sh.in @TCL_LD_SEARCH_FLAGS@
@LIBOBJS@
@RANLIB@
-@TCL_LIB_FLAG@
-@TCL_BUILD_LIB_SPEC@
+@TCL_LIB_FLAG@ $(PROJECT)$(VERSION)$(SUFX).lib
+@TCL_BUILD_LIB_SPEC@ $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
@TCL_LIB_SPEC@ $(LIB_INSTALL_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
@TCL_INCLUDE_SPEC@ -I$(INCLUDE_INSTALL_DIR)
-@TCL_LIB_VERSIONS_OK@
@TCL_SRC_DIR@ $(ROOT)
@TCL_PACKAGE_PATH@
@TCL_STUB_LIB_FILE@ $(TCLSTUBLIBNAME)
@@ -775,7 +773,6 @@ $(OUT_DIR)\tclConfig.sh: $(WIN_DIR)\tclConfig.sh.in @TCL_BUILD_STUB_LIB_SPEC@ -L$(OUT_DIR) $(TCLSTUBLIBNAME)
@TCL_BUILD_STUB_LIB_PATH@ $(TCLSTUBLIB)
@TCL_STUB_LIB_PATH@ $(LIB_INSTALL_DIR)\$(TCLSTUBLIBNAME)
-@CFG_TCL_EXPORT_FILE_SUFFIX@ $(VERSION)$(SUFX).lib
@CFG_TCL_SHARED_LIB_SUFFIX@ $(VERSION)$(SUFX).dll
@CFG_TCL_UNSHARED_LIB_SUFFIX@ $(VERSION)$(SUFX).lib
!if $(STATIC_BUILD)
@@ -783,6 +780,8 @@ $(OUT_DIR)\tclConfig.sh: $(WIN_DIR)\tclConfig.sh.in !else
@TCL_SHARED_BUILD@ 1
!endif
+@TCL_ZLIB_LIB_NAME@ zdll.lib
+@TCL_TOMMATH_LIB_NAME@ tommath.lib
<<
@@ -970,6 +969,7 @@ install-binaries: !endif
@$(CPY) "$(TCLIMPLIB)" "$(LIB_INSTALL_DIR)\"
@$(CPY) "$(OUT_DIR)\zlib1.dll" "$(BIN_INSTALL_DIR)\"
+ @$(CPY) "$(OUT_DIR)\zdll.lib" "$(LIB_INSTALL_DIR)\"
@$(CPY) "$(OUT_DIR)\libtommath.dll" "$(BIN_INSTALL_DIR)\"
@$(CPY) "$(OUT_DIR)\tommath.lib" "$(LIB_INSTALL_DIR)\"
!if exist($(TCLSH))
diff --git a/win/tclConfig.sh.in b/win/tclConfig.sh.in index 776dcb0..1c33246 100644 --- a/win/tclConfig.sh.in +++ b/win/tclConfig.sh.in @@ -46,13 +46,10 @@ TCL_LIB_FILE='@TCL_LIB_FILE@' TCL_ZIP_FILE='@TCL_ZIP_FILE@' # Flag to indicate whether shared libraries need export files. -TCL_NEEDS_EXP_FILE=@TCL_NEEDS_EXP_FILE@ +TCL_NEEDS_EXP_FILE='' -# String that can be evaluated to generate the part of the export file -# name that comes after the "libxxx" (includes version number, if any, -# extension, and anything else needed). May depend on the variables -# VERSION. On most UNIX systems this is ${VERSION}.exp. -TCL_EXPORT_FILE_SUFFIX='@CFG_TCL_EXPORT_FILE_SUFFIX@' +# Deprecated. Same as TCL_UNSHARED_LIB_SUFFIX +TCL_EXPORT_FILE_SUFFIX='@CFG_TCL_UNSHARED_LIB_SUFFIX@' # Additional libraries to use when linking Tcl. TCL_LIBS='@LIBS@' @@ -129,7 +126,7 @@ TCL_INCLUDE_SPEC='@TCL_INCLUDE_SPEC@' # ("ok" means it's safe to use switches like -ltcl7.5; "nodots" means # use switches like -ltcl75). SunOS and FreeBSD require "nodots", for # example. -TCL_LIB_VERSIONS_OK='@TCL_LIB_VERSIONS_OK@' +TCL_LIB_VERSIONS_OK='nodots' # String that can be evaluated to generate the part of a shared library # name that comes after the "libxxx" (includes version number, if any, @@ -179,3 +176,9 @@ TCL_BUILD_STUB_LIB_PATH='@TCL_BUILD_STUB_LIB_PATH@' # Path to the Tcl stub library in the install directory. TCL_STUB_LIB_PATH='@TCL_STUB_LIB_PATH@' + +# Name of the zlib library that extensions should use +TCL_ZLIB_LIB_NAME='@TCL_ZLIB_LIB_NAME@' + +# Name of the tommath library that extensions should use +TCL_TOMMATH_LIB_NAME='@TCL_TOMMATH_LIB_NAME@' |
