Skip to content

Commit

Permalink
Fix one source of Subscript exceptions in Holmake
Browse files Browse the repository at this point in the history
The rlquash_to utility function didn't correctly handle desired widths
of 0.

Closes #966
  • Loading branch information
mn200 committed Nov 8, 2021
1 parent 3daa77f commit b51b4f1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tools/Holmake/poly/MB_Monitor.sml
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,21 @@ fun prettydir dir =

(* right align, and put dots on left *)
fun rlsquash_to wdth s =
if size s < wdth then
if wdth <= 0 then ""
else if size s < wdth then
StringCvt.padLeft #" " wdth s
else if wdth <= 6 then
(* 1 <= wdth <= 6 /\ wdth <= size s ==>
size s + 1 - wdth IN [1..size s]
and String.extract(s, size s, NONE) returns empty string
*)
" " ^ String.extract(s, size s + 1 - wdth, NONE)
else " ..." ^ String.extract(s, size s + 4 - wdth, NONE)
else
(* 6 < wdth <= size s ==>
size s + 4 - wdth IN [4..size s - 3]
4 is fine as size s > 6, and size s - 3 < size s
*)
" ..." ^ String.extract(s, size s + 4 - wdth, NONE)

fun new {info,warn,genLogFile,time_limit,multidir} =
let
Expand Down

0 comments on commit b51b4f1

Please sign in to comment.