Commit aea0ca4a authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-03-16 13:04:06 by cvscast] Empty log message

Original author: cvscast
Date: 2003-03-16 13:04:06+00:00
parent d98466d0
......@@ -17,6 +17,7 @@ let blit a1 ofs1 a2 ofs2 len =
for i = 0 to len - 1 do
Array.unsafe_set a2 (ofs2 + i) (Array.unsafe_get a1 (ofs1 + i))
done
(* important to do this in the increasing order ... *)
let ensure_room n =
......@@ -32,6 +33,7 @@ let make_result_prod v1 r1 v2 r2 v (code,r) =
if n = 0 then code else (
ensure_room n;
let buf = !buffer in
let c = !cursor in
for a = 0 to n - 1 do
let x = match Array.unsafe_get r a with
| Catch -> v
......@@ -42,9 +44,9 @@ let make_result_prod v1 r1 v2 r2 v (code,r) =
Pair ((if (i < 0) then v1 else buf.(r1 + i)),
(if (j < 0) then v2 else buf.(r2 + j)))
in
buf.(!cursor + a) <- x
buf.(c + a) <- x
done;
if r1 <> !cursor then blit buf !cursor buf r1 n;
if r1 <> c then blit buf c buf r1 n;
cursor := r1 + n; (* clean space for GC ? *)
code )
......@@ -186,7 +188,7 @@ and run_disp_record1 other v1 rem = function
and run_disp_record2 other v1 r1 rem = function
| Impossible -> assert false
| Ignore r -> make_result_prod v1 r1 Absent !cursor Absent r
| Ignore r -> make_result_prod v1 r1 Absent 0 Absent r
| TailCall d2 -> run_disp_record_loop other rem d2
| Dispatch (d2,b2) ->
let r2 = !cursor in
......@@ -216,7 +218,7 @@ and run_disp_string_char d ch =
and run_disp_string2 r1 i j s q = function
| Impossible -> assert false
| Ignore r ->
make_result_string i j s q r1 !cursor r
make_result_string i j s q r1 0 r
| TailCall d2 -> run_disp_string_loop i j s q d2
| Dispatch (d2,b2) ->
let r2 = !cursor in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment