diff options
| author | Philipp Gesang <phg42.2a@gmail.com> | 2014-03-23 17:57:42 +0100 | 
|---|---|---|
| committer | Philipp Gesang <phg42.2a@gmail.com> | 2014-03-23 17:57:42 +0100 | 
| commit | 2d7567b653cabaa0d259996a47227cefa9b54563 (patch) | |
| tree | 165a5d560820f45381f65e9c5f9445fcf5feb634 /src/luaotfload-tool.lua | |
| parent | c160c40265b5eb5670730906614997ad2545f94d (diff) | |
| download | luaotfload-2d7567b653cabaa0d259996a47227cefa9b54563.tar.gz | |
[db,tool] implement termination of bisect session
Diffstat (limited to 'src/luaotfload-tool.lua')
| -rwxr-xr-x | src/luaotfload-tool.lua | 27 | 
1 files changed, 24 insertions, 3 deletions
diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 9529a4d..2301636 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -891,6 +891,21 @@ end  --[[doc-- +    bisect_terminate -- Wrap up a bisect session by printing the +    offending font and removing the state file. + +--doc]]-- + +local bisect_terminate = function (nsteps, culprit) +    report ("info", 1, "bisect", +            "Bisection completed after %d steps.", nsteps) +    report ("info", 0, "bisect", +            "Bad file: %s.", names.nth_font_filename (culprit)) +    return bisect_stop () +end + +--[[doc-- +      bisect_set -- Prepare the next bisection step by setting high, low,      and pivot to new values. @@ -911,13 +926,19 @@ local bisect_set = function (outcome)              nsteps, lo, hi, pivot)      if outcome == "bad" then -        hi    = pivot +        hi = pivot +        if lo >= hi then --- complete +            return bisect_terminate (nsteps, lo) +        end          pivot = mathfloor ((lo + hi) / 2)          report ("info", 0, "bisect",                  "Continuing with the lower segment: lo=%d, hi=%d, pivot=%d.",                  lo, hi, pivot)      elseif outcome == "good" then -        lo    = pivot +        lo = pivot + 1 +        if lo >= hi then --- complete +            return bisect_terminate (nsteps, lo) +        end          pivot = mathfloor ((lo + hi) / 2)          report ("info", 0, "bisect",                  "Continuing with the upper segment: lo=%d, hi=%d, pivot=%d.", @@ -987,7 +1008,7 @@ end  local bisect_modes = {      start   = bisect_start,      good    = function () return bisect_set "good" end, -    bad     = function () return bisect_set "bad" end, +    bad     = function () return bisect_set "bad"  end,      stop    = bisect_stop,      status  = bisect_status,      run     = bisect_run,  | 
