]> matita.cs.unibo.it Git - helm.git/blob - helm/www/lambdadelta/bin/xhtbl/table.ml
planned dehyphenation of lambdadelta eventually took place!
[helm.git] / helm / www / lambdadelta / bin / xhtbl / table.ml
1 type css = string list
2
3 type size = {
4    y : int;         (* first row *)
5    x : int;         (* first column *)
6    rf: int;         (* finite rows *)
7    cf: int;         (* finite columns *)
8    ri: int;         (* infinite rows *)
9    ci: int;         (* infinite columns *)
10    p : bool option; (* parent kind *)
11 }
12
13 type border = {
14    n: bool; (* north *)
15    s: bool; (* south *)
16    e: bool; (* east *)
17    w: bool; (* west *)
18 }
19
20 type key = Text of string list
21          | Glue of int option
22
23 type table = {
24    mutable tc: css;    (* css classes *)
25    mutable ts: size;   (* dimension *)
26            tb: border; (* border *)
27            te: entry;  (* contents *)
28            ti: int;    (* table identifier *)
29 }
30
31 and entry = Key  of key
32           | Line of bool * table list (* true for a row *)
33
34 let id =
35    let current = ref 0 in
36    fun () -> incr current; !current
37
38 let no_size = {
39    y = 0; x = 0; rf = 0; cf = 0; ri = 0; ci = 0; p = None;
40 }
41
42 let border b = {
43    n = b; s = b; e = b; w = b;
44 }
45
46 let mk_key k tc = {
47    ts = no_size; tb = border false; te = Key k; tc = tc;
48    ti = id ();
49 }
50
51 let mk_line b tl tc = {
52    ts = no_size; tb = border b; te = Line (b, tl); tc = tc;
53    ti = id ();
54 }