Magic
[llpp.git] / genconfstruct.sh
blob683caeb270f6d338a65f3b455d3b20121dc8c7e2
1 #!/bin/sh
2 set -eu
4 cat<<EOF
5 type rgb = (float * float * float)
6 and rgba = (float * float * float * float)
7 and fitmodel = | FitWidth | FitProportional | FitPage
8 and irect = (int * int * int * int)
9 and colorspace = | Rgb | Gray
10 and keymap =
11 | KMinsrt of key | KMinsrl of key list | KMmulti of (key list * key list)
12 and key = (int * int)
13 and keyhash = (key, keymap) Hashtbl.t
14 and keystate = | KSnone | KSinto of (key list * key list)
15 and css = string and dcf = string and hcs = string
16 and columns =
17 | Csingle of singlecolumn
18 | Cmulti of multicolumns
19 | Csplit of splitcolumns
20 and mark =
21 | MarkPage
22 | MarkBlock
23 | MarkLine
24 | MarkWord
25 and multicolumns = (multicol * pagegeom)
26 and singlecolumn = pagegeom
27 and splitcolumns = (columncount * pagegeom)
28 and pagegeom = (pdimno * x * y * (pageno * w * h * leftx)) array
29 and multicol = (columncount * covercount * covercount)
30 and columncount = int
31 and pdimno = int and pageno = int
32 and x = int and y = int and leftx = int and w = int and h = int
33 and covercount = int
34 and memsize = int and texcount = int
35 and sliceheight = int
36 and zoom = float
37 let scrollbvv = 1 and scrollbhv = 2
38 EOF
40 init=
41 assi=
42 g() {
43 printf "mutable $1:$2;"
44 init="$init $1=$3;"
45 assi="$assi dst.$1 <- src.$1;"
47 i() { g "$1" int "$2"; }
48 b() { g "$1" bool "$2"; }
49 f() { g "$1" float "$2"; }
50 s() { g "$1" string "$2"; }
51 K() {
52 printf "mutable $1:$2;\n"
53 init="$init $1=$3;"
54 assi="$assi dst.keyhashes <- copykeyhashes src;"
56 P() {
57 printf "mutable $1 : float option;\n"
58 init="$init $1=None;"
59 assi="$assi dst.pax <- if src.pax = None then None else Some 0.0;"
61 echo "type conf = {"
62 i scrollbw 7
63 i scrollh 12
64 i scrollb "scrollbhv lor scrollbvv"
65 b icase true
66 b preload true
67 i pagebias 0
68 b verbose false
69 b debug false
70 i scrollstep 24
71 i hscrollstep 24
72 b maxhfit true
73 i autoscrollstep 2
74 b hlinks false
75 b underinfo false
76 i interpagespace 2
77 f zoom 1.0
78 b presentation false
79 i angle 0
80 i cwinw 1800
81 i cwinh 1500
82 g fitmodel fitmodel FitProportional
83 b trimmargins false
84 g trimfuzz irect "(0,0,0,0)"
85 g memlimit memsize "128 lsl 20"
86 g texcount texcount 256
87 g sliceheight sliceheight 24
88 g thumbw w 76
89 g bgcolor rgb "(0.5, 0.5, 0.5)"
90 g papercolor rgba "(1.0, 1.0, 1.0, 0.0)"
91 g sbarcolor rgba "(0.64, 0.64, 0.64, 0.7)"
92 g sbarhndlcolor rgba "(0.0, 0.0, 0.0, 0.7)"
93 g texturecolor rgba "(0.0, 0.0, 0.0, 0.0)"
94 i tilew 2048
95 i tileh 2048
96 g mustoresize memsize "256 lsl 20"
97 i aalevel 8
98 s urilauncher "{|$uopen|}"
99 s pathlauncher "{|$print|}"
100 g colorspace colorspace Rgb
101 b invert false
102 f colorscale 1.
103 g columns columns "Csingle [||]"
104 g beyecolumns "columncount option" None
105 s selcmd "{|$clip|}"
106 s pastecmd "{|$paste|}"
107 s paxcmd '{|echo PAX "%s">&2|}'
108 s passcmd Utils.E.s
109 s savecmd Utils.E.s
110 b updatecurs true
111 K keyhashes '(string * keyhash) list' \
112 '(let mk n = (n, Hashtbl.create 1) in
113 [ mk "global"; mk "info" ; mk "help"; mk "outline"; mk "listview"
114 ; mk "birdseye"; mk "textentry"; mk "links"; mk "view" ])'
115 i hfsize 'Wsi.fontsizescale 12'
116 f pgscale 1.
117 b wheelbypage false
118 s stcmd "{|echo SyncTex|}"
119 b riani false
120 g paxmark mark MarkWord
121 b leftscroll false
122 s title Utils.E.s
123 f lastvisit 0.0
124 b annotinline true
125 b coarseprespos false
126 g css css Utils.E.s
127 b usedoccss true
128 s key Utils.E.s
129 P pax
130 g dcf dcf Utils.E.s
131 s hcs "{|aoeuidhtns|}"
132 i rlw 420
133 i rlh 595
134 i rlem 11
136 cat <<EOF
138 let copykeyhashes c = List.map (fun (k, v) -> k, Hashtbl.copy v) c.keyhashes
139 let defconf = {$init}
140 let setconf dst src = $assi;