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