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