8 module TU = TextUnparser
13 module XU = XmlUnparser
30 let includes, tables = ref [], ref []
32 let set_output_dir s = O.output_dir := s
34 let process_directive och bname (name, table, css) =
35 tables := name :: !tables;
36 if !O.d0 then TU.debug table;
37 if not !O.p0 then begin
38 let size = P1.process table in
39 if !O.d1 then TU.debug table;
40 if not !O.p1 then begin
41 let matrix = M.make size in
42 let _ = P2.process table matrix in
43 if !O.d2 then TU.debug table;
44 if not !O.p2 then P3.process css matrix;
45 let name = if name = "" then bname else name in
46 XU.output och name matrix
50 let process_file fname =
51 let bname = F.chop_extension (F.basename fname) in
52 let ich = open_in fname in
53 let lexbuf = Lexing.from_channel ich in
54 let ds = TP.script TL.token lexbuf in
55 close_in ich; includes := bname :: !includes;
56 let och = XU.open_out true bname in
57 L.iter (process_directive och bname) ds;
62 "-L", A.Set O.debug_lexer, help_L;
63 "-O", A.String set_output_dir, help_O;
64 "-X", A.Unit O.clear, help_X;
65 "-d0", A.Set O.d0, help_d0;
66 "-d1", A.Set O.d1, help_d1;
67 "-d2", A.Set O.d2, help_d2;
68 "-e1", A.Set O.e1, help_e1;
69 "-e2", A.Set O.e2, help_e2;
70 "-p0", A.Set O.p0, help_p0;
71 "-p1", A.Set O.p1, help_p1;
72 "-p2", A.Set O.p2, help_p2;
74 XU.write_hook hook !includes !tables