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