output view: make items selectable and use system colours
[pspp] / src / output / spv / light-binary.grammar
1 # PSPP - a program for statistical analysis.
2 # Copyright (C) 2017, 2018, 2019 Free Software Foundation, Inc.
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 Table =>
18    Header Titles Footnotes
19    Areas Borders PrintSettings[ps] TableSettings[ts] Formats
20    Dimensions Axes Cells
21    01?
22
23 Header =>
24    01 00
25    int32[version]
26    bool[x0]
27    bool[x1]
28    bool[rotate-inner-column-labels]
29    bool[rotate-outer-row-labels]
30    bool[x2]
31    int32[x3]
32    int32[min-col-width] int32[max-col-width]
33    int32[min-row-height] int32[max-row-height]
34    int64[table-id]
35
36 Titles =>
37    Value[title] 01?
38    Value[subtype] 01? 31
39    Value[user-title] 01?
40    (31 Value[corner-text] | 58)
41    (31 Value[caption] | 58)
42
43 Footnotes => int32[n-footnotes] Footnote*[n-footnotes]
44 Footnote => Value[text] (58 | 31 Value[marker]) int32[show]
45
46 Areas => 00? Area*8[areas]
47 Area =>
48    byte[index] 31
49    string[typeface] float[size] int32[style] bool[underline]
50    int32[halign] int32[valign]
51    string[fg-color] string[bg-color]
52    bool[alternate] string[alt-fg-color] string[alt-bg-color]
53    v3(int32[left-margin] int32[right-margin] int32[top-margin] int32[bottom-margin])
54
55 Borders =>
56    count(
57        ib1
58        be32[n-borders] Border*[n-borders]
59        bool[show-grid-lines]
60        00 00 00)
61
62 Border =>
63    be32[border-type]
64    be32[stroke-type]
65    be32[color]
66
67 PrintSettings =>
68    count(
69        ib1
70        bool[all-layers]
71        bool[paginate-layers]
72        bool[fit-width]
73        bool[fit-length]
74        bool[top-continuation]
75        bool[bottom-continuation]
76        be32[n-orphan-lines]
77        bestring[continuation-string])
78
79 TableSettings =>
80    count(
81      v3(
82        ib1
83        be32[x5]
84        be32[current-layer]
85        bool[omit-empty]
86        bool[show-row-labels-in-corner]
87        bool[show-alphabetic-markers]
88        bool[footnote-marker-superscripts]
89        byte[x6]
90        becount(
91          Breakpoints[row-breaks] Breakpoints[col-breaks]
92          Keeps[row-keeps] Keeps[col-keeps]
93          PointKeeps[row-point-keeps] PointKeeps[col-point-keeps]
94        )
95        bestring[notes]
96        bestring[table-look]
97        )...)
98
99 Breakpoints => be32[n-breaks] be32*[n-breaks]
100
101 Keeps => be32[n-keeps] Keep*[n-keeps]
102 Keep => be32[offset] be32[n]
103
104 PointKeeps => be32[n-point-keeps] PointKeep*[n-point-keeps]
105 PointKeep => be32[offset] be32 be32
106
107 Formats =>
108    int32[n-widths] int32*[n-widths]
109    string[locale]
110    int32[current-layer]
111    bool[x7] bool[x8] bool[x9]
112    Y0
113    CustomCurrency
114    count(
115      v1(X0?)
116      v3(count(X1 count(X2)) count(X3)))
117 Y0 => int32[epoch] byte[decimal] byte[grouping]
118 CustomCurrency => int32[n-ccs] string*[n-ccs]
119
120 X0 => byte*14 Y1 Y2
121 Y1 =>
122    string[command] string[command-local]
123    string[language] string[charset] string[locale]
124    bool[x10] bool[x11] bool[x12] bool[x13]
125    Y0
126 Y2 => CustomCurrency byte[missing] bool[x17]
127
128 X1 =>
129    bool[x14] byte[x15] bool[x16]
130    byte[lang]
131    byte[show-variables]
132    byte[show-values]
133    int32[x18] int32[x19]
134    00*17
135    bool[x20]
136    bool[show-caption]
137
138 X2 =>
139    int32[n-row-heights] int32*[n-row-heights]
140    int32[n-style-map] StyleMap*[n-style-map]
141    int32[n-styles] StylePair*[n-styles]
142    count((i0 i0)?)
143 StyleMap => int64[cell-index] int16[style-index]
144
145 X3 =>
146    01 00 byte[x21] 00 00 00
147    Y1
148    double[small] 01
149    (string[dataset] string[datafile] i0 int32[date] i0)?
150    Y2
151    (int32[x22] i0)?
152
153 Dimensions => int32[n-dims] Dimension*[n-dims]
154 Dimension =>
155     Value[name] DimProperties[props]
156     int32[n-categories] Category*[n-categories]
157 DimProperties =>
158    byte[x1]
159    byte[x2]
160    int32[x3]
161    bool[hide-dim-label]
162    bool[hide-all-labels]
163    01 int32[dim-index]
164
165 Category => Value[name] (Leaf | Group)
166 Leaf => 00 00 00 i2 int32[leaf-index] i0
167 Group =>
168    bool[merge] 00 01 int32[x23]
169    i-1 int32[n-subcategories] Category*[n-subcategories]
170
171 Axes =>
172    int32[n-layers] int32[n-rows] int32[n-columns]
173    int32*[n-layers] int32*[n-rows] int32*[n-columns]
174
175 Cells => int32[n-cells] Cell*[n-cells]
176 Cell => int64[index] v1(00?) Value
177
178 Value =>
179   00? 00? 00? 00?
180   case(
181       01 ValueMod int32[format] double[x]
182     | 02 ValueMod int32[format] double[x]
183       string[var-name] string[value-label] byte[show]
184     | 03 string[local] ValueMod string[id] string[c] bool[fixed]
185     | 04 ValueMod int32[format] string[value-label] string[var-name]
186       byte[show] string[s]
187     | 05 ValueMod string[var-name] string[var-label] byte[show]
188     | 06 string[local] ValueMod string[id] string[c]
189     | else ValueMod string[template] int32[n-args] Argument*[n-args]
190   )[type]
191 Argument =>
192     i0 Value[value]
193   | int32[n-values] i0 Value*[n-values]
194
195 ValueMod =>
196     58
197   | 31
198     int32[n-refs] int16*[n-refs]
199     int32[n-subscripts] string*[n-subscripts]
200     v1(00 (i1 | i2) 00? 00? int32 00? 00?)
201     v3(count(TemplateString StylePair))
202
203 TemplateString => count((count((i0 (58 | 31 55))?) (58 | 31 string[id]))?)
204
205 StylePair =>
206     (31 FontStyle | 58)
207     (31 CellStyle | 58)
208
209 FontStyle =>
210     bool[bold] bool[italic] bool[underline] bool[show]
211     string[fg-color] string[bg-color]
212     string[typeface] byte[size]
213
214 CellStyle =>
215     int32[halign] int32[valign] double[decimal-offset]
216     int16[left-margin] int16[right-margin]
217     int16[top-margin] int16[bottom-margin]