diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-09 15:56:04 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-11-09 15:56:04 (GMT) |
| commit | b7e5592df1f6b8d92935251cb1616e10b656ac07 (patch) | |
| tree | ef789fbc1392b7bd7609fa81b92986d2241be9d7 | |
| parent | a037934e2165dc52888a2daa656c9e5d5ddc980e (diff) | |
| parent | 78374f18a4199081db4462452b16c3e4193edc92 (diff) | |
| download | tcl-b7e5592df1f6b8d92935251cb1616e10b656ac07.zip tcl-b7e5592df1f6b8d92935251cb1616e10b656ac07.tar.gz tcl-b7e5592df1f6b8d92935251cb1616e10b656ac07.tar.bz2 | |
Merge core-8-branch. Backout the Tcl_EvalFile changes.
| -rw-r--r-- | generic/tcl.decls | 1 | ||||
| -rw-r--r-- | generic/tcl.h | 23 | ||||
| -rw-r--r-- | generic/tclDecls.h | 3 | ||||
| -rw-r--r-- | generic/tclIOUtil.c | 24 | ||||
| -rw-r--r-- | generic/tclScan.c | 12 | ||||
| -rw-r--r-- | generic/tclStringObj.c | 6 | ||||
| -rw-r--r-- | generic/tclStubInit.c | 2 |
7 files changed, 44 insertions, 27 deletions
diff --git a/generic/tcl.decls b/generic/tcl.decls index 1083adc..8d0b465 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -469,7 +469,6 @@ declare 128 { declare 129 { int Tcl_Eval(Tcl_Interp *interp, const char *script) } -# Stub entry no longer needed. It is now a macro in terms of Tcl_FSEvalFileEx(). declare 130 { int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName) } diff --git a/generic/tcl.h b/generic/tcl.h index 54c6b73..23a0a9a 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2409,14 +2409,27 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp, const char *version, int epoch, int revision); #ifdef USE_TCL_STUBS -#define Tcl_InitStubs(interp, version, exact) \ - (Tcl_InitStubs)(interp, version, \ +#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE +# define Tcl_InitStubs(interp, version, exact) \ + (Tcl_InitStubs)(interp, version, \ (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \ TCL_STUB_MAGIC) #else -#define Tcl_InitStubs(interp, version, exact) \ - Tcl_PkgInitStubsCheck(interp, version, \ - (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) +# define Tcl_InitStubs(interp, version, exact) \ + (Tcl_InitStubs)(interp, TCL_PATCH_LEVEL, \ + 1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \ + TCL_STUB_MAGIC) +#endif +#else +#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE +# define Tcl_InitStubs(interp, version, exact) \ + Tcl_PkgInitStubsCheck(interp, version, \ + (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) +#else +# define Tcl_InitStubs(interp, version, exact) \ + Tcl_PkgInitStubsCheck(interp, TCL_PATCH_LEVEL, \ + 1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) +#endif #endif /* diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 9241175..561553d 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3983,8 +3983,5 @@ extern const TclStubs *tclStubsPtr; #undef Tcl_GlobalEvalObj #define Tcl_GlobalEvalObj(interp, objPtr) \ Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL) -#undef Tcl_EvalFile -#define Tcl_EvalFile(interp, fileName) \ - Tcl_FSEvalFileEx(interp, Tcl_NewStringObj(filename, -1), NULL); #endif /* _TCLDECLS */ diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 39a9474..2c389c6 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -412,18 +412,21 @@ Tcl_GetCwd( return Tcl_DStringValue(cwdPtr); } -#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 /* Obsolete */ -#undef Tcl_EvalFile int Tcl_EvalFile( Tcl_Interp *interp, /* Interpreter in which to process file. */ const char *fileName) /* Name of file to process. Tilde-substitution * will be performed on this name. */ { - return Tcl_FSEvalFileEx(interp, Tcl_NewStringObj(fileName, -1), NULL); + int ret; + Tcl_Obj *pathPtr = Tcl_NewStringObj(fileName,-1); + + Tcl_IncrRefCount(pathPtr); + ret = Tcl_FSEvalFile(interp, pathPtr); + Tcl_DecrRefCount(pathPtr); + return ret; } -#endif /* * Now move on to the basic filesystem implementation. @@ -1737,11 +1740,8 @@ Tcl_FSEvalFileEx( Tcl_Channel chan; Tcl_Obj *objPtr; - Tcl_IncrRefCount(pathPtr); - objPtr = Tcl_NewObj(); - Tcl_IncrRefCount(objPtr); if (Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL) { - goto end; + return result; } if (Tcl_FSStat(pathPtr, &statBuf) == -1) { @@ -1756,7 +1756,7 @@ Tcl_FSEvalFileEx( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't read file \"%s\": %s", Tcl_GetString(pathPtr), Tcl_PosixError(interp))); - goto end; + return result; } /* @@ -1775,10 +1775,13 @@ Tcl_FSEvalFileEx( if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName) != TCL_OK) { Tcl_Close(interp,chan); - goto end; + return result; } } + objPtr = Tcl_NewObj(); + Tcl_IncrRefCount(objPtr); + /* * Try to read first character of stream, so we can check for utf-8 BOM to * be handled especially. @@ -1854,7 +1857,6 @@ Tcl_FSEvalFileEx( end: Tcl_DecrRefCount(objPtr); - Tcl_DecrRefCount(pathPtr); return result; } diff --git a/generic/tclScan.c b/generic/tclScan.c index e1fcad4..7f71262 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -885,9 +885,17 @@ Tcl_ScanObjCmd( * Scan a single Unicode character. */ - string += TclUtfToUniChar(string, &sch); + offset = TclUtfToUniChar(string, &sch); + i = (int)sch; +#if TCL_UTF_MAX == 4 + if (!offset) { + offset = Tcl_UtfToUniChar(string, &sch); + i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF); + } +#endif + string += offset; if (!(flags & SCAN_SUPPRESS)) { - objPtr = Tcl_NewIntObj((int)sch); + objPtr = Tcl_NewIntObj(i); Tcl_IncrRefCount(objPtr); CLANG_ASSERT(objs); objs[objIndex++] = objPtr; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 3a35bcf..547f7c6 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3462,7 +3462,6 @@ TclStringObjReverse( * Tcl_SetObjLength into growing the unicode rep buffer. */ - ch = 0; objPtr = Tcl_NewUnicodeObj(&ch, 1); Tcl_SetObjLength(objPtr, stringPtr->numChars); to = Tcl_GetUnicode(objPtr); @@ -3565,7 +3564,7 @@ ExtendUnicodeRepWithString( { String *stringPtr = GET_STRING(objPtr); int needed, numOrigChars = 0; - Tcl_UniChar *dst; + Tcl_UniChar *dst, unichar = 0; if (stringPtr->hasUnicode) { numOrigChars = stringPtr->numChars; @@ -3588,7 +3587,8 @@ ExtendUnicodeRepWithString( numAppendChars = 0; } for (dst=stringPtr->unicode + numOrigChars; numAppendChars-- > 0; dst++) { - bytes += TclUtfToUniChar(bytes, dst); + bytes += TclUtfToUniChar(bytes, &unichar); + *dst = unichar; } *dst = 0; } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index d276dbc..7205388 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -370,8 +370,6 @@ static int formatInt(char *buffer, int n){ # define Tcl_EvalObj 0 # undef Tcl_GlobalEvalObj # define Tcl_GlobalEvalObj 0 -# undef Tcl_EvalFile -# define Tcl_EvalFile 0 # define TclBackgroundException 0 # undef TclpReaddir # define TclpReaddir 0 |
