1 /*****************************************************************************/
2 /* LibreDWG - free implementation of the DWG file format */
3 /* */
4 /* Copyright (C) 2018-2020 Free Software Foundation, Inc. */
5 /* */
6 /* This library is free software, licensed under the terms of the GNU */
7 /* General Public License as published by the Free Software Foundation, */
8 /* either version 3 of the License, or (at your option) any later version. */
9 /* You should have received a copy of the GNU General Public License */
10 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
11 /*****************************************************************************/
12
13 /*
14 * unknown.c: decode unknown bitstreams
15 * written by Reini Urban
16 */
17
18 #ifndef UNKNOWN_H
19 #define UNKNOWN_H
20
21 struct _unknown_field
22 {
23 int code;
24 const char *value;
25 unsigned char *bytes;
26 int num_bits;
27 Dwg_Bits type;
28 const char *name; // in dwg.spec
29 // number of occurrences of this type:value pair (max 1423)
30 unsigned short num;
31 int pos[5]; // 5x found bit offset in dxf->bytes or -1 if not found
32 // many typical values are 5x found (handle 0, BL 2)
33 };
34
35 struct _unknown_dxf
36 {
37 const char *name;
38 const char *dxf;
39 const unsigned int handle;
40 const char *bytes;
41 const int is_entity;
42 const int num_bits; // size of dumped unknown_bits TF
43 const int commonsize;
44 const int hdloff;
45 const int strsize;
46 const int hdlsize;
47 const int bitsize;
48 const struct _unknown_field *fields;
49 };
50
51 // dynamic helper companion
52 struct _dxf
53 {
54 unsigned char *found; // coverage per bit for found 1
55 unsigned char *possible; // coverage for mult. finds >1
56 int num_bits; // copy of unknown_dxf.num_bits
57 int num_filled;
58 int num_empty;
59 int num_possible;
60 double percentage;
61 };
62
63 #endif