diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-03-07 08:39:37 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-03-07 08:39:37 (GMT) |
| commit | 5b2b2aba5d8ab99e4cb03dc960f2695f0c0698a0 (patch) | |
| tree | 659e01c5b151ea205fe9e93730d4a71de3977748 | |
| parent | 62575cdd32102c8c01521d61cefda93a4a26493b (diff) | |
| parent | efadd7170eafc8ffacab61f82cf3878cc7285ff1 (diff) | |
| download | tcl-5b2b2aba5d8ab99e4cb03dc960f2695f0c0698a0.zip tcl-5b2b2aba5d8ab99e4cb03dc960f2695f0c0698a0.tar.gz tcl-5b2b2aba5d8ab99e4cb03dc960f2695f0c0698a0.tar.bz2 | |
Merge 8.7
| -rw-r--r-- | generic/tclCmdMZ.c | 19 | ||||
| -rw-r--r-- | generic/tclEnv.c | 12 | ||||
| -rw-r--r-- | library/init.tcl | 36 | ||||
| -rw-r--r-- | unix/tclUnixTime.c | 2 | ||||
| -rw-r--r-- | win/nmakehlp.c | 2 | ||||
| -rw-r--r-- | win/tclWinTime.c | 22 |
6 files changed, 34 insertions, 59 deletions
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 4317a6a..253c7cc 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4086,8 +4086,8 @@ Tcl_TimeObjCmd( * Tcl_TimeRateObjCmd -- * * This object-based procedure is invoked to process the "timerate" Tcl - * command. - * This is similar to command "time", except the execution limited by + * command. + * This is similar to command "time", except the execution limited by * given time (in milliseconds) instead of repetition count. * * Example: @@ -4109,8 +4109,7 @@ Tcl_TimeRateObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - static - double measureOverhead = 0; /* global measure-overhead */ + static double measureOverhead = 0; /* global measure-overhead */ double overhead = -1; /* given measure-overhead */ register Tcl_Obj *objPtr; register int result, i; @@ -4198,13 +4197,13 @@ usage: Tcl_Obj *clobjv[6]; Tcl_WideInt maxCalTime = 5000; double lastMeasureOverhead = measureOverhead; - - clobjv[0] = objv[0]; + + clobjv[0] = objv[0]; i = 1; if (direct) { clobjv[i++] = direct; } - clobjv[i++] = objPtr; + clobjv[i++] = objPtr; /* reset last measurement overhead */ measureOverhead = (double)0; @@ -4221,7 +4220,7 @@ usage: i--; clobjv[i++] = calibrate; - clobjv[i++] = objPtr; + clobjv[i++] = objPtr; /* set last measurement overhead to max */ measureOverhead = (double)UWIDE_MAX; @@ -4322,7 +4321,7 @@ usage: maxcnt = 0; result = TCL_OK; } - + /* don't check time up to threshold */ if (--threshold > 0) continue; @@ -4421,7 +4420,7 @@ usage: } objs[2] = Tcl_NewWideIntObj(count); /* iterations */ - + /* calculate speed as rate (count) per sec */ if (!middle) middle++; /* +1 ms, just to avoid divide by zero */ if (count < (WIDE_MAX / 1000000)) { diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 445b345..61dad59 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -135,6 +135,18 @@ TclSetupEnv( } p2++; p2[-1] = '\0'; +#if defined(_WIN32) + /* + * Enforce PATH and COMSPEC to be all uppercase. This eliminates + * additional trace logic otherwise required in init.tcl. + */ + + if (strcasecmp(p1, "PATH") == 0) { + p1 = "PATH"; + } else if (strcasecmp(p1, "COMSPEC") == 0) { + p1 = "COMSPEC"; + } +#endif obj1 = Tcl_NewStringObj(p1, -1); obj2 = Tcl_NewStringObj(p2, -1); Tcl_DStringFree(&envString); diff --git a/library/init.tcl b/library/init.tcl index 87e12ef..98ed2f5 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -80,42 +80,6 @@ namespace eval tcl { namespace eval tcl::Pkg {} -# Windows specific end of initialization - -if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} { - namespace eval tcl { - proc EnvTraceProc {lo n1 n2 op} { - global env - set x $env($n2) - set env($lo) $x - set env([string toupper $lo]) $x - } - proc InitWinEnv {} { - global env tcl_platform - foreach p [array names env] { - set u [string toupper $p] - if {$u ne $p} { - switch -- $u { - COMSPEC - - PATH { - set temp $env($p) - unset env($p) - set env($u) $temp - trace add variable env($p) write \ - [namespace code [list EnvTraceProc $p]] - trace add variable env($u) write \ - [namespace code [list EnvTraceProc $p]] - } - } - } - } - if {![info exists env(COMSPEC)]} { - set env(COMSPEC) cmd.exe - } - } - InitWinEnv - } -} # Setup the unknown package handler diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 0a0faa2..7fb123e 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -223,7 +223,7 @@ TclpWideClicksToNanoseconds( * * TclpWideClickInMicrosec -- * - * This procedure return scale to convert click values from the + * This procedure return scale to convert click values from the * TclpGetWideClicks native resolution to microsecond resolution * and back. * diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 1655d48..c21de63 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -793,7 +793,7 @@ static int LocateDependencyHelper(const char *dir, const char *keypath) static int LocateDependency(const char *keypath) { int i, ret; - static char *paths[] = {"..", "..\\..", "..\\..\\.."}; + static const char *paths[] = {"..", "..\\..", "..\\..\\.."}; for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) { ret = LocateDependencyHelper(paths[i], keypath); diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 6640188..716b27e 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -233,7 +233,7 @@ TclpGetWideClicks(void) /* * The frequency of the performance counter is fixed at system boot and - * is consistent across all processors. Therefore, the frequency need + * is consistent across all processors. Therefore, the frequency need * only be queried upon application initialization. */ if (QueryPerformanceFrequency(&perfCounterFreq)) { @@ -244,7 +244,7 @@ TclpGetWideClicks(void) wideClick.perfCounter = 0; wideClick.microsecsScale = 1; } - + wideClick.initialized = 1; } if (wideClick.perfCounter) { @@ -265,7 +265,7 @@ TclpGetWideClicks(void) * * TclpWideClickInMicrosec -- * - * This procedure return scale to convert wide click values from the + * This procedure return scale to convert wide click values from the * TclpGetWideClicks native resolution to microsecond resolution * and back. * @@ -304,7 +304,7 @@ TclpWideClickInMicrosec(void) *---------------------------------------------------------------------- */ -Tcl_WideInt +Tcl_WideInt TclpGetMicroseconds(void) { Tcl_WideInt usecSincePosixEpoch; @@ -423,7 +423,7 @@ NativeCalc100NsTicks( LONGLONG curCounterFreq, LONGLONG curCounter ) { - return fileTimeLastCall + + return fileTimeLastCall + ((curCounter - perfCounterLastCall) * 10000000 / curCounterFreq); } @@ -811,7 +811,7 @@ UpdateTimeEachSecond(void) return; } QueryPerformanceCounter(&curPerfCounter); - + lastFileTime.QuadPart = curFileTime.QuadPart; /* @@ -879,7 +879,7 @@ UpdateTimeEachSecond(void) /* calculate new frequency and estimate drift to the next second */ vt1 = 20000000 + curFileTime.QuadPart; driftFreq = (estFreq * 20000000 / (vt1 - vt0)); - /* + /* * Avoid too large drifts (only half of the current difference), * that allows also be more accurate (aspire to the smallest tdiff), * so then we can prolong calibration interval by tdiff < 100000 @@ -887,13 +887,13 @@ UpdateTimeEachSecond(void) driftFreq = timeInfo.curCounterFreq.QuadPart + (driftFreq - timeInfo.curCounterFreq.QuadPart) / 2; - /* + /* * Average between estimated, 2 current and 5 drifted frequencies, * (do the soft drifting as possible) */ estFreq = (estFreq + 2 * timeInfo.curCounterFreq.QuadPart + 5 * driftFreq) / 8; } - + /* Avoid too large discrepancy from nominal frequency */ if (estFreq > 1003*timeInfo.nominalFreq.QuadPart/1000) { estFreq = 1003*timeInfo.nominalFreq.QuadPart/1000; @@ -902,9 +902,9 @@ UpdateTimeEachSecond(void) estFreq = 997*timeInfo.nominalFreq.QuadPart/1000; vt0 = curFileTime.QuadPart; } else if (vt0 != curFileTime.QuadPart) { - /* + /* * Be sure the clock ticks never backwards (avoid it by negative drifting) - * just compare native time (in 100-ns) before and hereafter using + * just compare native time (in 100-ns) before and hereafter using * new calibrated values) and do a small adjustment (short time freeze) */ LARGE_INTEGER newPerfCounter; |
