|
|
|
@ -128,29 +128,25 @@
|
|
|
|
|
previous-wrap-ender
|
|
|
|
|
other-qs)]
|
|
|
|
|
[(empty? next-wrap-head)
|
|
|
|
|
(cond
|
|
|
|
|
[(empty? next-wrap-tail)
|
|
|
|
|
;; degenerate case where we have something big enough to trigger a wrap on its own,
|
|
|
|
|
;; and nothing left in next-wrap-head or next-wrap-tail.
|
|
|
|
|
;; so we put it in a wrap on its own, because otherwise we can't proceed
|
|
|
|
|
;; though it will look screwy
|
|
|
|
|
(debug-report 'making-the-best-of-a-bad-situation)
|
|
|
|
|
(loop (cons (finish-wrap (list q) previous-wrap-ender wrap-idx) wraps)
|
|
|
|
|
(wrap-count wrap-idx q)
|
|
|
|
|
null
|
|
|
|
|
null
|
|
|
|
|
#false
|
|
|
|
|
q
|
|
|
|
|
(cdr qs))]
|
|
|
|
|
[else
|
|
|
|
|
(debug-report 'would-overflow-hard-without-captured-break)
|
|
|
|
|
(loop (cons (finish-wrap next-wrap-tail previous-wrap-ender wrap-idx) wraps)
|
|
|
|
|
(wrap-count wrap-idx q)
|
|
|
|
|
null
|
|
|
|
|
null
|
|
|
|
|
#false
|
|
|
|
|
(car next-wrap-tail)
|
|
|
|
|
qs)])]
|
|
|
|
|
(define-values (next-wrap-qs other-qs)
|
|
|
|
|
(cond
|
|
|
|
|
[(empty? next-wrap-tail)
|
|
|
|
|
;; degenerate case where q is big enough to trigger a wrap on its own,
|
|
|
|
|
;; but nothing left in next-wrap-head or next-wrap-tail.
|
|
|
|
|
;; so we put it in its own wrap and recur, because otherwise we can't proceed
|
|
|
|
|
;; though it will look screwy
|
|
|
|
|
(debug-report 'making-the-best-of-a-bad-situation)
|
|
|
|
|
(values (list q) (cdr qs))]
|
|
|
|
|
[else
|
|
|
|
|
(debug-report 'would-overflow-hard-without-captured-break)
|
|
|
|
|
(values next-wrap-tail qs)]))
|
|
|
|
|
(loop (cons (finish-wrap next-wrap-qs previous-wrap-ender wrap-idx) wraps)
|
|
|
|
|
(wrap-count wrap-idx q)
|
|
|
|
|
null
|
|
|
|
|
null
|
|
|
|
|
#false
|
|
|
|
|
(car next-wrap-qs)
|
|
|
|
|
other-qs)]
|
|
|
|
|
[else ; finish the wrap & reset the line without consuming a quad
|
|
|
|
|
(loop (cons (finish-wrap next-wrap-head previous-wrap-ender wrap-idx) wraps)
|
|
|
|
|
(wrap-count wrap-idx q)
|
|
|
|
|