4 let b = Buffer.create len
in
10 | '
<'
-> Buffer.add_string
b "<"
11 | '
>'
-> Buffer.add_string
b ">"
12 | '
\''
-> Buffer.add_string
b "'"
13 | '
"' -> Buffer.add_string b ""
;"
14 | '&' -> Buffer.add_string b "&
;"
16 let code = Char.code c in
17 if code = 0 || code > 0x7f
19 Buffer.add_string b "&#
";
20 Buffer.add_string b (string_of_int code);
21 Buffer.add_char b ';';
23 else Buffer.add_char b c
34 let ic = open_in_bin statepath in
35 let hash = input_value ic in
41 prerr_endline ("Error loading state
" ^ Printexc.to_string exn)
45 print_endline "<llppconfig
>";
46 Hashtbl.iter (fun path (bookmarks, w, h) ->
49 printf "<doc width
=\"%d
\" height
=\"%d
\">\n"
52 printf " <![CDATA
[%s
]]>\n" path;
55 printf "<doc path
=\"%s
\" width
=\"%d
\" height
=\"%d
\">\n"
56 (enent path 0 (String.length path)) w h
62 printf " <bookmarks
>\n";
64 List.iter (fun (title, level, page, rely) ->
66 (* " <bookmark page
=\"%d
\" rely
=\"%f
\"><![CDATA
[%s
]]></bookmark
>\n" *)
67 " <item title
=\"%s
\" page
=\"%d
\" rely
=\"%f
\"/>\n"
68 title page rely) bookmarks;
69 printf " </bookmarks
>";
73 print_endline "</llppconfig
>";
76 let _ = main Sys.argv.(1);;