let cells_to_matrix table =
let rows, cols = nb_rows table, table.col_nb in
let mat = Array.make_matrix (rows + 1) (cols) `none in
let rec iter_on_cells cur_row cur_col = function
| [] -> ()
| cell :: t ->
for i = 0 to cell.rows_used - 1 do
for j = 0 to cell.cols_used - 1 do
if i = 0 && j = 0 then (
mat.(cur_row).(cur_col) <- `cell cell;
) else (
mat.(cur_row + i).(cur_col + j) <-
`filled (cur_row, cur_col);
);
done;
done;
let next_row, next_col =
matrix_next_coordinates mat table cur_row cur_col in
iter_on_cells next_row next_col t
in
iter_on_cells 0 0 (List.rev table.cells);
(rows, cols, mat)