1 /*****************************************************************************/
2 /*  LibreDWG - free implementation of the DWG file format                    */
3 /*                                                                           */
4 /*  Copyright (C) 2009-2010,2018-2021 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  * dwg.h: main public header file (the other variant is dwg_api.h)
15  *
16  * written by Felipe Castro
17  * modified by Felipe Corrêa da Silva Sances
18  * modified by Rodrigo Rodrigues da Silva
19  * modified by Till Heuschmann
20  * modified by Reini Urban
21  */
22 
23 #ifndef DWG_H
24 #define DWG_H
25 
26 #define LIBREDWG_VERSION_MAJOR 0
27 #define LIBREDWG_VERSION_MINOR 10
28 #define LIBREDWG_VERSION       ((LIBREDWG_VERSION_MAJOR * 100) + LIBREDWG_VERSION_MINOR)
29 #define LIBREDWG_SO_VERSION    0:10:0
30 
31 /* for uint64_t, but not in swig */
32 #ifndef SWIGIMPORTED
33 #  include <stdint.h>
34 #  include <inttypes.h>
35 
36 /* wchar for R2007+ support
37  * But we need the win32 UTF-16 variant, not UTF-32.
38  * i.e. only on Windows, AIX, Solaris
39  */
40 # if defined(HAVE_WCHAR_H) && defined(SIZEOF_WCHAR_T) && SIZEOF_WCHAR_T == 2
41 #  include <wchar.h>
42 #  define HAVE_NATIVE_WCHAR2
43 #  define DWGCHAR wchar_t
44 #  define dwg_wchar_t wchar_t
45 # endif
46 #endif
47 
48 #ifndef EXPORT
49 # ifdef SWIG
50 #  define EXPORT extern
51 # elif defined(_WIN32) && defined(ENABLE_SHARED)
52 #  ifdef DLL_EXPORT
53 #    define EXPORT  __declspec(dllexport)
54 #  else
55 #    define EXPORT  __declspec(dllimport)
56 #  endif
57 # elif defined(__clang__) || defined(__clang) || \
58         (defined( __GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 303)
59 #  define EXPORT __attribute__((visibility("default")))
60 # else
61 #  define EXPORT
62 # endif
63 #endif
64 
65 #ifdef __cplusplus
66 extern "C" {
67 # undef restrict
68 # define restrict __restrict
69 #endif
70 
71 #define BITCODE_DOUBLE double
72 
73 /* The FORMAT_* are for logging only */
74 typedef unsigned char BITCODE_RC;
75 #ifdef _MSC_VER
76 # define FORMAT_RC "0x%2x"
77 # define SCANF_2X "%2X"
78 #else
79 # define FORMAT_RC "0x%hhx"
80 # define SCANF_2X "%2hhX"
81 #endif
82 #define FORMAT_RCd "%d"
83 #define FORMAT_RCu "%u"
84 #define FORMAT_RCx "0x%x"
85 typedef signed char BITCODE_RCd;
86 typedef unsigned char BITCODE_RCu;
87 typedef unsigned char BITCODE_RCx;
88 typedef unsigned char BITCODE_B;
89 #define FORMAT_B "%d"
90 typedef unsigned char BITCODE_BB;
91 #define FORMAT_BB "%u"
92 /* Since R24 */
93 typedef unsigned char BITCODE_3B;
94 #define FORMAT_3B "%u"
95 //#ifdef HAVE_STDINT_H
96 //#define BITCODE_BS uint16_t
97 //#define BITCODE_RS uint16_t
98 //#define BITCODE_BL uint32_t
99 //#define BITCODE_RL uint32_t
100 //#define BITCODE_BLd int32_t
101 //#define BITCODE_RLd int32_t
102 typedef uint16_t BITCODE_BS;
103 typedef int16_t BITCODE_BSd;
104 typedef uint16_t BITCODE_BSx;
105 typedef uint16_t BITCODE_RS;
106 typedef uint16_t BITCODE_RSx;
107 typedef uint32_t BITCODE_BL;
108 typedef uint32_t BITCODE_BLx;
109 typedef int32_t BITCODE_BLd;
110 typedef uint32_t BITCODE_RL;
111 typedef uint32_t BITCODE_RLx;
112 typedef int32_t BITCODE_RLd;
113 /* e.g. old cygwin 64 vs 32 */
114 /*#else
115 # if defined(__WORDSIZE) && __WORDSIZE == 64
116   typedef unsigned short int BITCODE_BS;
117   typedef unsigned short int BITCODE_RS;
118   typedef unsigned int BITCODE_BL;
119   typedef unsigned int BITCODE_RL;
120   typedef int BITCODE_BLd;
121   typedef int BITCODE_RLd;
122 # else
123   typedef unsigned short int BITCODE_BS;
124   typedef unsigned short int BITCODE_RS;
125   typedef unsigned long BITCODE_BL;
126   typedef unsigned long BITCODE_RL;
127   typedef long BITCODE_BLd;
128   typedef long BITCODE_RLd;
129 # endif
130 #endif
131 */
132 //#ifdef HAVE_INTTYPES_H
133 #define FORMAT_BS "%" PRIu16
134 #define FORMAT_BSd "%" PRId16
135 #define FORMAT_BSx "0x%" PRIx16
136 #define FORMAT_RS "%" PRIu16
137 #define FORMAT_RSx "0x%" PRIx16
138 #define FORMAT_BL "%" PRIu32
139 #define FORMAT_RL "%" PRIu32
140 #define FORMAT_BLd "%" PRId32
141 #define FORMAT_RLd "%" PRId32
142 #define FORMAT_RLx "0x%" PRIx32
143 #define FORMAT_BLX "%" PRIX32
144 #define FORMAT_BLx "0x%" PRIx32
145 /*#else
146 # define FORMAT_BS "%hu"
147 # define FORMAT_RS "%hu"
148 # define FORMAT_BL "%u"
149 # define FORMAT_RL "%u"
150 # define FORMAT_BLd "%d"
151 # define FORMAT_RLd "%d"
152 # define FORMAT_BLX "%X"
153 # define FORMAT_BLx "%x"
154 #endif
155 */
156 typedef long BITCODE_MC;
157 #define FORMAT_MC  "%ld"
158 typedef unsigned long BITCODE_UMC;
159 #define FORMAT_UMC "%lu"
160 typedef BITCODE_BL BITCODE_MS;
161 #define FORMAT_MS FORMAT_BL
162 typedef BITCODE_DOUBLE BITCODE_RD;
163 #define FORMAT_RD "%f"
164 /* Since R2004 */
165 typedef uint64_t BITCODE_RLL;
166 typedef uint64_t BITCODE_BLL;
167 #define FORMAT_RLL "0x%" PRIx64
168 #define FORMAT_BLL "%" PRIu64
169 #ifndef HAVE_NATIVE_WCHAR2
170   typedef BITCODE_RS dwg_wchar_t;
171 # define DWGCHAR dwg_wchar_t
172 #endif
173 typedef unsigned char* BITCODE_TF;
174 #define FORMAT_TF "\"%s\""
175 typedef char* BITCODE_TV;
176 #define FORMAT_TV "\"%s\""
177 #define BITCODE_T16 BITCODE_TV
178 #define FORMAT_T16 "\"%s\""
179 #define BITCODE_T32 BITCODE_TV
180 #define FORMAT_T32 "\"%s\""
181 #define BITCODE_TU32 BITCODE_TV
182 #define FORMAT_TU32 "\"%s\""
183 typedef BITCODE_DOUBLE BITCODE_BT;
184 #define FORMAT_BT "%f"
185 typedef BITCODE_DOUBLE BITCODE_DD;
186 #define FORMAT_DD "%f"
187 typedef BITCODE_DOUBLE BITCODE_BD;
188 #define FORMAT_BD "%f"
189 typedef BITCODE_RC BITCODE_4BITS;
190 #define FORMAT_4BITS "%1x"
191 /* double stored as string. ARCALIGNEDTEXT */
192 typedef BITCODE_TV BITCODE_D2T;
193 #define FORMAT_D2T "%s"
194 
195 /* TODO: implement version dependent string parsing */
196 /* encode codepages/utf8 */
197 #define BITCODE_T  BITCODE_TV
198 #ifdef HAVE_NATIVE_WCHAR2
199   typedef dwg_wchar_t* BITCODE_TU; /* native UCS-2 wchar_t */
200 # define FORMAT_TU "\"%ls\""
201 #else
202   typedef BITCODE_RS* BITCODE_TU;  /* UCS-2 unicode text */
203 # define FORMAT_TU "\"%hn\""       /* will print garbage */
204 #endif
205 
206 typedef struct _dwg_time_bll
207 {
208   BITCODE_BL days;
209   BITCODE_BL ms;
210   BITCODE_BD value;
211 } Dwg_Bitcode_TimeBLL;
212 
213 typedef struct _dwg_bitcode_2rd
214 {
215   BITCODE_RD x;
216   BITCODE_RD y;
217 } Dwg_Bitcode_2RD;
218 
219 typedef struct _dwg_bitcode_2bd
220 {
221   BITCODE_BD x;
222   BITCODE_BD y;
223 } Dwg_Bitcode_2BD;
224 
225 typedef struct _dwg_bitcode_3rd
226 {
227   BITCODE_RD x;
228   BITCODE_RD y;
229   BITCODE_RD z;
230 } Dwg_Bitcode_3RD;
231 
232 typedef struct _dwg_bitcode_3bd
233 {
234   BITCODE_BD x;
235   BITCODE_BD y;
236   BITCODE_BD z;
237 } Dwg_Bitcode_3BD;
238 
239 typedef Dwg_Bitcode_TimeBLL BITCODE_TIMEBLL;
240 typedef Dwg_Bitcode_TimeBLL BITCODE_TIMERLL;
241 /* #define FORMAT_TIMEBLL FORMAT_BL "." FORMAT_BL */
242 typedef Dwg_Bitcode_2RD  BITCODE_2RD;
243 typedef Dwg_Bitcode_2BD  BITCODE_2BD;
244 typedef Dwg_Bitcode_2BD  BITCODE_2DPOINT;
245 typedef Dwg_Bitcode_2BD  BITCODE_2BD_1;
246 typedef Dwg_Bitcode_3RD  BITCODE_3RD;
247 typedef Dwg_Bitcode_3BD  BITCODE_3BD;
248 typedef Dwg_Bitcode_3BD  BITCODE_3DPOINT;
249 typedef Dwg_Bitcode_3BD  BITCODE_3BD_1;
250 typedef Dwg_Bitcode_3BD  BITCODE_BE;
251 #define BITCODE_3DVECTOR BITCODE_3BD_1
252 
253 typedef enum DWG_VERSION_TYPE
254 {
255   R_INVALID,
256   R_1_1,	/* MC0.0  MicroCAD Release 1.1 */
257   R_1_2,	/* AC1.2  AutoCAD Release 1.2 */
258   R_1_3,	/* AC1.3  AutoCAD Release 1.3 */
259   R_1_4,	/* AC1.40 AutoCAD Release 1.4 */
260   R_1_402b,	/* AC402b AutoCAD Release 1.402b */
261   R_2_0,	/* AC1.50 AutoCAD Release 2.0 */
262   R_2_1,	/* AC2.10 AutoCAD Release 2.10 */
263   R_2_21,	/* AC2.21 AutoCAD Release 2.21 */
264   R_2_22,	/* AC2.22 AutoCAD Release 2.22 */
265   R_2_4,	/* AC1001 AutoCAD Release 2.4 */
266   R_2_5,	/* AC1002 AutoCAD Release 2.5 */
267   R_2_6,	/* AC1003 AutoCAD Release 2.6 */
268   R_9,		/* AC1004 AutoCAD Release 9 */
269   R_9c1,	/* AC1005 AutoCAD Release 9c1 */
270   R_10,		/* AC1006 AutoCAD Release 10 */
271   R_10c1,	/* AC1007 AutoCAD Release 10c1 */
272   R_10c2,	/* AC1008 AutoCAD Release 10c2 */
273   R_11,		/* AC1009 AutoCAD Release 11/12 (LT R1/R2) */
274   R_12,		/* AC1010 AutoCAD Release 12 */
275   R_12c1,	/* AC1011 AutoCAD Release 12c1 */
276   R_13,		/* AC1012 AutoCAD Release 13 */
277   R_13c3,	/* AC1013 AutoCAD Release 13C3 */
278   R_14,		/* AC1014 AutoCAD Release 14 */
279   R_2000,	/* AC1015 AutoCAD Release 2000 */
280   R_2004,	/* AC1018 AutoCAD Release 2004 (includes versions AC1019/0x19 and AC1020/0x1a) */
281   R_2007,	/* AC1021 AutoCAD Release 2007 - 2019*/
282   R_2010,	/* AC1024 AutoCAD Release 2010 - 2012 */
283   R_2013,	/* AC1027 AutoCAD Release 2013 - 2017 */
284   R_2018,	/* AC1032 AutoCAD Release 2018 - 2021 */
285   R_AFTER
286 } Dwg_Version_Type;
287 #define DWG_VERSIONS (int)(R_AFTER+1)
288 
289 typedef enum DWG_CLASS_STABILITY {
290   DWG_CLASS_STABLE,
291   DWG_CLASS_UNSTABLE,
292   DWG_CLASS_DEBUGGING,
293   DWG_CLASS_UNHANDLED
294 } Dwg_Class_Stability;
295 
296 /**
297  Object supertypes that exist in dwg-files.
298  */
299 typedef enum DWG_OBJECT_SUPERTYPE
300 {
301   DWG_SUPERTYPE_ENTITY, DWG_SUPERTYPE_OBJECT
302 } Dwg_Object_Supertype;
303 
304 /**
305  Object and Entity types that exist in dwg-files.
306  */
307 typedef enum DWG_OBJECT_TYPE
308 {
309   DWG_TYPE_UNUSED = 0x00,
310   DWG_TYPE_TEXT = 0x01,
311   DWG_TYPE_ATTRIB = 0x02,
312   DWG_TYPE_ATTDEF = 0x03,
313   DWG_TYPE_BLOCK = 0x04,
314   DWG_TYPE_ENDBLK = 0x05,
315   DWG_TYPE_SEQEND = 0x06,
316   DWG_TYPE_INSERT = 0x07,
317   DWG_TYPE_MINSERT = 0x08,
318   // DWG_TYPE_TRACE_old = 0x09, /* old TRACE r10-r11 only */
319   DWG_TYPE_VERTEX_2D = 0x0a,
320   DWG_TYPE_VERTEX_3D = 0x0b,
321   DWG_TYPE_VERTEX_MESH = 0x0c,
322   DWG_TYPE_VERTEX_PFACE = 0x0d,
323   DWG_TYPE_VERTEX_PFACE_FACE = 0x0e,
324   DWG_TYPE_POLYLINE_2D = 0x0f,
325   DWG_TYPE_POLYLINE_3D = 0x10,
326   DWG_TYPE_ARC = 0x11,
327   DWG_TYPE_CIRCLE = 0x12,
328   DWG_TYPE_LINE = 0x13,
329   DWG_TYPE_DIMENSION_ORDINATE = 0x14,
330   DWG_TYPE_DIMENSION_LINEAR = 0x15,
331   DWG_TYPE_DIMENSION_ALIGNED = 0x16,
332   DWG_TYPE_DIMENSION_ANG3PT = 0x17,
333   DWG_TYPE_DIMENSION_ANG2LN = 0x18,
334   DWG_TYPE_DIMENSION_RADIUS = 0x19,
335   DWG_TYPE_DIMENSION_DIAMETER = 0x1A,
336   DWG_TYPE_POINT = 0x1b,
337   DWG_TYPE__3DFACE = 0x1c,
338   DWG_TYPE_POLYLINE_PFACE = 0x1d,
339   DWG_TYPE_POLYLINE_MESH = 0x1e,
340   DWG_TYPE_SOLID = 0x1f,
341   DWG_TYPE_TRACE = 0x20,
342   DWG_TYPE_SHAPE = 0x21,
343   DWG_TYPE_VIEWPORT = 0x22,
344   DWG_TYPE_ELLIPSE = 0x23,
345   DWG_TYPE_SPLINE = 0x24,
346   DWG_TYPE_REGION = 0x25,
347   DWG_TYPE__3DSOLID = 0x26,
348   DWG_TYPE_BODY = 0x27,
349   DWG_TYPE_RAY = 0x28,
350   DWG_TYPE_XLINE = 0x29,
351   DWG_TYPE_DICTIONARY = 0x2a,
352   DWG_TYPE_OLEFRAME = 0x2b,
353   DWG_TYPE_MTEXT = 0x2c,
354   DWG_TYPE_LEADER = 0x2d,
355   DWG_TYPE_TOLERANCE = 0x2e,
356   DWG_TYPE_MLINE = 0x2f,
357   DWG_TYPE_BLOCK_CONTROL = 0x30,
358   DWG_TYPE_BLOCK_HEADER = 0x31,
359   DWG_TYPE_LAYER_CONTROL = 0x32,
360   DWG_TYPE_LAYER = 0x33,
361   DWG_TYPE_STYLE_CONTROL = 0x34, /* 52 SHAPEFILE_CONTROL */
362   DWG_TYPE_STYLE = 0x35,
363   /* DWG_TYPE_<UNKNOWN> = 0x36, */
364   /* DWG_TYPE_<UNKNOWN> = 0x37, */
365   DWG_TYPE_LTYPE_CONTROL = 0x38,
366   DWG_TYPE_LTYPE = 0x39,
367   /* DWG_TYPE_<UNKNOWN> = 0x3a, */
368   /* DWG_TYPE_<UNKNOWN> = 0x3b, */
369   DWG_TYPE_VIEW_CONTROL = 0x3c,
370   DWG_TYPE_VIEW = 0x3d,
371   DWG_TYPE_UCS_CONTROL = 0x3e,
372   DWG_TYPE_UCS = 0x3f,
373   DWG_TYPE_VPORT_CONTROL = 0x40,
374   DWG_TYPE_VPORT = 0x41,
375   DWG_TYPE_APPID_CONTROL = 0x42,
376   DWG_TYPE_APPID = 0x43,
377   DWG_TYPE_DIMSTYLE_CONTROL = 0x44,
378   DWG_TYPE_DIMSTYLE = 0x45,
379   DWG_TYPE_VX_CONTROL = 0x46,
380   DWG_TYPE_VX_TABLE_RECORD = 0x47,
381   DWG_TYPE_GROUP = 0x48,
382   DWG_TYPE_MLINESTYLE = 0x49,
383   DWG_TYPE_OLE2FRAME = 0x4a,
384   DWG_TYPE_DUMMY = 0x4b,
385   DWG_TYPE_LONG_TRANSACTION = 0x4c,
386   DWG_TYPE_LWPOLYLINE = 0x4d, /* ?? */
387   DWG_TYPE_HATCH = 0x4e,
388   DWG_TYPE_XRECORD = 0x4f,
389   DWG_TYPE_PLACEHOLDER = 0x50,
390   DWG_TYPE_VBA_PROJECT = 0x51,
391   DWG_TYPE_LAYOUT = 0x52,
392 
393   DWG_TYPE_PROXY_ENTITY = 0x1f2, /* 498 */
394   DWG_TYPE_PROXY_OBJECT = 0x1f3, /* 499 */
395 
396   /* non-fixed types > 500. not stored as type, but as fixedtype */
397 
398   DWG_TYPE_ACDSRECORD = 500,
399   DWG_TYPE_ACDSSCHEMA,
400   DWG_TYPE_ACMECOMMANDHISTORY,
401   DWG_TYPE_ACMESCOPE,
402   DWG_TYPE_ACMESTATEMGR,
403   DWG_TYPE_ACSH_BOOLEAN_CLASS,
404   DWG_TYPE_ACSH_BOX_CLASS,
405   DWG_TYPE_ACSH_BREP_CLASS,
406   DWG_TYPE_ACSH_CHAMFER_CLASS,
407   DWG_TYPE_ACSH_CONE_CLASS,
408   DWG_TYPE_ACSH_CYLINDER_CLASS,
409   DWG_TYPE_ACSH_EXTRUSION_CLASS,
410   DWG_TYPE_ACSH_FILLET_CLASS,
411   DWG_TYPE_ACSH_HISTORY_CLASS,
412   DWG_TYPE_ACSH_LOFT_CLASS,
413   DWG_TYPE_ACSH_PYRAMID_CLASS,
414   DWG_TYPE_ACSH_REVOLVE_CLASS,
415   DWG_TYPE_ACSH_SPHERE_CLASS,
416   DWG_TYPE_ACSH_SWEEP_CLASS,
417   DWG_TYPE_ACSH_TORUS_CLASS,
418   DWG_TYPE_ACSH_WEDGE_CLASS,
419   DWG_TYPE_ALDIMOBJECTCONTEXTDATA,
420   DWG_TYPE_ALIGNMENTPARAMETERENTITY,
421   DWG_TYPE_ANGDIMOBJECTCONTEXTDATA,
422   DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA,
423   DWG_TYPE_ARCALIGNEDTEXT,
424   DWG_TYPE_ARC_DIMENSION,
425   DWG_TYPE_ASSOC2DCONSTRAINTGROUP,
426   DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY,
427   DWG_TYPE_ASSOCACTION,
428   DWG_TYPE_ASSOCACTIONPARAM,
429   DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY,
430   DWG_TYPE_ASSOCARRAYACTIONBODY,
431   DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY,
432   DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS,
433   DWG_TYPE_ASSOCARRAYPATHPARAMETERS,
434   DWG_TYPE_ASSOCARRAYPOLARPARAMETERS,
435   DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS,
436   DWG_TYPE_ASSOCASMBODYACTIONPARAM,
437   DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY,
438   DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM,
439   DWG_TYPE_ASSOCDEPENDENCY,
440   DWG_TYPE_ASSOCDIMDEPENDENCYBODY,
441   DWG_TYPE_ASSOCEDGEACTIONPARAM,
442   DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY,
443   DWG_TYPE_ASSOCEDGEFILLETACTIONBODY,
444   DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY,
445   DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY,
446   DWG_TYPE_ASSOCFACEACTIONPARAM,
447   DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY,
448   DWG_TYPE_ASSOCGEOMDEPENDENCY,
449   DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY,
450   DWG_TYPE_ASSOCMLEADERACTIONBODY,
451   DWG_TYPE_ASSOCNETWORK,
452   DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY,
453   DWG_TYPE_ASSOCOBJECTACTIONPARAM,
454   DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY,
455   DWG_TYPE_ASSOCORDINATEDIMACTIONBODY,
456   DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM,
457   DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY,
458   DWG_TYPE_ASSOCPATHACTIONPARAM,
459   DWG_TYPE_ASSOCPERSSUBENTMANAGER,
460   DWG_TYPE_ASSOCPLANESURFACEACTIONBODY,
461   DWG_TYPE_ASSOCPOINTREFACTIONPARAM,
462   DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY,
463   DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY,
464   DWG_TYPE_ASSOCROTATEDDIMACTIONBODY,
465   DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY,
466   DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY,
467   DWG_TYPE_ASSOCVALUEDEPENDENCY,
468   DWG_TYPE_ASSOCVARIABLE,
469   DWG_TYPE_ASSOCVERTEXACTIONPARAM,
470   DWG_TYPE_BASEPOINTPARAMETERENTITY,
471   DWG_TYPE_BLKREFOBJECTCONTEXTDATA,
472   DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER,
473   DWG_TYPE_BLOCKALIGNMENTGRIP,
474   DWG_TYPE_BLOCKALIGNMENTPARAMETER,
475   DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER,
476   DWG_TYPE_BLOCKARRAYACTION,
477   DWG_TYPE_BLOCKBASEPOINTPARAMETER,
478   DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER,
479   DWG_TYPE_BLOCKFLIPACTION,
480   DWG_TYPE_BLOCKFLIPGRIP,
481   DWG_TYPE_BLOCKFLIPPARAMETER,
482   DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT,
483   DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER,
484   DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER,
485   DWG_TYPE_BLOCKLINEARGRIP,
486   DWG_TYPE_BLOCKLINEARPARAMETER,
487   DWG_TYPE_BLOCKLOOKUPACTION,
488   DWG_TYPE_BLOCKLOOKUPGRIP,
489   DWG_TYPE_BLOCKLOOKUPPARAMETER,
490   DWG_TYPE_BLOCKMOVEACTION,
491   DWG_TYPE_BLOCKPARAMDEPENDENCYBODY,
492   DWG_TYPE_BLOCKPOINTPARAMETER,
493   DWG_TYPE_BLOCKPOLARGRIP,
494   DWG_TYPE_BLOCKPOLARPARAMETER,
495   DWG_TYPE_BLOCKPOLARSTRETCHACTION,
496   DWG_TYPE_BLOCKPROPERTIESTABLE,
497   DWG_TYPE_BLOCKPROPERTIESTABLEGRIP,
498   DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER,
499   DWG_TYPE_BLOCKREPRESENTATION,
500   DWG_TYPE_BLOCKROTATEACTION,
501   DWG_TYPE_BLOCKROTATIONGRIP,
502   DWG_TYPE_BLOCKROTATIONPARAMETER,
503   DWG_TYPE_BLOCKSCALEACTION,
504   DWG_TYPE_BLOCKSTRETCHACTION,
505   DWG_TYPE_BLOCKUSERPARAMETER,
506   DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER,
507   DWG_TYPE_BLOCKVISIBILITYGRIP,
508   DWG_TYPE_BLOCKVISIBILITYPARAMETER,
509   DWG_TYPE_BLOCKXYGRIP,
510   DWG_TYPE_BLOCKXYPARAMETER,
511   DWG_TYPE_CAMERA,
512   DWG_TYPE_CELLSTYLEMAP,
513   DWG_TYPE_CONTEXTDATAMANAGER,
514   DWG_TYPE_CSACDOCUMENTOPTIONS,
515   DWG_TYPE_CURVEPATH,
516   DWG_TYPE_DATALINK,
517   DWG_TYPE_DATATABLE,
518   DWG_TYPE_DBCOLOR,
519   DWG_TYPE_DETAILVIEWSTYLE,
520   DWG_TYPE_DGNDEFINITION,
521   DWG_TYPE_DGNUNDERLAY,
522   DWG_TYPE_DICTIONARYVAR,
523   DWG_TYPE_DICTIONARYWDFLT,
524   DWG_TYPE_DIMASSOC,
525   DWG_TYPE_DMDIMOBJECTCONTEXTDATA,
526   DWG_TYPE_DWFDEFINITION,
527   DWG_TYPE_DWFUNDERLAY,
528   DWG_TYPE_DYNAMICBLOCKPROXYNODE,
529   DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER,
530   DWG_TYPE_EVALUATION_GRAPH,
531   DWG_TYPE_EXTRUDEDSURFACE,
532   DWG_TYPE_FCFOBJECTCONTEXTDATA,
533   DWG_TYPE_FIELD,
534   DWG_TYPE_FIELDLIST,
535   DWG_TYPE_FLIPPARAMETERENTITY,
536   DWG_TYPE_GEODATA,
537   DWG_TYPE_GEOMAPIMAGE,
538   DWG_TYPE_GEOPOSITIONMARKER,
539   DWG_TYPE_GRADIENT_BACKGROUND,
540   DWG_TYPE_GROUND_PLANE_BACKGROUND,
541   DWG_TYPE_HELIX,
542   DWG_TYPE_IBL_BACKGROUND,
543   DWG_TYPE_IDBUFFER,
544   DWG_TYPE_IMAGE,
545   DWG_TYPE_IMAGEDEF,
546   DWG_TYPE_IMAGEDEF_REACTOR,
547   DWG_TYPE_IMAGE_BACKGROUND,
548   DWG_TYPE_INDEX,
549   DWG_TYPE_LARGE_RADIAL_DIMENSION,
550   DWG_TYPE_LAYERFILTER,
551   DWG_TYPE_LAYER_INDEX,
552   DWG_TYPE_LAYOUTPRINTCONFIG,
553   DWG_TYPE_LEADEROBJECTCONTEXTDATA,
554   DWG_TYPE_LIGHT,
555   DWG_TYPE_LIGHTLIST,
556   DWG_TYPE_LINEARPARAMETERENTITY,
557   DWG_TYPE_LOFTEDSURFACE,
558   DWG_TYPE_MATERIAL,
559   DWG_TYPE_MENTALRAYRENDERSETTINGS,
560   DWG_TYPE_MESH,
561   DWG_TYPE_MLEADEROBJECTCONTEXTDATA,
562   DWG_TYPE_MLEADERSTYLE,
563   DWG_TYPE_MOTIONPATH,
564   DWG_TYPE_MPOLYGON,
565   DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA,
566   DWG_TYPE_MTEXTOBJECTCONTEXTDATA,
567   DWG_TYPE_MULTILEADER,
568   DWG_TYPE_NAVISWORKSMODEL,
569   DWG_TYPE_NAVISWORKSMODELDEF,
570   DWG_TYPE_NPOCOLLECTION,
571   DWG_TYPE_NURBSURFACE,
572   DWG_TYPE_OBJECT_PTR,
573   DWG_TYPE_ORDDIMOBJECTCONTEXTDATA,
574   DWG_TYPE_PARTIAL_VIEWING_INDEX,
575   //DWG_TYPE_PARTIAL_VIEWING_FILTER,
576   DWG_TYPE_PDFDEFINITION,
577   DWG_TYPE_PDFUNDERLAY,
578   DWG_TYPE_PERSUBENTMGR,
579   DWG_TYPE_PLANESURFACE,
580   DWG_TYPE_PLOTSETTINGS,
581   DWG_TYPE_POINTCLOUD,
582   DWG_TYPE_POINTCLOUDCOLORMAP,
583   DWG_TYPE_POINTCLOUDDEF,
584   DWG_TYPE_POINTCLOUDDEFEX,
585   DWG_TYPE_POINTCLOUDDEF_REACTOR,
586   DWG_TYPE_POINTCLOUDDEF_REACTOR_EX,
587   DWG_TYPE_POINTCLOUDEX,
588   DWG_TYPE_POINTPARAMETERENTITY,
589   DWG_TYPE_POINTPATH,
590   DWG_TYPE_POLARGRIPENTITY,
591   DWG_TYPE_RADIMLGOBJECTCONTEXTDATA,
592   DWG_TYPE_RADIMOBJECTCONTEXTDATA,
593   DWG_TYPE_RAPIDRTRENDERSETTINGS,
594   DWG_TYPE_RASTERVARIABLES,
595   DWG_TYPE_RENDERENTRY,
596   DWG_TYPE_RENDERENVIRONMENT,
597   DWG_TYPE_RENDERGLOBAL,
598   DWG_TYPE_RENDERSETTINGS,
599   DWG_TYPE_REVOLVEDSURFACE,
600   DWG_TYPE_ROTATIONPARAMETERENTITY,
601   DWG_TYPE_RTEXT,
602   DWG_TYPE_SCALE,
603   DWG_TYPE_SECTIONOBJECT,
604   DWG_TYPE_SECTIONVIEWSTYLE,
605   DWG_TYPE_SECTION_MANAGER,
606   DWG_TYPE_SECTION_SETTINGS,
607   DWG_TYPE_SKYLIGHT_BACKGROUND,
608   DWG_TYPE_SOLID_BACKGROUND,
609   DWG_TYPE_SORTENTSTABLE,
610   DWG_TYPE_SPATIAL_FILTER,
611   DWG_TYPE_SPATIAL_INDEX,
612   DWG_TYPE_SUN,
613   DWG_TYPE_SUNSTUDY,
614   DWG_TYPE_SWEPTSURFACE,
615   DWG_TYPE_TABLE,
616   DWG_TYPE_TABLECONTENT,
617   DWG_TYPE_TABLEGEOMETRY,
618   DWG_TYPE_TABLESTYLE,
619   DWG_TYPE_TEXTOBJECTCONTEXTDATA,
620   DWG_TYPE_TVDEVICEPROPERTIES,
621   DWG_TYPE_VISIBILITYGRIPENTITY,
622   DWG_TYPE_VISIBILITYPARAMETERENTITY,
623   DWG_TYPE_VISUALSTYLE,
624   DWG_TYPE_WIPEOUT,
625   DWG_TYPE_WIPEOUTVARIABLES,
626   DWG_TYPE_XREFPANELOBJECT,
627   DWG_TYPE_XYPARAMETERENTITY,
628   // after 1.0 add new types here for binary compat
629 
630   DWG_TYPE_FREED        = 0xfffd,
631   DWG_TYPE_UNKNOWN_ENT  = 0xfffe,
632   DWG_TYPE_UNKNOWN_OBJ  = 0xffff,
633 } Dwg_Object_Type;
634 
635 /**
636  Error codes returned.
637  */
638 typedef enum DWG_ERROR
639 {
640   DWG_NOERR = 0,
641   /* sorted by severity */
642   DWG_ERR_WRONGCRC         = 1,
643   DWG_ERR_NOTYETSUPPORTED  = 1 << 1, /* 2 */
644   DWG_ERR_UNHANDLEDCLASS   = 1 << 2, /* 4 */
645   DWG_ERR_INVALIDTYPE      = 1 << 3, /* 8 */
646   DWG_ERR_INVALIDHANDLE    = 1 << 4, /* 16 */
647   DWG_ERR_INVALIDEED       = 1 << 5, /* 32 */
648   DWG_ERR_VALUEOUTOFBOUNDS = 1 << 6, /* 64 */
649   /* -------- critical errors ------- */
650   DWG_ERR_CLASSESNOTFOUND  = 1 << 7, /* 128 */
651   DWG_ERR_SECTIONNOTFOUND  = 1 << 8, /* 256 */
652   DWG_ERR_PAGENOTFOUND     = 1 << 9, /* 512 */
653   DWG_ERR_INTERNALERROR    = 1 << 10,/* 1024 */
654   DWG_ERR_INVALIDDWG       = 1 << 11,/* 2048 */
655   DWG_ERR_IOERROR          = 1 << 12,/* 4096 */
656   DWG_ERR_OUTOFMEM         = 1 << 13,/* 8192 */
657 
658 } Dwg_Error;
659 #define DWG_ERR_CRITICAL DWG_ERR_CLASSESNOTFOUND
660 
661 /**
662    handles resolve absolute or relative indices to objects.
663 
664    code 2-5: represents the type of the relation: hard/soft, owner/id.
665 
666    code TYPEDOBJHANDLE:
667     2 Soft owner,
668     3 Hard owner,
669     4 Soft pointer,
670     5 Hard pointer
671 
672    code > 6: the handle is stored as an offset from some other handle.
673 
674    code OFFSETOBJHANDLE for soft owners or pointers:
675     6 ref + 1,
676     8 ref - 1,
677     a ref + offset,
678     c ref - offset
679 
680   See \ref Dwg_Handle
681  */
682 typedef struct _dwg_handle
683 {
684   BITCODE_RC code; /*!< OFFSETOBJHANDLE if > 6 */
685   BITCODE_RC size;
686   unsigned long value;
687   BITCODE_B is_global; // to be freed or not
688 } Dwg_Handle;
689 
690 #define FORMAT_H "%u.%u.%lX"
691 #define ARGS_H(hdl) (hdl).code, (hdl).size, (hdl).value
692 #define FORMAT_REF "(%u.%u.%lX) abs:%lX"
693 #define ARGS_REF(ref) (ref)->handleref.code, (ref)->handleref.size, \
694     (ref)->handleref.value, (ref)->absolute_ref
695 
696 /**
697 object references: obj is resolved by handleref (e.g. via
698 dwg_resolve_handleref) when reading a DWG to the respective \ref
699 Dwg_Object, and absolute_ref is resolved to the global
700 _dwg_struct::object_ref index. It is the same as the hex number in the
701 DXF handles.
702 
703 Used as \ref Dwg_Object_Ref
704 */
705 typedef struct _dwg_object_ref
706 {
707   struct _dwg_object* obj;
708   Dwg_Handle handleref;
709   unsigned long absolute_ref;
710 } Dwg_Object_Ref;
711 
712 typedef Dwg_Object_Ref* BITCODE_H;
713 
714 typedef enum DWG_HDL_CODE
715 {
716    DWG_HDL_OWNER   = 0,
717    DWG_HDL_SOFTOWN = 2,
718    DWG_HDL_HARDOWN = 3,
719    DWG_HDL_SOFTPTR = 4, // can be relative
720    DWG_HDL_HARDPTR = 5,
721 } Dwg_Hdl_Code;
722 
723 /**
724  CMC or ENC colors: color index or rgb value. layers are off when the index
725  is negative.
726  Used as \ref Dwg_Color
727  */
728 typedef struct _dwg_color /* CmColor: R15 and earlier */
729 {
730   BITCODE_BSd index;  /* <0: turned off. 0: BYBLOCK, 256: BYLAYER */
731   BITCODE_BS flag;    /* 1: has name, 2: has book_name. */
732   BITCODE_BS raw;     /* ENC only */
733   BITCODE_BL rgb;     /* DXF 420 */
734   unsigned method;    /* first byte of rgb:
735                          0xc0 for ByLayer (also c3 and rgb of 0x100)
736                          0xc1 for ByBlock (also c3 and rgb of 0)
737                          0xc2 for entities (default), with names with an additional name flag RC,
738                          0xc3 for truecolor,
739                          0xc5 for foreground color
740                          0xc8 for none (also c3 and rgb of 0x101)
741                        */
742   BITCODE_T  name;       /* DXF 430 */
743   BITCODE_T  book_name;  /* DXF 430, DXF: "book_name$name" */
744   // Entities only:
745   BITCODE_H  handle;
746   BITCODE_BB alpha_type; /* 0 BYLAYER, 1 BYBLOCK, 3 alpha */
747   BITCODE_RC alpha;      /* DXF 440. 0-255 */
748 } Dwg_Color;
749 
750 typedef Dwg_Color BITCODE_CMC;
751 typedef Dwg_Color BITCODE_CMTC; // truecolor even before r2004
752 typedef Dwg_Color BITCODE_ENC;
753 
754 EXPORT const char* dwg_color_method_name (unsigned method);
755 
756 /**
757  ASCII or Unicode text in xdata \ref Dwg_Resbuf
758  */
759 struct _dwg_binary_chunk
760 {
761   unsigned short size;
762   unsigned codepage:15;
763   unsigned is_tu:1;
764   union {
765     char *data;
766     DWGCHAR *wdata;
767   } u;
768 };
769 
770 /**
771  result buffers: xdata linked list of dxf group - value pairs.
772  Used as \ref Dwg_Resbuf
773  */
774 typedef struct _dwg_resbuf
775 {
776   short type;
777   union
778   {
779     double  pt[3];
780     char    i8;
781     short   i16;
782     int     i32;
783     BITCODE_BLL i64;
784     double  dbl;
785     unsigned char hdl[8];
786     Dwg_Handle h;
787     struct _dwg_binary_chunk str;
788   } value;
789   struct _dwg_resbuf *nextrb;
790 } Dwg_Resbuf;
791 
792 /**
793  \struct Dwg_Header_Variables
794  DWG header variables for all versions.
795  If uppercase related to the DXF HEADER $ name.
796 
797  \ref _dwg_header_variables
798  */
799 typedef struct _dwg_header_variables {
800   BITCODE_RL size;
801   BITCODE_RL bitsize_hi;   /*!< r2010+ */
802   BITCODE_RL bitsize;
803   BITCODE_RC ACADMAINTVER; /*!< r13+ */
804   BITCODE_BLL REQUIREDVERSIONS; /*!< r2013+ */
805   BITCODE_TV DWGCODEPAGE;  /*!< r10+ */
806   BITCODE_BD unknown_0; /* 412148564080.0 */
807   BITCODE_BD unknown_1; /* 1.0 */
808   BITCODE_BD unknown_2; /* 1.0 */
809   BITCODE_BD unknown_3; /* 1.0 */
810   BITCODE_TV unknown_text1; /* "" 4x pre 2007... */
811   BITCODE_TV unknown_text2; /* "" */
812   BITCODE_TV unknown_text3; /* "" */
813   BITCODE_TV unknown_text4; /* "" */
814   BITCODE_BL unknown_8; /* 24L */
815   BITCODE_BL unknown_9; /* 0L */
816   BITCODE_BS unknown_10; /* 0 r13-r14 */
817   BITCODE_H VX_TABLE_RECORD; /*!< r11-r2000 code 5, no DXF */
818   BITCODE_B DIMASO;
819   BITCODE_B DIMSHO;
820   BITCODE_B DIMSAV; /* undocumented */
821   BITCODE_B PLINEGEN;
822   BITCODE_B ORTHOMODE;
823   BITCODE_B REGENMODE;
824   BITCODE_B FILLMODE;
825   BITCODE_B QTEXTMODE;
826   BITCODE_B PSLTSCALE;
827   BITCODE_B LIMCHECK;
828   BITCODE_B BLIPMODE;
829   BITCODE_B unknown_11;
830   BITCODE_B USRTIMER;
831   BITCODE_B SKPOLY;
832   BITCODE_B ANGDIR;
833   BITCODE_B SPLFRAME;
834   BITCODE_B ATTREQ;
835   BITCODE_B ATTDIA;
836   BITCODE_B MIRRTEXT;
837   BITCODE_B WORLDVIEW;
838   BITCODE_B WIREFRAME; /* Undocumented */
839   BITCODE_B TILEMODE;
840   BITCODE_B PLIMCHECK;
841   BITCODE_B VISRETAIN;
842   BITCODE_B DELOBJ;
843   BITCODE_B DISPSILH;
844   BITCODE_B PELLIPSE;
845   BITCODE_BS SAVEIMAGES; //some r13 only
846   BITCODE_BS PROXYGRAPHICS;
847   BITCODE_BS MEASUREMENT; /* 0 English, 1 Metric. Stored as Section 4 */
848   BITCODE_BS DRAGMODE;
849   BITCODE_BS TREEDEPTH;
850   BITCODE_BS LUNITS;
851   BITCODE_BS LUPREC;
852   BITCODE_BS AUNITS;
853   BITCODE_BS AUPREC;
854   BITCODE_BS OSMODE;
855   BITCODE_BS ATTMODE;
856   BITCODE_BS COORDS;
857   BITCODE_BS PDMODE;
858   BITCODE_BS PICKSTYLE;
859   BITCODE_BL unknown_12;
860   BITCODE_BL unknown_13;
861   BITCODE_BL unknown_14;
862   BITCODE_BS USERI1;
863   BITCODE_BS USERI2;
864   BITCODE_BS USERI3;
865   BITCODE_BS USERI4;
866   BITCODE_BS USERI5;
867   BITCODE_BS SPLINESEGS;
868   BITCODE_BS SURFU;
869   BITCODE_BS SURFV;
870   BITCODE_BS SURFTYPE;
871   BITCODE_BS SURFTAB1;
872   BITCODE_BS SURFTAB2;
873   BITCODE_BS SPLINETYPE;
874   BITCODE_BS SHADEDGE;
875   BITCODE_BS SHADEDIF;
876   BITCODE_BS UNITMODE;
877   BITCODE_BS MAXACTVP;
878   BITCODE_BS ISOLINES;
879   BITCODE_BS CMLJUST;
880   BITCODE_BS TEXTQLTY;
881   BITCODE_BL unknown_14b;
882   BITCODE_BD LTSCALE;
883   BITCODE_BD TEXTSIZE;
884   BITCODE_BD TRACEWID;
885   BITCODE_BD SKETCHINC;
886   BITCODE_BD FILLETRAD;
887   BITCODE_BD THICKNESS;
888   BITCODE_BD ANGBASE;
889   BITCODE_BD PDSIZE;
890   BITCODE_BD PLINEWID;
891   BITCODE_BD USERR1;
892   BITCODE_BD USERR2;
893   BITCODE_BD USERR3;
894   BITCODE_BD USERR4;
895   BITCODE_BD USERR5;
896   BITCODE_BD CHAMFERA;
897   BITCODE_BD CHAMFERB;
898   BITCODE_BD CHAMFERC;
899   BITCODE_BD CHAMFERD;
900   BITCODE_BD FACETRES;
901   BITCODE_BD CMLSCALE;
902   BITCODE_BD CELTSCALE;
903   BITCODE_TV MENU;
904   BITCODE_TIMEBLL TDCREATE;
905   BITCODE_TIMEBLL TDUPDATE;
906   BITCODE_TIMEBLL TDUCREATE;
907   BITCODE_TIMEBLL TDUUPDATE;
908   BITCODE_BL unknown_15;
909   BITCODE_BL unknown_16;
910   BITCODE_BL unknown_17;
911   BITCODE_TIMEBLL TDINDWG;
912   BITCODE_TIMEBLL TDUSRTIMER;
913   BITCODE_CMC CECOLOR;
914   //BITCODE_RS CECOLOR_idx; /* <r13 */
915   BITCODE_BS HANDLING; /* <r14: default 1 */
916   //BITCODE_RS HANDSEED_R11;
917   BITCODE_H HANDSEED;
918   BITCODE_H CLAYER;	/*!< code 5, DXF 8 */
919   BITCODE_H TEXTSTYLE;	/*!< code 5, DXF 7 */
920   BITCODE_H CELTYPE;	/*!< code 5, DXF 6 */
921   BITCODE_H CMATERIAL;	/*!< r2007+ code 5, no DXF */
922   BITCODE_H DIMSTYLE;	/*!< code 5, DXF 2 */
923   BITCODE_H CMLSTYLE;	/*!< code 5, DXF 2 */
924   BITCODE_BD PSVPSCALE;
925   BITCODE_3BD PINSBASE;		/*!< r13+ ... */
926   BITCODE_3BD PEXTMIN;
927   BITCODE_3BD PEXTMAX;
928   BITCODE_2DPOINT PLIMMIN;
929   BITCODE_2DPOINT PLIMMAX;
930   BITCODE_BD  PELEVATION;
931   BITCODE_3BD PUCSORG;
932   BITCODE_3BD PUCSXDIR;
933   BITCODE_3BD PUCSYDIR;
934   BITCODE_H PUCSNAME;		/*!< r13+ code 5, DXF 2 */
935   BITCODE_H PUCSBASE;		/*!< r2000+ code 5, DXF 2 */
936   BITCODE_H PUCSORTHOREF;	/*!< r2000+ code 5, DXF 2 */
937   BITCODE_BS PUCSORTHOVIEW;
938   BITCODE_3BD PUCSORGTOP;
939   BITCODE_3BD PUCSORGBOTTOM;
940   BITCODE_3BD PUCSORGLEFT;
941   BITCODE_3BD PUCSORGRIGHT;
942   BITCODE_3BD PUCSORGFRONT;
943   BITCODE_3BD PUCSORGBACK;
944   BITCODE_3BD INSBASE;
945   BITCODE_3BD EXTMIN;
946   BITCODE_3BD EXTMAX;
947   BITCODE_2DPOINT LIMMIN;
948   BITCODE_2DPOINT LIMMAX;
949   BITCODE_2RD VIEWCTR;  /* -r11 */
950   BITCODE_BD ELEVATION;
951   BITCODE_RD VIEWSIZE;  /* -r11 */
952   BITCODE_RS SNAPMODE;  /* -r11 */
953   BITCODE_2RD SNAPUNIT; /* -r11 */
954   BITCODE_2RD SNAPBASE; /* -r11 */
955   BITCODE_RD SNAPANG;   /* -r11 */
956   BITCODE_RS SNAPSTYL;  /* -r11 */
957   BITCODE_RS SNAPISOPAIR; /* -r11 */
958   BITCODE_RS GRIDMODE;  /* -r11 */
959   BITCODE_2RD GRIDUNIT; /* -r11 */
960   BITCODE_3BD UCSORG;
961   BITCODE_3BD UCSXDIR;
962   BITCODE_3BD UCSYDIR;
963   BITCODE_H UCSNAME;		/*!< code 5, DXF 2 */
964   BITCODE_H UCSBASE;		/*!< code 5, DXF 2 */
965   BITCODE_BS UCSORTHOVIEW;
966   BITCODE_H UCSORTHOREF;	/*!< code 5, DXF 2 */
967   BITCODE_3BD UCSORGTOP;
968   BITCODE_3BD UCSORGBOTTOM;
969   BITCODE_3BD UCSORGLEFT;
970   BITCODE_3BD UCSORGRIGHT;
971   BITCODE_3BD UCSORGFRONT;
972   BITCODE_3BD UCSORGBACK;
973   BITCODE_TV DIMPOST;
974   BITCODE_TV DIMAPOST;
975   BITCODE_B DIMTOL;
976   BITCODE_B DIMLIM;
977   BITCODE_B DIMTIH;
978   BITCODE_B DIMTOH;
979   BITCODE_B DIMSE1;
980   BITCODE_B DIMSE2;
981   BITCODE_B DIMALT;
982   BITCODE_B DIMTOFL;
983   BITCODE_B DIMSAH;
984   BITCODE_B DIMTIX;
985   BITCODE_B DIMSOXD;
986   BITCODE_BS DIMALTD;   /*!< r13-r14 only RC */
987   BITCODE_BS DIMZIN;    /*!< r13-r14 only RC */
988   BITCODE_B DIMSD1;
989   BITCODE_B DIMSD2;
990   BITCODE_BS DIMTOLJ;   /*!< r13-r14 only RC */
991   BITCODE_BS DIMJUST;   /*!< r13-r14 only RC */
992   BITCODE_BS DIMFIT;    /*!< r13-r14 only RC */
993   BITCODE_B DIMUPT;
994   BITCODE_BS DIMTZIN;   /*!< r13-r14 only RC */
995   BITCODE_BS DIMMALTZ;  /*!< r13-r14 only RC */
996   BITCODE_BS DIMMALTTZ; /*!< r13-r14 only RC */
997   BITCODE_BS DIMTAD;    /*!< r13-r14 only RC */
998   BITCODE_BS DIMUNIT;
999   BITCODE_BS DIMAUNIT;
1000   BITCODE_BS DIMDEC;
1001   BITCODE_BS DIMTDEC;
1002   BITCODE_BS DIMALTU;
1003   BITCODE_BS DIMALTTD;
1004   BITCODE_H DIMTXSTY;	/*!< code 5, DXF 7 */
1005   BITCODE_BD DIMSCALE;
1006   BITCODE_BD DIMASZ;
1007   BITCODE_BD DIMEXO;
1008   BITCODE_BD DIMDLI;
1009   BITCODE_BD DIMEXE;
1010   BITCODE_BD DIMRND;
1011   BITCODE_BD DIMDLE;
1012   BITCODE_BD DIMTP;
1013   BITCODE_BD DIMTM;
1014   BITCODE_BD DIMFXL;
1015   BITCODE_BD DIMJOGANG;
1016   BITCODE_BS DIMTFILL;
1017   BITCODE_CMC DIMTFILLCLR;
1018   BITCODE_BS DIMAZIN;
1019   BITCODE_BS DIMARCSYM;
1020   BITCODE_BD DIMTXT;
1021   BITCODE_BD DIMCEN;
1022   BITCODE_BD DIMTSZ;
1023   BITCODE_BD DIMALTF;
1024   BITCODE_BD DIMLFAC;
1025   BITCODE_BD DIMTVP;
1026   BITCODE_BD DIMTFAC;
1027   BITCODE_BD DIMGAP;
1028   BITCODE_T DIMPOST_T; /* preR13 => handle */
1029   BITCODE_T DIMAPOST_T;
1030   BITCODE_T DIMBLK_T;
1031   BITCODE_T DIMBLK1_T;
1032   BITCODE_T DIMBLK2_T;
1033   BITCODE_BD DIMALTRND;
1034   BITCODE_RS DIMCLRD_C; /* preR13 => CMC */
1035   BITCODE_RS DIMCLRE_C;
1036   BITCODE_RS DIMCLRT_C;
1037   BITCODE_CMC DIMCLRD;
1038   BITCODE_CMC DIMCLRE;
1039   BITCODE_CMC DIMCLRT;
1040   BITCODE_BS DIMADEC;   /*!< r2000+ ... */
1041   BITCODE_BS DIMFRAC;
1042   BITCODE_BS DIMLUNIT;
1043   BITCODE_BS DIMDSEP;
1044   BITCODE_BS DIMTMOVE;
1045   BITCODE_BS DIMALTZ;
1046   BITCODE_BS DIMALTTZ;
1047   BITCODE_BS DIMATFIT;
1048   BITCODE_B  DIMFXLON;  /*!< r2007+ */
1049   BITCODE_B  DIMTXTDIRECTION; /*!< r2010+ */
1050   BITCODE_BD DIMALTMZF; /*!< r2010+ */
1051   BITCODE_T  DIMALTMZS; /*!< r2010+ */
1052   BITCODE_BD DIMMZF;    /*!< r2010+ */
1053   BITCODE_T  DIMMZS;    /*!< r2010+ */
1054   /*BITCODE_H DIMTXSTY;*/  /*!< r2000+ */
1055   BITCODE_H DIMLDRBLK;  /*!< r2000+ code 5, DXF 1 */
1056   BITCODE_H DIMBLK;     /*!< r2000+ code 5, DXF 1 */
1057   BITCODE_H DIMBLK1;    /*!< r2000+ code 5, DXF 1 */
1058   BITCODE_H DIMBLK2;    /*!< r2000+ code 5, DXF 1 */
1059   BITCODE_H DIMLTYPE; /*!< r2007+ code 5, DXF 6 */
1060   BITCODE_H DIMLTEX1; /*!< r2007+ code 5, DXF 6 */
1061   BITCODE_H DIMLTEX2; /*!< r2007+ code 5, DXF 6 */
1062   BITCODE_BSd DIMLWD;  /*!< r2000+ */
1063   BITCODE_BSd DIMLWE;  /*!< r2000+ */
1064   BITCODE_H BLOCK_CONTROL_OBJECT; /*!< code 3 */
1065   BITCODE_H LAYER_CONTROL_OBJECT; /*!< code 3 */
1066   BITCODE_H STYLE_CONTROL_OBJECT; /*!< code 3 */
1067   BITCODE_H LTYPE_CONTROL_OBJECT; /*!< code 3 */
1068   BITCODE_H VIEW_CONTROL_OBJECT; /*!< code 3 */
1069   BITCODE_H UCS_CONTROL_OBJECT; /*!< code 3 */
1070   BITCODE_H VPORT_CONTROL_OBJECT; /*!< code 3 */
1071   BITCODE_H APPID_CONTROL_OBJECT; /*!< code 3 */
1072   BITCODE_H DIMSTYLE_CONTROL_OBJECT; /*!< code 3 */
1073   BITCODE_H VX_CONTROL_OBJECT; /*!< r11-r2000 code 3 */
1074   BITCODE_H DICTIONARY_ACAD_GROUP;	/*!< code 5 */
1075   BITCODE_H DICTIONARY_ACAD_MLINESTYLE;	/*!< code 5 */
1076   BITCODE_H DICTIONARY_NAMED_OBJECT;	/*!< code 5, the "NOD" */
1077   BITCODE_BS TSTACKALIGN;           /*!< r2000+ */
1078   BITCODE_BS TSTACKSIZE;            /*!< r2000+ */
1079   BITCODE_T  HYPERLINKBASE;         /*!< r2000+ */
1080   BITCODE_TV STYLESHEET;            /*!< r2000+ */
1081   BITCODE_H DICTIONARY_LAYOUT;      /*!< r2000+ code 5 */
1082   BITCODE_H DICTIONARY_PLOTSETTINGS;   /*!< r2000+ code 5 */
1083   BITCODE_H DICTIONARY_PLOTSTYLENAME;  /*!< r2000+ code 5 */
1084   BITCODE_H DICTIONARY_MATERIAL;    /*!< r2004+ code 5 */
1085   BITCODE_H DICTIONARY_COLOR;       /*!< r2004+ code 5 */
1086   BITCODE_H DICTIONARY_VISUALSTYLE; /*!< r2007+ code 5 */
1087   BITCODE_H DICTIONARY_LIGHTLIST;   /*!< r2010+ code 5 ?? */
1088   BITCODE_H unknown_20;             /*!< r2013+ code 5 LIGHTLIST? */
1089   BITCODE_BL FLAGS;
1090   BITCODE_BSd CELWEIGHT; /*!< = FLAGS & 0x1f, see dxf_cvt_lweight() DXF 370 (int16) */
1091   BITCODE_B  ENDCAPS;    /*!< = FLAGS & 0x60 */
1092   BITCODE_B  JOINSTYLE;  /*!< = FLAGS & 0x180 */
1093   BITCODE_B  LWDISPLAY;  /*!< = !(FLAGS & 0x200) */
1094   BITCODE_B  XEDIT;      /*!< = !(FLAGS & 0x400) */
1095   BITCODE_B  EXTNAMES;   /*!< = FLAGS & 0x800 */
1096   BITCODE_B  PSTYLEMODE; /*!< = FLAGS & 0x2000 */
1097   BITCODE_B  OLESTARTUP; /*!< = FLAGS & 0x4000 */
1098   BITCODE_BS INSUNITS;
1099   BITCODE_BS CEPSNTYPE;
1100   BITCODE_H CPSNID;      /*!< when CEPSNTYPE = 3, code 5 */
1101   BITCODE_TV FINGERPRINTGUID;
1102   BITCODE_TV VERSIONGUID;
1103   BITCODE_RC SORTENTS;
1104   BITCODE_RC INDEXCTL;
1105   BITCODE_RC HIDETEXT;
1106   BITCODE_RC XCLIPFRAME;
1107   BITCODE_RC DIMASSOC;
1108   BITCODE_RC HALOGAP;
1109   BITCODE_BS OBSCOLOR;
1110   BITCODE_BS INTERSECTIONCOLOR;
1111   BITCODE_RC OBSLTYPE;
1112   BITCODE_RC INTERSECTIONDISPLAY;
1113   BITCODE_TV PROJECTNAME;
1114   BITCODE_H BLOCK_RECORD_PSPACE;	/*!< code 5 */
1115   BITCODE_H BLOCK_RECORD_MSPACE;	/*!< code 5 */
1116   BITCODE_H LTYPE_BYLAYER;	/*!< code 5 */
1117   BITCODE_H LTYPE_BYBLOCK;	/*!< code 5 */
1118   BITCODE_H LTYPE_CONTINUOUS;	/*!< code 5 */
1119   BITCODE_B CAMERADISPLAY; /*!< r2007+ ... */
1120   BITCODE_BL unknown_21;
1121   BITCODE_BL unknown_22;
1122   BITCODE_BD unknown_23;
1123   BITCODE_BD STEPSPERSEC;
1124   BITCODE_BD STEPSIZE;
1125   BITCODE_BD _3DDWFPREC;
1126   BITCODE_BD LENSLENGTH;
1127   BITCODE_BD CAMERAHEIGHT;
1128   BITCODE_RC SOLIDHIST;
1129   BITCODE_RC SHOWHIST;
1130   BITCODE_BD PSOLWIDTH;
1131   BITCODE_BD PSOLHEIGHT;
1132   BITCODE_BD LOFTANG1;
1133   BITCODE_BD LOFTANG2;
1134   BITCODE_BD LOFTMAG1;
1135   BITCODE_BD LOFTMAG2;
1136   BITCODE_BS LOFTPARAM;
1137   BITCODE_RC LOFTNORMALS;
1138   BITCODE_BD LATITUDE;
1139   BITCODE_BD LONGITUDE;
1140   BITCODE_BD NORTHDIRECTION;
1141   BITCODE_BL TIMEZONE;
1142   BITCODE_RC LIGHTGLYPHDISPLAY;
1143   BITCODE_RC TILEMODELIGHTSYNCH;
1144   BITCODE_RC DWFFRAME;
1145   BITCODE_RC DGNFRAME;
1146   BITCODE_B REALWORLDSCALE;
1147   BITCODE_CMC INTERFERECOLOR;
1148   BITCODE_H INTERFEREOBJVS;	/*!< r2007+ code 5, DXF 345 VISUALSTYLE */
1149   BITCODE_H INTERFEREVPVS;	/*!< r2007+ code 5, DXF 346 VISUALSTYLE */
1150   BITCODE_H DRAGVS;		/*!< r2007+ code 5, DXF 349 VISUALSTYLE */
1151   BITCODE_RC CSHADOW;
1152   BITCODE_BD SHADOWPLANELOCATION;
1153   BITCODE_BS unknown_54; /*!< r14+ ... optional */
1154   BITCODE_BS unknown_55;
1155   BITCODE_BS unknown_56;
1156   BITCODE_BS unknown_57;
1157 } Dwg_Header_Variables;
1158 
1159 /* OBJECTS *******************************************************************/
1160 /**
1161  UNUSED (0) entity. Unknown entities are stored as blob
1162  */
1163 typedef int Dwg_Entity_UNUSED;
1164 
1165 /** \ref Dwg_Entity_TEXT
1166  TEXT (1) entity
1167  */
1168 typedef struct _dwg_entity_TEXT
1169 {
1170   struct _dwg_object_entity *parent;
1171 
1172   BITCODE_RC dataflags;        /*!< r2000+ */
1173   BITCODE_RD elevation;        /*!< DXF 30 (z coord of 10), when dataflags & 1 */
1174   BITCODE_2DPOINT ins_pt;      /*!< DXF 10 */
1175   BITCODE_2DPOINT alignment_pt; /*!< DXF 11. optional, when dataflags & 2, i.e 72/73 != 0 */
1176   BITCODE_BE extrusion;       /*!< DXF 210. Default 0,0,1 */
1177   BITCODE_RD thickness;       /*!< DXF 39 */
1178   BITCODE_RD oblique_angle;   /*!< DXF 51 */
1179   BITCODE_RD rotation;        /*!< DXF 50 */
1180   BITCODE_RD height;          /*!< DXF 40 */
1181   BITCODE_RD width_factor;    /*!< DXF 41 */
1182   BITCODE_T  text_value;      /*!< DXF 1 */
1183   BITCODE_BS generation;      /*!< DXF 71 */
1184   BITCODE_BS horiz_alignment; /*!< DXF 72. options 0-5:
1185                                  0 = Left; 1= Center; 2 = Right; 3 = Aligned;
1186                                  4 = Middle; 5 = Fit */
1187   BITCODE_BS vert_alignment;  /*!< DXF 73. options 0-3:
1188                                  0 = Baseline; 1 = Bottom; 2 = Middle; 3 = Top */
1189   BITCODE_H style;	      /*!< code 5, DXF 7, optional */
1190 } Dwg_Entity_TEXT;
1191 
1192 /** \ref Dwg_Entity_ATTRIB
1193  ATTRIB (2) entity
1194  */
1195 typedef struct _dwg_entity_ATTRIB
1196 {
1197   struct _dwg_object_entity *parent;
1198 
1199   BITCODE_BD elevation;
1200   BITCODE_2DPOINT ins_pt;
1201   BITCODE_2DPOINT alignment_pt;
1202   BITCODE_BE extrusion;
1203   BITCODE_RD thickness;
1204   BITCODE_RD oblique_angle;
1205   BITCODE_RD rotation;
1206   BITCODE_RD height;
1207   BITCODE_RD width_factor;
1208   BITCODE_T text_value;
1209   BITCODE_BS generation;
1210   BITCODE_BS horiz_alignment;
1211   BITCODE_BS vert_alignment;
1212   BITCODE_RC dataflags;
1213   BITCODE_RC class_version; /* R2010+ */
1214   BITCODE_RC type;    /* R2018+ */
1215   BITCODE_T tag;
1216   BITCODE_BS field_length; /* DXF 73 but unused */
1217   BITCODE_RC flags; /* bitmask of:
1218                        0 none
1219                        1 invisible, overridden by ATTDISP
1220                        2 constant, no prompt
1221                        4 verify on insert
1222                        8 preset, inserted only with its default values, not editable. */
1223   BITCODE_B lock_position_flag;
1224   BITCODE_H style;
1225   BITCODE_H mtext_handles; /* R2018+ TODO */
1226   BITCODE_BS annotative_data_size; /* R2018+ */
1227   BITCODE_RC annotative_data_bytes;
1228   BITCODE_H  annotative_app;
1229   BITCODE_BS annotative_short;
1230 } Dwg_Entity_ATTRIB;
1231 
1232 /** \ref Dwg_Entity_ATTDEF
1233  ATTDEF (3) entity
1234  */
1235 typedef struct _dwg_entity_ATTDEF
1236 {
1237   struct _dwg_object_entity *parent;
1238 
1239   BITCODE_BD elevation;
1240   BITCODE_2DPOINT ins_pt;
1241   BITCODE_2DPOINT alignment_pt;
1242   BITCODE_BE extrusion;
1243   BITCODE_RD thickness;
1244   BITCODE_RD oblique_angle;
1245   BITCODE_RD rotation;
1246   BITCODE_RD height;
1247   BITCODE_RD width_factor;
1248   BITCODE_T default_value;
1249   BITCODE_BS generation;
1250   BITCODE_BS horiz_alignment;
1251   BITCODE_BS vert_alignment;
1252   BITCODE_RC dataflags;
1253   BITCODE_RC class_version; /* R2010+ */
1254   BITCODE_RC type;    /* R2018+ */
1255   BITCODE_T tag;
1256   BITCODE_BS field_length;
1257   BITCODE_RC flags; /* => HEADER.AFLAGS */
1258   BITCODE_B lock_position_flag;
1259   BITCODE_H style;
1260   BITCODE_H mtext_handles; /* R2018+ TODO */
1261   BITCODE_BS annotative_data_size; /* R2018+ */
1262   BITCODE_RC annotative_data_bytes;
1263   BITCODE_H  annotative_app;
1264   BITCODE_BS annotative_short;
1265 
1266   BITCODE_RC attdef_class_version; /* R2010+ */
1267   BITCODE_T prompt;
1268 } Dwg_Entity_ATTDEF;
1269 
1270 /**
1271  BLOCK (4) entity
1272  */
1273 typedef struct _dwg_entity_BLOCK
1274 {
1275   struct _dwg_object_entity *parent;
1276 
1277   BITCODE_T name;     // DXF 2
1278   BITCODE_T filename; // unused, will be removed
1279 } Dwg_Entity_BLOCK;
1280 
1281 /**
1282  ENDBLK (5) entity
1283  */
1284 typedef struct _dwg_entity_ENDBLK
1285 {
1286   struct _dwg_object_entity *parent;
1287 } Dwg_Entity_ENDBLK;
1288 
1289 /**
1290  SEQEND (6) entity
1291  */
1292 typedef struct _dwg_entity_SEQEND
1293 {
1294   struct _dwg_object_entity *parent;
1295 } Dwg_Entity_SEQEND;
1296 
1297 /**
1298  INSERT (7) entity
1299  */
1300 typedef struct _dwg_entity_INSERT
1301 {
1302   struct _dwg_object_entity *parent;
1303 
1304   BITCODE_3DPOINT   ins_pt;
1305   BITCODE_BB        scale_flag;
1306   BITCODE_3DPOINT   scale;
1307   BITCODE_BD        rotation;
1308   BITCODE_BE        extrusion;
1309   BITCODE_B         has_attribs;
1310   BITCODE_BL        num_owned;
1311 
1312   BITCODE_H   block_header;
1313   BITCODE_H   first_attrib;
1314   BITCODE_H   last_attrib;
1315   BITCODE_H*  attribs;
1316   BITCODE_H   seqend;
1317 } Dwg_Entity_INSERT;
1318 
1319 /**
1320  MINSERT (8) entity
1321  */
1322 typedef struct _dwg_entity_MINSERT
1323 {
1324   struct _dwg_object_entity *parent;
1325 
1326   BITCODE_3DPOINT   ins_pt;
1327   BITCODE_BB        scale_flag;
1328   BITCODE_3DPOINT   scale;
1329   BITCODE_BD        rotation;
1330   BITCODE_BE        extrusion;
1331   BITCODE_B         has_attribs;
1332   BITCODE_BL        num_owned;
1333 
1334   BITCODE_BS        num_cols;
1335   BITCODE_BS        num_rows;
1336   BITCODE_BD        col_spacing;
1337   BITCODE_BD        row_spacing;
1338 
1339   BITCODE_H   block_header;
1340   BITCODE_H   first_attrib;
1341   BITCODE_H   last_attrib;
1342   BITCODE_H*  attribs;
1343   BITCODE_H   seqend;
1344 } Dwg_Entity_MINSERT;
1345 
1346 /**
1347  VERTEX_2D (10) entity
1348  */
1349 typedef struct _dwg_entity_VERTEX_2D
1350 {
1351   struct _dwg_object_entity *parent;
1352 
1353   BITCODE_RC flag;
1354   BITCODE_3BD point;
1355   BITCODE_BD start_width;
1356   BITCODE_BD end_width;
1357   BITCODE_BL id; /* R2010+ */
1358   BITCODE_BD bulge;
1359   BITCODE_BD tangent_dir;
1360 } Dwg_Entity_VERTEX_2D;
1361 
1362 /**
1363  VERTEX_3D (11) entity
1364  */
1365 typedef struct _dwg_entity_VERTEX_3D
1366 {
1367   struct _dwg_object_entity *parent;
1368 
1369   BITCODE_RC flag;
1370   BITCODE_3BD point;
1371 } Dwg_Entity_VERTEX_3D;
1372 
1373 /**
1374  VERTEX_MESH (12) - same as VERTEX_3D entity
1375  */
1376 typedef Dwg_Entity_VERTEX_3D Dwg_Entity_VERTEX_MESH;
1377 
1378 /**
1379  VERTEX_PFACE (13) - same as VERTEX_3D entity
1380  */
1381 typedef Dwg_Entity_VERTEX_3D Dwg_Entity_VERTEX_PFACE;
1382 
1383 /**
1384  VERTEX_PFACE_FACE (14) entity
1385  */
1386 typedef struct _dwg_entity_VERTEX_PFACE_FACE
1387 {
1388   struct _dwg_object_entity *parent;
1389 
1390   BITCODE_RC flag;
1391   BITCODE_BS vertind[4];
1392 } Dwg_Entity_VERTEX_PFACE_FACE;
1393 
1394 #define COMMON_ENTITY_POLYLINE                                                \
1395   struct _dwg_object_entity *parent;                                          \
1396   BITCODE_B has_vertex;                                                       \
1397   BITCODE_BL num_owned;                                                       \
1398   BITCODE_H first_vertex;                                                     \
1399   BITCODE_H last_vertex;                                                      \
1400   BITCODE_H *vertex;                                                          \
1401   BITCODE_H seqend
1402 
1403 /**
1404  2D POLYLINE (15) entity
1405  */
1406 typedef struct _dwg_entity_POLYLINE_2D
1407 {
1408   COMMON_ENTITY_POLYLINE;
1409 
1410   BITCODE_BS flag;        /* 1: closed, 2: curve_fit, 4: spline_fit, 8: 3d, 0x10: 3dmesh,
1411                              0x20: mesh_closed_in_n, 0x40: polyface_mesh, 0x80: ltype_continuous */
1412   BITCODE_BS curve_type;
1413   BITCODE_BD start_width;
1414   BITCODE_BD end_width;
1415   BITCODE_BT thickness;
1416   BITCODE_BD elevation;
1417   BITCODE_BE extrusion;
1418 } Dwg_Entity_POLYLINE_2D;
1419 
1420 /**
1421  3D POLYLINE (16) entity
1422  */
1423 typedef struct _dwg_entity_POLYLINE_3D
1424 {
1425   COMMON_ENTITY_POLYLINE;
1426 
1427   BITCODE_RC curve_type;
1428   BITCODE_RC flag;
1429 } Dwg_Entity_POLYLINE_3D;
1430 
1431 /**
1432  ARC (17) entity
1433  */
1434 typedef struct _dwg_entity_ARC
1435 {
1436   struct _dwg_object_entity *parent;
1437 
1438   BITCODE_3BD center;
1439   BITCODE_BD radius;
1440   BITCODE_BT thickness;
1441   BITCODE_BE extrusion;
1442   BITCODE_BD start_angle;
1443   BITCODE_BD end_angle;
1444 } Dwg_Entity_ARC;
1445 
1446 /**
1447  CIRCLE (18) entity
1448  */
1449 typedef struct _dwg_entity_CIRCLE
1450 {
1451   struct _dwg_object_entity *parent;
1452 
1453   BITCODE_3BD center;
1454   BITCODE_BD radius;
1455   BITCODE_BT thickness;
1456   BITCODE_BE extrusion;
1457 } Dwg_Entity_CIRCLE;
1458 
1459 /**
1460  LINE (19) entity
1461  */
1462 typedef struct _dwg_entity_LINE
1463 {
1464   struct _dwg_object_entity *parent;
1465 
1466   BITCODE_RC z_is_zero;
1467   BITCODE_3BD start;
1468   BITCODE_3BD end;
1469   BITCODE_BT thickness;
1470   BITCODE_BE extrusion;
1471 } Dwg_Entity_LINE;
1472 
1473 /**
1474  * Macro for common DIMENSION declaration
1475  *
1476  * flag 70: value & 31: 0-6 denote the type, + bitmask 32-128.
1477  * 0: linear, 1: aligned, 2: ang2ln, 3: diameter, 4: radius
1478  * 5: ang3pt, 6: ordinate.
1479  * 32: block (2) used by this dimension only.
1480  * 64: if set, ordinate is type X, else ordinate is type Y.
1481  * 128: non-default dimension text location
1482  */
1483 #define DIMENSION_COMMON                         \
1484   struct _dwg_object_entity *parent;             \
1485   BITCODE_RC class_version; /* R2010+ */         \
1486   BITCODE_BE extrusion;                          \
1487   BITCODE_3BD def_pt;                            \
1488   BITCODE_2RD text_midpt;                        \
1489   BITCODE_BD elevation;                          \
1490   BITCODE_RC flag; /* calculated, DXF only 70 */ \
1491   BITCODE_RC flag1; /* as in the DWG */          \
1492   BITCODE_T user_text;                           \
1493   BITCODE_BD text_rotation;                      \
1494   BITCODE_BD horiz_dir;                          \
1495   BITCODE_3BD ins_scale;                         \
1496   BITCODE_BD ins_rotation;                       \
1497   BITCODE_BS attachment;                         \
1498   BITCODE_BS lspace_style;                       \
1499   BITCODE_BD lspace_factor;                      \
1500   BITCODE_BD act_measurement;                    \
1501   BITCODE_B unknown;                             \
1502   BITCODE_B flip_arrow1;                         \
1503   BITCODE_B flip_arrow2;                         \
1504   BITCODE_2RD clone_ins_pt;                      \
1505   BITCODE_H dimstyle;                            \
1506   BITCODE_H block
1507 
1508 typedef struct _dwg_DIMENSION_common
1509 {
1510   DIMENSION_COMMON;
1511 } Dwg_DIMENSION_common;
1512 
1513 /**
1514  ordinate dimension - DIMENSION_ORDINATE (20) entity
1515  */
1516 typedef struct _dwg_entity_DIMENSION_ORDINATE
1517 {
1518   DIMENSION_COMMON;
1519   BITCODE_3BD feature_location_pt;
1520   BITCODE_3BD leader_endpt;
1521   BITCODE_RC flag2; // use_x_axis
1522 } Dwg_Entity_DIMENSION_ORDINATE;
1523 
1524 /**
1525  linear dimension - DIMENSION_LINEAR (21) entity
1526  */
1527 typedef struct _dwg_entity_DIMENSION_LINEAR
1528 {
1529   DIMENSION_COMMON;
1530   BITCODE_3BD xline1_pt;
1531   BITCODE_3BD xline2_pt;
1532   BITCODE_BD oblique_angle;
1533   BITCODE_BD dim_rotation;
1534 } Dwg_Entity_DIMENSION_LINEAR;
1535 
1536 /**
1537  aligned dimension - DIMENSION_ALIGNED (22) entity
1538  */
1539 typedef struct _dwg_entity_DIMENSION_ALIGNED
1540 {
1541   DIMENSION_COMMON;
1542   BITCODE_3BD xline1_pt;
1543   BITCODE_3BD xline2_pt;
1544   BITCODE_BD oblique_angle;
1545 } Dwg_Entity_DIMENSION_ALIGNED;
1546 
1547 /**
1548  angular 3pt dimension - DIMENSION_ANG3PT (23) entity
1549  */
1550 typedef struct _dwg_entity_DIMENSION_ANG3PT
1551 {
1552   DIMENSION_COMMON;
1553   BITCODE_3BD xline1_pt;
1554   BITCODE_3BD xline2_pt;
1555   BITCODE_3BD center_pt;
1556 } Dwg_Entity_DIMENSION_ANG3PT;
1557 
1558 /**
1559  angular 2 line dimension - DIMENSION_ANG2LN (24) entity
1560  */
1561 typedef struct _dwg_entity_DIMENSION_ANG2LN
1562 {
1563   DIMENSION_COMMON;
1564   BITCODE_3BD xline1start_pt;
1565   BITCODE_3BD xline1end_pt;
1566   BITCODE_3BD xline2start_pt;
1567   BITCODE_3BD xline2end_pt;
1568 } Dwg_Entity_DIMENSION_ANG2LN;
1569 
1570 /**
1571  radius dimension - DIMENSION_RADIUS (25) entity
1572  */
1573 typedef struct _dwg_entity_DIMENSION_RADIUS
1574 {
1575   DIMENSION_COMMON;
1576   BITCODE_3BD first_arc_pt; /*!< DXF 15 */
1577   BITCODE_BD leader_len;    /*!< DXF 40 */
1578 } Dwg_Entity_DIMENSION_RADIUS;
1579 
1580 /**
1581  diameter dimension - DIMENSION_DIAMETER (26) entity
1582  */
1583 typedef struct _dwg_entity_DIMENSION_DIAMETER
1584 {
1585   DIMENSION_COMMON;             /* DXF 10 def_pt = = far_chord_pt */
1586   BITCODE_3BD first_arc_pt; 	/*!< DXF 15 */
1587   BITCODE_BD leader_len;        /*!< DXF 40 */
1588 } Dwg_Entity_DIMENSION_DIAMETER;
1589 
1590 /**
1591  arc dimension - ARC_DIMENSION (varies) entity
1592  */
1593 typedef struct _dwg_entity_ARC_DIMENSION
1594 {
1595   DIMENSION_COMMON;
1596   BITCODE_3BD xline1_pt;	/* DXF 13 */
1597   BITCODE_3BD xline2_pt;	/* DXF 14 */
1598   BITCODE_3BD center_pt;	/* DXF 15 */
1599   BITCODE_B is_partial;		/* DXF 70 */
1600   BITCODE_BD arc_start_param;	/* DXF 41 */
1601   BITCODE_BD arc_end_param;	/* DXF 42 */
1602   BITCODE_B has_leader;		/* DXF 71 */
1603   BITCODE_3BD leader1_pt;	/* DXF 16 */
1604   BITCODE_3BD leader2_pt;	/* DXF 17 */
1605 } Dwg_Entity_ARC_DIMENSION;
1606 
1607 /**
1608  arc dimension - LARGE_RADIAL_DIMENSION (varies) entity
1609  */
1610 typedef struct _dwg_entity_LARGE_RADIAL_DIMENSION
1611 {
1612   DIMENSION_COMMON;
1613   BITCODE_3BD first_arc_pt; /*!< DXF 15 */
1614   BITCODE_BD leader_len;    /*!< DXF 40 */
1615   BITCODE_3BD ovr_center;   /*!< DXF 12-32 */
1616   BITCODE_3BD jog_point;    /*!< DXF 13-33 */
1617 } Dwg_Entity_LARGE_RADIAL_DIMENSION;
1618 
1619 /**
1620  Struct for:  POINT (27)
1621  */
1622 typedef struct _dwg_entity_POINT
1623 {
1624   struct _dwg_object_entity *parent;
1625 
1626   BITCODE_BD x;
1627   BITCODE_BD y;
1628   BITCODE_BD z;
1629   BITCODE_BT thickness;
1630   BITCODE_BE extrusion;
1631   BITCODE_BD x_ang;
1632 } Dwg_Entity_POINT;
1633 
1634 /**
1635  Struct for:  3D FACE (28)
1636  */
1637 typedef struct _dwg_entity_3DFACE
1638 {
1639   struct _dwg_object_entity *parent;
1640 
1641   BITCODE_B has_no_flags;
1642   BITCODE_B z_is_zero;
1643   BITCODE_3BD corner1;
1644   BITCODE_3BD corner2;
1645   BITCODE_3BD corner3;
1646   BITCODE_3BD corner4;
1647   BITCODE_BS invis_flags;
1648 } Dwg_Entity__3DFACE;
1649 
1650 /**
1651  Struct for:  POLYLINE (PFACE) (29)
1652  */
1653 typedef struct _dwg_entity_POLYLINE_PFACE
1654 {
1655   COMMON_ENTITY_POLYLINE;
1656 
1657   BITCODE_BS numverts;
1658   BITCODE_BS numfaces;
1659 } Dwg_Entity_POLYLINE_PFACE;
1660 
1661 /**
1662  Struct for:  POLYLINE (MESH) (30)
1663  */
1664 typedef struct _dwg_entity_POLYLINE_MESH
1665 {
1666   COMMON_ENTITY_POLYLINE;
1667 
1668   BITCODE_BS flag;
1669   BITCODE_BS curve_type;
1670   BITCODE_BS num_m_verts;
1671   BITCODE_BS num_n_verts;
1672   BITCODE_BS m_density;
1673   BITCODE_BS n_density;
1674 } Dwg_Entity_POLYLINE_MESH;
1675 
1676 /**
1677  Struct for:  SOLID (31)
1678  */
1679 
1680 typedef struct _dwg_entity_SOLID
1681 {
1682   struct _dwg_object_entity *parent;
1683 
1684   BITCODE_BT thickness;
1685   BITCODE_BD elevation;
1686   BITCODE_2RD corner1;
1687   BITCODE_2RD corner2;
1688   BITCODE_2RD corner3;
1689   BITCODE_2RD corner4;
1690   BITCODE_BE extrusion;
1691 } Dwg_Entity_SOLID;
1692 
1693 /**
1694  Struct for:  TRACE (32)
1695  */
1696 
1697 typedef struct _dwg_entity_TRACE
1698 {
1699   struct _dwg_object_entity *parent;
1700 
1701   BITCODE_BT thickness;
1702   BITCODE_BD elevation;
1703   BITCODE_2RD corner1;
1704   BITCODE_2RD corner2;
1705   BITCODE_2RD corner3;
1706   BITCODE_2RD corner4;
1707   BITCODE_BE extrusion;
1708 } Dwg_Entity_TRACE;
1709 
1710 /**
1711  Struct for:  SHAPE (33)
1712  */
1713 
1714 typedef struct _dwg_entity_SHAPE
1715 {
1716   struct _dwg_object_entity *parent;
1717 
1718   BITCODE_3BD ins_pt;
1719   BITCODE_BD scale;
1720   BITCODE_BD rotation;
1721   BITCODE_BD width_factor;
1722   BITCODE_BD oblique_angle;
1723   BITCODE_BD thickness;
1724   BITCODE_BS style_id;
1725   BITCODE_BE extrusion;
1726   BITCODE_H style;
1727 } Dwg_Entity_SHAPE;
1728 
1729 /**
1730  Struct for:  VIEWPORT ENTITY (34)
1731  */
1732 
1733 typedef struct _dwg_entity_VIEWPORT
1734 {
1735   struct _dwg_object_entity *parent;
1736 
1737   BITCODE_3BD center;
1738   BITCODE_BD width;
1739   BITCODE_BD height;
1740   BITCODE_RS on_off; /* DXF 68, -1 should be accepted also */
1741   BITCODE_RS id;     /* DXF 69 */
1742 
1743   BITCODE_3BD view_target;
1744   BITCODE_3BD VIEWDIR;
1745   BITCODE_BD twist_angle;
1746   BITCODE_BD VIEWSIZE; // the height
1747   BITCODE_BD lens_length;
1748   BITCODE_BD front_clip_z;
1749   BITCODE_BD back_clip_z;
1750   BITCODE_BD SNAPANG;
1751   BITCODE_2RD VIEWCTR;
1752   BITCODE_2RD SNAPBASE;
1753   BITCODE_2RD SNAPUNIT;
1754   BITCODE_2RD GRIDUNIT;
1755   BITCODE_BS circle_zoom;
1756   BITCODE_BS grid_major;
1757   BITCODE_BL num_frozen_layers;
1758   BITCODE_BL status_flag;
1759   BITCODE_TV style_sheet;
1760   BITCODE_RC render_mode;
1761   BITCODE_B ucs_at_origin;
1762   BITCODE_B UCSVP;
1763   BITCODE_3BD ucsorg;
1764   BITCODE_3BD ucsxdir;
1765   BITCODE_3BD ucsydir;
1766   BITCODE_BD ucs_elevation;
1767   BITCODE_BS UCSORTHOVIEW;
1768   BITCODE_BS shadeplot_mode;
1769   BITCODE_B use_default_lights;
1770   BITCODE_RC default_lighting_type;
1771   BITCODE_BD brightness;
1772   BITCODE_BD contrast;
1773   BITCODE_CMC ambient_color;
1774   BITCODE_H vport_entity_header;
1775   BITCODE_H *frozen_layers;
1776   BITCODE_H clip_boundary;
1777   BITCODE_H named_ucs;
1778   BITCODE_H base_ucs;
1779   BITCODE_H background;
1780   BITCODE_H visualstyle;
1781   BITCODE_H shadeplot;
1782   BITCODE_H sun;
1783 } Dwg_Entity_VIEWPORT;
1784 
1785 /**
1786  ELLIPSE (35) entity
1787  */
1788 typedef struct _dwg_entity_ELLIPSE
1789 {
1790   struct _dwg_object_entity *parent;
1791 
1792   BITCODE_3BD center;
1793   BITCODE_3BD sm_axis;
1794   BITCODE_BE extrusion;
1795   BITCODE_BD axis_ratio; /* i.e RadiusRatio */
1796   BITCODE_BD start_angle;
1797   BITCODE_BD end_angle;
1798 } Dwg_Entity_ELLIPSE;
1799 
1800 /**
1801  spline - SPLINE (36) entity
1802  */
1803 typedef struct _dwg_SPLINE_control_point
1804 {
1805   struct _dwg_entity_SPLINE *parent;
1806 
1807   double x;
1808   double y;
1809   double z;
1810   double w;
1811 } Dwg_SPLINE_control_point;
1812 
1813 typedef struct _dwg_entity_SPLINE
1814 {
1815   struct _dwg_object_entity *parent;
1816 
1817   BITCODE_RS flag; /* computed */
1818   BITCODE_BS scenario; /* 1 spline, 2 bezier */
1819   BITCODE_BS degree;
1820   BITCODE_BL splineflags1; /* 2013+: method fit points = 1, CV frame show = 2, closed = 4 */
1821   BITCODE_BL knotparam;    /* 2013+: Chord = 0, Square root = 1, Uniform = 2, Custom = 15 */
1822   BITCODE_BD fit_tol;
1823   BITCODE_3BD beg_tan_vec;
1824   BITCODE_3BD end_tan_vec;
1825   BITCODE_B closed_b; /* bit 0 of 70 */
1826   BITCODE_B periodic; /* bit 1 of 70 */
1827   BITCODE_B rational; /* bit 2 of 70 */
1828   BITCODE_B weighted; /* bit 4 of 70 */
1829   BITCODE_BD knot_tol;
1830   BITCODE_BD ctrl_tol;
1831   BITCODE_BS num_fit_pts;
1832   BITCODE_3DPOINT* fit_pts;
1833   BITCODE_BL num_knots;
1834   BITCODE_BD* knots;
1835   BITCODE_BL num_ctrl_pts;
1836   Dwg_SPLINE_control_point* ctrl_pts;
1837 } Dwg_Entity_SPLINE;
1838 
1839 /**
1840  3DSOLID (38) entity
1841  */
1842 #define Dwg_Entity_3DSOLID Dwg_Entity__3DSOLID
1843 typedef struct _dwg_3DSOLID_wire
1844 {
1845   struct _dwg_entity_3DSOLID *parent;
1846   BITCODE_RC type;
1847   BITCODE_BLd selection_marker;
1848   BITCODE_BL color;
1849   BITCODE_BLd acis_index;
1850   BITCODE_BL num_points;
1851   BITCODE_3BD* points;
1852   BITCODE_B transform_present;
1853   BITCODE_3BD axis_x;
1854   BITCODE_3BD axis_y;
1855   BITCODE_3BD axis_z;
1856   BITCODE_3BD translation;
1857   BITCODE_3BD scale;
1858   BITCODE_B has_rotation;
1859   BITCODE_B has_reflection;
1860   BITCODE_B has_shear;
1861 } Dwg_3DSOLID_wire;
1862 
1863 typedef struct _dwg_3DSOLID_silhouette
1864 {
1865   struct _dwg_entity_3DSOLID *parent;
1866   BITCODE_BL vp_id;
1867   BITCODE_3BD vp_target;
1868   BITCODE_3BD vp_dir_from_target;
1869   BITCODE_3BD vp_up_dir;
1870   BITCODE_B vp_perspective;
1871   BITCODE_B has_wires;
1872   BITCODE_BL num_wires;
1873   Dwg_3DSOLID_wire * wires;
1874 } Dwg_3DSOLID_silhouette;
1875 
1876 typedef struct _dwg_3DSOLID_material
1877 {
1878   struct _dwg_entity_3DSOLID *parent;
1879   BITCODE_BL array_index;
1880   BITCODE_BL mat_absref;
1881   BITCODE_H  material_handle; /* code 5 */
1882 } Dwg_3DSOLID_material;
1883 
1884 #define _3DSOLID_FIELDS                                                 \
1885   BITCODE_B acis_empty;                                                 \
1886   BITCODE_B unknown;                                                    \
1887   BITCODE_BS version;                                                   \
1888   BITCODE_BL num_blocks;                                                \
1889   BITCODE_BL* block_size;                                               \
1890   char** encr_sat_data;                                                 \
1891   BITCODE_BL sab_size;                                                  \
1892   BITCODE_RC* acis_data; /* The decrypted SAT v1 or the SAB v2 stream */ \
1893   BITCODE_B wireframe_data_present;                                     \
1894   BITCODE_B point_present;                                              \
1895   BITCODE_3BD point;                                                    \
1896   BITCODE_BL isolines; /* i.e. wires */                                 \
1897   BITCODE_B isoline_present; /* ie. has_wires */                        \
1898   BITCODE_BL num_wires;                                                 \
1899   Dwg_3DSOLID_wire * wires;                                             \
1900   BITCODE_BL num_silhouettes;                                           \
1901   Dwg_3DSOLID_silhouette * silhouettes;                                 \
1902   BITCODE_B _dxf_sab_converted;  /* internally calculated */            \
1903   BITCODE_B acis_empty2;                                                \
1904   struct _dwg_entity_3DSOLID* extra_acis_data;                          \
1905   BITCODE_BL num_materials;                                             \
1906   Dwg_3DSOLID_material *materials;                                      \
1907   BITCODE_RC revision_guid[39];                                         \
1908   BITCODE_BL revision_major;                                            \
1909   BITCODE_BS revision_minor1;                                           \
1910   BITCODE_BS revision_minor2;                                           \
1911   BITCODE_RC revision_bytes[9];                                         \
1912   BITCODE_BL end_marker;                                                \
1913   BITCODE_H history_id;                                                 \
1914   BITCODE_B has_revision_guid;                                          \
1915   BITCODE_B acis_empty_bit
1916 
1917 typedef struct _dwg_entity_3DSOLID
1918 {
1919   struct _dwg_object_entity *parent;
1920   _3DSOLID_FIELDS;
1921 #if 0
1922   BITCODE_B acis_empty;  /*!< no DXF */
1923   BITCODE_B unknown;
1924   BITCODE_BS version;    /*!< DXF 70 Modeler format version =1*/
1925   BITCODE_BL num_blocks;
1926   BITCODE_BL* block_size;
1927   char** encr_sat_data;       /*!< DXF 1, the encrypted SAT data */
1928   BITCODE_RC*  acis_data;     /*!< decrypted SAT data */
1929   BITCODE_B wireframe_data_present;
1930   BITCODE_B point_present;
1931   BITCODE_3BD point;
1932   BITCODE_BL num_isolines;
1933   BITCODE_B isoline_present;
1934   BITCODE_BL num_wires;
1935   Dwg_3DSOLID_wire * wires;
1936   BITCODE_BL num_silhouettes;
1937   Dwg_3DSOLID_silhouette * silhouettes;
1938   BITCODE_B acis_empty2;
1939   struct _dwg_entity_3DSOLID* extra_acis_data;/* is it the best approach? */
1940   BITCODE_BL unknown_2007;
1941   BITCODE_H history_id;
1942   BITCODE_B acis_empty_bit;
1943 #endif
1944 } Dwg_Entity__3DSOLID;
1945 
1946 /**
1947  REGION (37) entity
1948  */
1949 typedef Dwg_Entity__3DSOLID Dwg_Entity_REGION;
1950 
1951 /**
1952  BODY (39) entity
1953  */
1954 typedef Dwg_Entity__3DSOLID Dwg_Entity_BODY;
1955 
1956 /**
1957  ray - RAY (40) entity
1958  */
1959 typedef struct _dwg_entity_RAY
1960 {
1961   struct _dwg_object_entity *parent;
1962 
1963   BITCODE_3BD point;   /*!< DXF 10 */
1964   BITCODE_3BD vector;  /*!< DXF 11 */
1965 } Dwg_Entity_RAY;
1966 
1967 /**
1968  XLINE (41) entity
1969  */
1970 typedef Dwg_Entity_RAY Dwg_Entity_XLINE;
1971 
1972 /**
1973  DICTIONARY (42)
1974  This structure is used for all the new tables.
1975  Beware: Keep same offsets as DICTIONARYWDFLT
1976  */
1977 typedef struct _dwg_object_DICTIONARY
1978 {
1979   struct _dwg_object_object *parent;
1980 
1981   BITCODE_BL numitems;    /*!< no DXF */
1982   BITCODE_RC is_hardowner;/*!< DXF 280 */
1983   BITCODE_BS cloning;     /*!< DXF 281, ie merge_style */
1984   BITCODE_T* texts;       /*!< DXF 3 */
1985   BITCODE_H* itemhandles; /*!< DXF 350/360, pairwise with texts */
1986   BITCODE_RC cloning_r14; /*!< r14 only */
1987 } Dwg_Object_DICTIONARY;
1988 
1989 /**
1990  Class DICTIONARYWDFLT (varies)
1991  */
1992 typedef struct _dwg_object_DICTIONARYWDFLT
1993 {
1994   struct _dwg_object_object *parent;
1995 
1996   BITCODE_BL numitems;    /*!< no DXF */
1997   BITCODE_RC is_hardowner;/*!< DXF 280 */
1998   BITCODE_BS cloning;     /*!< DXF 281, ie merge_style */
1999   BITCODE_T* texts;       /*!< DXF 3 */
2000   BITCODE_H* itemhandles; /*!< DXF 350/360, pairwise with texts */
2001   BITCODE_RL cloning_r14; /*!< r14 only */
2002 
2003   BITCODE_H defaultid;
2004 } Dwg_Object_DICTIONARYWDFLT;
2005 
2006 /**
2007  OLEFRAME (43) entity
2008  (replaced by OLE2FRAME (74) later)
2009  */
2010 typedef struct _dwg_entity_OLEFRAME
2011 {
2012   struct _dwg_object_entity *parent;
2013 
2014   BITCODE_BS flag;
2015   BITCODE_BS mode;
2016   BITCODE_BL data_size;
2017   BITCODE_TF data;
2018 } Dwg_Entity_OLEFRAME;
2019 
2020 /**
2021  MTEXT (44) entity
2022  */
2023 typedef struct _dwg_entity_MTEXT
2024 {
2025   struct _dwg_object_entity *parent;
2026 
2027   BITCODE_3BD ins_pt;	   /*!< DXF 10 */
2028   BITCODE_BE extrusion;    /*!< DXF 210 */
2029   BITCODE_3BD x_axis_dir;  /*!< DXF 11, defines the rotation */
2030   BITCODE_BD rect_height;  /*!< no DXF */
2031   BITCODE_BD rect_width;   /*!< DXF 41 */
2032   BITCODE_BD text_height;  /*!< DXF 40 >= 0.0 */
2033   BITCODE_BS attachment;   /*!< DXF 71.
2034                              1 = Top left, 2 = Top center, 3 = Top
2035                              right, 4 = Middle left, 5 = Middle
2036                              center, 6 = Middle right, 7 = Bottom
2037                              left, 8 = Bottom center, 9 = Bottom
2038                              right */
2039   BITCODE_BS flow_dir;     /*!< DXF 72.
2040                               1 = Left to right, 3 = Top to bottom,
2041                               5 = By style (the flow direction is inherited
2042                               from the associated text style) */
2043   BITCODE_BD extents_width;  /*!< DXF 42 */
2044   BITCODE_BD extents_height; /*!< DXF 43 the actual height */
2045   BITCODE_T text;           /*!< DXF 1 */
2046   BITCODE_H style;           /*!< DXF 7 */
2047   BITCODE_BS linespace_style; /*!< DXF 73. r2000+ */
2048   BITCODE_BD linespace_factor;/*!< DXF 44. r2000+. Mtext line spacing factor (optional):
2049                                Percentage of default (3-on-5) line spacing to
2050                                be applied. Valid values range from 0.25 to 4.00 */
2051   BITCODE_B unknown_b0;      // always 0
2052   BITCODE_BL bg_fill_flag;   /*!< DXF 90. r2004+
2053                                0 = Background fill off,
2054                                1 = Use background fill color,
2055                                2 = Use drawing window color as background fill color.
2056                               16 = textframe (r2018+) */
2057   BITCODE_BL bg_fill_scale;  /*!< DXF 45. r2004+
2058                                margin around the text. */
2059   BITCODE_CMC bg_fill_color; /*!< DXF 63. r2004+. on bg_fill_flag==1 */
2060   BITCODE_BL bg_fill_trans;  /*!< DXF 441. r2004+. unused */
2061   BITCODE_B is_not_annotative;   /*!< r2018+: */
2062   BITCODE_BS class_version;      /*!< always 0 */
2063   BITCODE_B default_flag;        /*!< DXF 70. default true */
2064   BITCODE_H appid;
2065   BITCODE_BL ignore_attachment;  /*!< redundant copy, not BS */
2066   BITCODE_BS column_type;        /*!< DXF 71 0: none, 1: static, 2: dynamic. */
2067   BITCODE_BL numfragments;       /*!< DXF 72 if static */
2068   BITCODE_BD column_width;       /*!< DXF 44 */
2069   BITCODE_BD gutter;             /*!< DXF 45 */
2070   BITCODE_B auto_height;         /*!< DXF 73 */
2071   BITCODE_B flow_reversed;       /*!< DXF 74 */
2072   BITCODE_BL num_column_heights; /*!< DXF 72 if dynamic and not auto_height */
2073   BITCODE_BD *column_heights;    /*!< DXF 46 */
2074 } Dwg_Entity_MTEXT;
2075 
2076 /**
2077  LEADER (45) entity
2078  */
2079 typedef struct _dwg_entity_LEADER
2080 {
2081   struct _dwg_object_entity *parent;
2082 
2083   BITCODE_B unknown_bit_1;  /* always seems to be zero */
2084   BITCODE_BS path_type;     /*< DXF(72) 0: line, 1: spline (oda bug) */
2085   BITCODE_BS annot_type;    /*< DXF(73) 0: text, 1: tol, 2: insert, 3 (def): none */
2086   BITCODE_BL num_points;    /*< DXF(76) */
2087   BITCODE_3DPOINT* points;
2088   BITCODE_3DPOINT origin;
2089   BITCODE_BE extrusion;
2090   BITCODE_3DPOINT x_direction;
2091   BITCODE_3DPOINT inspt_offset;
2092   BITCODE_3DPOINT endptproj; /* R_14-R_2007 ? */
2093   BITCODE_BD dimgap;         /* R_13-R_14 only */
2094   BITCODE_BD box_height;
2095   BITCODE_BD box_width;
2096   BITCODE_B hookline_dir;
2097   BITCODE_B arrowhead_on;
2098   BITCODE_BS arrowhead_type;
2099   BITCODE_BD dimasz;
2100   BITCODE_B unknown_bit_2;
2101   BITCODE_B unknown_bit_3;
2102   BITCODE_BS unknown_short_1;
2103   BITCODE_BS byblock_color;
2104   BITCODE_B hookline_on;
2105   BITCODE_B unknown_bit_5;
2106   BITCODE_H associated_annotation; /* DXF 340 Hard reference to associated annotation (mtext, tolerance, or insert entity) */
2107   BITCODE_H dimstyle;
2108 } Dwg_Entity_LEADER;
2109 
2110 /**
2111  TOLERANCE (46) entity
2112  */
2113 typedef struct _dwg_entity_TOLERANCE
2114 {
2115   struct _dwg_object_entity *parent;
2116 
2117   BITCODE_BS unknown_short;
2118   BITCODE_BD height;
2119   BITCODE_BD dimgap;
2120   BITCODE_3BD ins_pt;
2121   BITCODE_3BD x_direction;
2122   BITCODE_BE extrusion;
2123   BITCODE_T text_value;
2124   BITCODE_H dimstyle;
2125 } Dwg_Entity_TOLERANCE;
2126 
2127 /**
2128  MLINE (47) entity
2129  */
2130 typedef struct _dwg_MLINE_line
2131 {
2132   struct _dwg_MLINE_vertex *parent;
2133   BITCODE_BS num_segparms;
2134   BITCODE_BD * segparms;
2135   BITCODE_BS num_areafillparms;
2136   BITCODE_BD* areafillparms;
2137 } Dwg_MLINE_line;
2138 
2139 typedef struct _dwg_MLINE_vertex
2140 {
2141   struct _dwg_entity_MLINE *parent;
2142   BITCODE_3BD vertex;
2143   BITCODE_3BD vertex_direction;
2144   BITCODE_3BD miter_direction;
2145   BITCODE_RC num_lines;
2146   Dwg_MLINE_line* lines;
2147 } Dwg_MLINE_vertex;
2148 
2149 typedef struct _dwg_entity_MLINE
2150 {
2151   struct _dwg_object_entity *parent;
2152 
2153   BITCODE_BD scale;
2154   BITCODE_RC justification;
2155   BITCODE_3BD base_point;
2156   BITCODE_BE extrusion;
2157   BITCODE_BS flags;
2158   BITCODE_RC num_lines; /* Linesinstyle */
2159   BITCODE_BS num_verts;
2160   Dwg_MLINE_vertex* verts;
2161   BITCODE_H mlinestyle;
2162 } Dwg_Entity_MLINE;
2163 
2164 #define COMMON_TABLE_CONTROL_FIELDS  \
2165   struct _dwg_object_object *parent; \
2166   BITCODE_BS num_entries;            \
2167   BITCODE_H* entries
2168 
2169 // table entries may be imported from xref's
2170 
2171 #define COMMON_TABLE_FIELDS(laytype)      \
2172   struct _dwg_object_object *parent;      \
2173   BITCODE_##laytype flag;                 \
2174   BITCODE_T  name;                        \
2175   BITCODE_RS used;                        \
2176   /* may be referenced by xref: */        \
2177   BITCODE_B  is_xref_ref;                 \
2178   /* is a xref reference: */              \
2179   BITCODE_BS is_xref_resolved; /* 0 or 256 */ \
2180   /* is dependent on xref: */             \
2181   BITCODE_B  is_xref_dep;                 \
2182   BITCODE_H  xref
2183 
2184 /**
2185  BLOCK_CONTROL (48) object, table header
2186  */
2187 typedef struct _dwg_object_BLOCK_CONTROL
2188 {
2189   COMMON_TABLE_CONTROL_FIELDS;
2190   BITCODE_H model_space;
2191   BITCODE_H paper_space;
2192 } Dwg_Object_BLOCK_CONTROL;
2193 
2194 /**
2195  BLOCK_HEADER (49) object, table entry
2196  */
2197 typedef struct _dwg_object_BLOCK_HEADER
2198 {
2199   COMMON_TABLE_FIELDS(RC);
2200   BITCODE_BL __iterator;
2201   BITCODE_RC flag2; /* preR13 */
2202   BITCODE_RS flag3; /* preR13 */
2203   BITCODE_B anonymous;    /* flag 70 bit 1 */
2204   BITCODE_B hasattrs;     /* flag 70 bit 2 */
2205   BITCODE_B blkisxref;    /* flag 70 bit 3 */
2206   BITCODE_B xrefoverlaid; /* flag 70 bit 4 */
2207   BITCODE_B loaded_bit;   /* flag 70 bit 6 */
2208   BITCODE_BL num_owned;
2209   BITCODE_3DPOINT base_pt;
2210   BITCODE_TV xref_pname;
2211   BITCODE_RL num_inserts;
2212   BITCODE_TV description;
2213   BITCODE_BL preview_size; /* no DXF. BLL? */
2214   BITCODE_TF preview;      /* DXF 310. Called PreviewIcon */
2215   BITCODE_BS insert_units;
2216   BITCODE_B explodable;
2217   BITCODE_RC block_scaling;
2218   BITCODE_H block_entity;
2219   BITCODE_H first_entity;
2220   BITCODE_H last_entity;
2221   BITCODE_H* entities;
2222   BITCODE_H endblk_entity;
2223   BITCODE_H* inserts;
2224   BITCODE_H layout;
2225 } Dwg_Object_BLOCK_HEADER;
2226 
2227 /**
2228  LAYER_CONTROL (50) object, table header
2229  */
2230 typedef struct _dwg_object_LAYER_CONTROL
2231 {
2232   COMMON_TABLE_CONTROL_FIELDS;
2233 } Dwg_Object_LAYER_CONTROL;
2234 
2235 /**
2236  LAYER (51) object, table entry
2237  */
2238 typedef struct _dwg_object_LAYER
2239 {
2240   /*<! flag DXF 70 r2000+
2241      1:  frozen
2242      2:  on
2243      4:  frozen_in_new
2244      8:  locked
2245      bits 6-10: linewt
2246      32768: plotflag (bit 16)
2247  */
2248   COMMON_TABLE_FIELDS(BS);
2249   BITCODE_B frozen;
2250   BITCODE_B on;
2251   BITCODE_B frozen_in_new;
2252   BITCODE_B locked;
2253   BITCODE_B plotflag;
2254   BITCODE_RC linewt;
2255   BITCODE_CMC color;
2256   short      color_rs;    /* preR13, needs to be signed */
2257   BITCODE_RS ltype_rs;    /* preR13 */
2258   BITCODE_H plotstyle;    /* DXF 390 */
2259   BITCODE_H material;     /* DXF 347 */
2260   BITCODE_H ltype;        /* DXF 6 */
2261   BITCODE_H visualstyle;  /* DXF 348 */
2262 } Dwg_Object_LAYER;
2263 
2264 /**
2265  STYLE_CONTROL (52) object, table header
2266  */
2267 typedef struct _dwg_object_STYLE_CONTROL
2268 {
2269   COMMON_TABLE_CONTROL_FIELDS;
2270 } Dwg_Object_STYLE_CONTROL;
2271 
2272 /**
2273  STYLE (53) object, table entry.
2274  TextStyleTableRecord. Some call it SHAPEFILE.
2275  */
2276 typedef struct _dwg_object_STYLE
2277 {
2278   /*<! flag DXF 70:
2279      1:  is_vertical
2280      2:  is_upsidedown
2281      4:  is_shape
2282      8:  underlined
2283      16: overlined (0x10)
2284      32: is_shx
2285      64: pre_loaded (0x40)
2286     128: is_backward (0x80)
2287     256: shape_loaded (0x100)
2288     512: is_striked (0x200)
2289  */
2290   COMMON_TABLE_FIELDS(RC);
2291   BITCODE_B is_shape;
2292   BITCODE_B is_vertical;
2293   BITCODE_BD text_size;
2294   BITCODE_BD width_factor;
2295   BITCODE_BD oblique_angle;
2296   BITCODE_RC generation;
2297   BITCODE_BD last_height;
2298   BITCODE_T font_file;
2299   BITCODE_T bigfont_file;
2300 } Dwg_Object_STYLE;
2301 
2302 /* 54 and 55 are UNKNOWN OBJECTS */
2303 
2304 /**
2305  LTYPE_CONTROL (56) object, table header
2306  */
2307 typedef struct _dwg_object_LTYPE_CONTROL
2308 {
2309   COMMON_TABLE_CONTROL_FIELDS;
2310   BITCODE_H bylayer;
2311   BITCODE_H byblock;
2312 } Dwg_Object_LTYPE_CONTROL;
2313 
2314 /**
2315  LTYPE (57) object, table entry
2316  */
2317 
2318 typedef struct _dwg_LTYPE_dash {
2319   struct _dwg_object_LTYPE *parent;
2320   BITCODE_BD length;
2321   BITCODE_BS complex_shapecode; /* on shape_flag 2: shape number.
2322                                    4: index into strings_area. */
2323   BITCODE_H style;
2324   BITCODE_RD x_offset;
2325   BITCODE_RD y_offset;
2326   BITCODE_BD scale;
2327   BITCODE_BD rotation;
2328   BITCODE_BS shape_flag; /* 1: text rotated 0, 2: complex_shapecode is index,
2329                             4: complex_shapecode is index into strings_area. */
2330   BITCODE_T  text;       /* DXF 9, only if shape_flag & 2. e.g. GAS_LINE */
2331 } Dwg_LTYPE_dash;
2332 
2333 typedef struct _dwg_object_LTYPE
2334 {
2335   COMMON_TABLE_FIELDS(RC);
2336   BITCODE_TV description;
2337   BITCODE_BD pattern_len;
2338   BITCODE_RC alignment;
2339   BITCODE_RC num_dashes;
2340   Dwg_LTYPE_dash* dashes;
2341   BITCODE_RD* dashes_r11;
2342   BITCODE_B has_strings_area; /* if some shape_flag & 4 (ODA bug) */
2343   BITCODE_TF strings_area;
2344 } Dwg_Object_LTYPE;
2345 
2346 /* 58 and 59 are UNKNOWN OBJECTS */
2347 
2348 /**
2349  VIEW_CONTROL (60) object, table header
2350  */
2351 typedef struct _dwg_object_VIEW_CONTROL
2352 {
2353   COMMON_TABLE_CONTROL_FIELDS;
2354 } Dwg_Object_VIEW_CONTROL;
2355 
2356 /**
2357  VIEW (61) object, table entry
2358  */
2359 typedef struct _dwg_object_VIEW
2360 {
2361   COMMON_TABLE_FIELDS(RC);
2362   // AbstractViewTableRecord
2363   BITCODE_BD VIEWSIZE;
2364   BITCODE_BD view_width;
2365   BITCODE_BD aspect_ratio;
2366   // ViInfo
2367   BITCODE_2RD VIEWCTR;
2368   BITCODE_3BD view_target;
2369   BITCODE_3BD VIEWDIR;
2370   BITCODE_BD twist_angle;
2371   BITCODE_BD lens_length;
2372   BITCODE_BD front_clip_z;
2373   BITCODE_BD back_clip_z;
2374   BITCODE_4BITS VIEWMODE; // DXF 71. 0: perspective, 1: front_clip_on, 2: back_clip_on, 3: front_clip_at_eye_on
2375   BITCODE_RC render_mode;
2376   BITCODE_B use_default_lights;
2377   BITCODE_RC default_lightning_type;
2378   BITCODE_BD brightness;
2379   BITCODE_BD contrast;
2380   BITCODE_CMC ambient_color;
2381   // ViewTableRecord
2382   BITCODE_B is_pspace;
2383   BITCODE_B associated_ucs;
2384   BITCODE_3BD ucsorg;
2385   BITCODE_3BD ucsxdir;
2386   BITCODE_3BD ucsydir;
2387   BITCODE_BD ucs_elevation;
2388   BITCODE_BS UCSORTHOVIEW;
2389   BITCODE_B is_camera_plottable;
2390   BITCODE_H background;
2391   BITCODE_H visualstyle;
2392   BITCODE_H sun;
2393   BITCODE_H base_ucs;
2394   BITCODE_H named_ucs;
2395   BITCODE_H livesection;
2396 } Dwg_Object_VIEW;
2397 
2398 /**
2399  UCS_CONTROL (62) object, table header
2400  */
2401 typedef struct _dwg_object_UCS_CONTROL
2402 {
2403   COMMON_TABLE_CONTROL_FIELDS;
2404 } Dwg_Object_UCS_CONTROL;
2405 
2406 /**
2407  UCS (63) object, table entry
2408  */
2409 typedef struct _dwg_UCS_orthopts
2410 {
2411   struct _dwg_object_UCS *parent;
2412   BITCODE_BS  type; // 71
2413   BITCODE_3BD pt;   // 13
2414 } Dwg_UCS_orthopts;
2415 
2416 typedef struct _dwg_object_UCS
2417 {
2418   COMMON_TABLE_FIELDS(RC);
2419   BITCODE_3BD ucsorg;
2420   BITCODE_3BD ucsxdir;
2421   BITCODE_3BD ucsydir;
2422   BITCODE_BD ucs_elevation;
2423   BITCODE_BS UCSORTHOVIEW;
2424   BITCODE_H base_ucs;
2425   BITCODE_H named_ucs;
2426   BITCODE_BS num_orthopts; // missing in ODA docs
2427   Dwg_UCS_orthopts *orthopts;
2428 } Dwg_Object_UCS;
2429 
2430 /**
2431  VPORT_CONTROL (64) object, table header
2432  */
2433 typedef struct _dwg_object_VPORT_CONTROL
2434 {
2435   COMMON_TABLE_CONTROL_FIELDS;
2436 } Dwg_Object_VPORT_CONTROL;
2437 
2438 /**
2439  VPORT (65) object, table entry
2440  */
2441 typedef struct _dwg_object_VPORT
2442 {
2443   COMMON_TABLE_FIELDS(RC);
2444   // AbstractViewTableRecord
2445   BITCODE_BD VIEWSIZE;     // really the view height
2446   BITCODE_BD view_width;   // in DWG r13+, needed to calc. aspect_ratio
2447   BITCODE_BD aspect_ratio; // DXF 41 = view_width / VIEWSIZE
2448   // ViInfo
2449   BITCODE_2RD VIEWCTR;
2450   BITCODE_3BD view_target;
2451   BITCODE_3BD VIEWDIR;
2452   BITCODE_BD view_twist;
2453   BITCODE_BD lens_length;
2454   BITCODE_BD front_clip_z;
2455   BITCODE_BD back_clip_z;
2456   BITCODE_4BITS VIEWMODE;
2457   BITCODE_RC render_mode;
2458   BITCODE_B use_default_lights;
2459   BITCODE_RC default_lightning_type;
2460   BITCODE_BD brightness;
2461   BITCODE_BD contrast;
2462   BITCODE_CMC ambient_color;
2463   // ViewportTableRecord
2464   BITCODE_2RD lower_left;
2465   BITCODE_2RD upper_right;
2466   BITCODE_B UCSFOLLOW;
2467   BITCODE_BS circle_zoom; /* circle sides: nr of tesselations */
2468   BITCODE_B FASTZOOM;
2469   BITCODE_RC UCSICON;     /* DXF 71:  0: icon_on, 1: icon_at_ucsorg */
2470   BITCODE_B GRIDMODE;     /* DXF 76: on or off */
2471   BITCODE_2RD GRIDUNIT;
2472   BITCODE_B SNAPMODE;     /* DXF 75: on or off */
2473   BITCODE_B SNAPSTYLE;
2474   BITCODE_BS SNAPISOPAIR;
2475   BITCODE_BD SNAPANG;
2476   BITCODE_2RD SNAPBASE;
2477   BITCODE_2RD SNAPUNIT;
2478   BITCODE_B ucs_at_origin;
2479   BITCODE_B UCSVP;
2480   BITCODE_3BD ucsorg;
2481   BITCODE_3BD ucsxdir;
2482   BITCODE_3BD ucsydir;
2483   BITCODE_BD ucs_elevation;
2484   BITCODE_BS UCSORTHOVIEW;
2485   BITCODE_BS grid_flags; /* bit 1: bound to limits, bit 2: adaptive */
2486   BITCODE_BS grid_major;
2487   BITCODE_H background;
2488   BITCODE_H visualstyle;
2489   BITCODE_H sun;
2490   BITCODE_H named_ucs;
2491   BITCODE_H base_ucs;
2492 } Dwg_Object_VPORT;
2493 
2494 /**
2495  APPID_CONTROL (66) object
2496  The table header of all registered applications
2497  */
2498 typedef struct _dwg_object_APPID_CONTROL
2499 {
2500   COMMON_TABLE_CONTROL_FIELDS;
2501 } Dwg_Object_APPID_CONTROL;
2502 
2503 /**
2504  APPID (67) object
2505  The table entry of a registered application
2506  */
2507 typedef struct _dwg_object_APPID
2508 {
2509   COMMON_TABLE_FIELDS(RC);
2510   BITCODE_RC unknown;
2511 } Dwg_Object_APPID;
2512 
2513 /**
2514  DIMSTYLE_CONTROL (68) object
2515  The table header of all dimension styles
2516  */
2517 typedef struct _dwg_object_DIMSTYLE_CONTROL
2518 {
2519   COMMON_TABLE_CONTROL_FIELDS;
2520   BITCODE_RC num_morehandles; /* DXF 71 undocumented */
2521   BITCODE_H* morehandles;     /* DXF 340 */
2522 } Dwg_Object_DIMSTYLE_CONTROL;
2523 
2524 /**
2525  DIMSTYLE (69) object, table entry
2526  */
2527 typedef struct _dwg_object_DIMSTYLE
2528 {
2529   COMMON_TABLE_FIELDS(RC);
2530   BITCODE_B DIMTOL;
2531   BITCODE_B DIMLIM;
2532   BITCODE_B DIMTIH;
2533   BITCODE_B DIMTOH;
2534   BITCODE_B DIMSE1;
2535   BITCODE_B DIMSE2;
2536   BITCODE_B DIMALT;
2537   BITCODE_B DIMTOFL;
2538   BITCODE_B DIMSAH;
2539   BITCODE_B DIMTIX;
2540   BITCODE_B DIMSOXD;
2541   BITCODE_BS DIMALTD;   /*!< r13-r14 only RC */
2542   BITCODE_BS DIMZIN;    /*!< r13-r14 only RC */
2543   BITCODE_B DIMSD1;
2544   BITCODE_B DIMSD2;
2545   BITCODE_BS DIMTOLJ;   /*!< r13-r14 only RC */
2546   BITCODE_BS DIMJUST;   /*!< r13-r14 only RC */
2547   BITCODE_BS DIMFIT;    /*!< r13-r14 only RC */
2548   BITCODE_B DIMUPT;
2549   BITCODE_BS DIMTZIN;   /*!< r13-r14 only RC */
2550   BITCODE_BS DIMMALTZ;  /*!< r13-r14 only RC */
2551   BITCODE_BS DIMMALTTZ; /*!< r13-r14 only RC */
2552   BITCODE_BS DIMTAD;    /*!< r13-r14 only RC */
2553   BITCODE_BS DIMUNIT;
2554   BITCODE_BS DIMAUNIT;
2555   BITCODE_BS DIMDEC;
2556   BITCODE_BS DIMTDEC;
2557   BITCODE_BS DIMALTU;
2558   BITCODE_BS DIMALTTD;
2559   /* BITCODE_H DIMTXSTY; */
2560   BITCODE_BD DIMSCALE;
2561   BITCODE_BD DIMASZ;
2562   BITCODE_BD DIMEXO;
2563   BITCODE_BD DIMDLI;
2564   BITCODE_BD DIMEXE;
2565   BITCODE_BD DIMRND;
2566   BITCODE_BD DIMDLE;
2567   BITCODE_BD DIMTP;
2568   BITCODE_BD DIMTM;
2569   BITCODE_BD DIMFXL;
2570   BITCODE_BD DIMJOGANG;
2571   BITCODE_BS DIMTFILL;
2572   BITCODE_CMC DIMTFILLCLR;
2573   BITCODE_BS DIMAZIN;
2574   BITCODE_BS DIMARCSYM;
2575   BITCODE_BD DIMTXT;
2576   BITCODE_BD DIMCEN;
2577   BITCODE_BD DIMTSZ;
2578   BITCODE_BD DIMALTF;
2579   BITCODE_BD DIMLFAC;
2580   BITCODE_BD DIMTVP;
2581   BITCODE_BD DIMTFAC;
2582   BITCODE_BD DIMGAP;
2583   BITCODE_T DIMPOST;
2584   BITCODE_T DIMAPOST;
2585   BITCODE_T DIMBLK_T;
2586   BITCODE_T DIMBLK1_T;
2587   BITCODE_T DIMBLK2_T;
2588   BITCODE_BD DIMALTRND;
2589   BITCODE_RS DIMCLRD_N; /* preR13 */
2590   BITCODE_RS DIMCLRE_N; /* preR13 */
2591   BITCODE_RS DIMCLRT_N; /* preR13 */
2592   BITCODE_CMC DIMCLRD;
2593   BITCODE_CMC DIMCLRE;
2594   BITCODE_CMC DIMCLRT;
2595   BITCODE_BS DIMADEC;
2596   BITCODE_BS DIMFRAC;
2597   BITCODE_BS DIMLUNIT;
2598   BITCODE_BS DIMDSEP;
2599   BITCODE_BS DIMTMOVE;
2600   BITCODE_BS DIMALTZ;
2601   BITCODE_BS DIMALTTZ;
2602   BITCODE_BS DIMATFIT;
2603   BITCODE_B DIMFXLON;   /*!< r2007+ */
2604   BITCODE_B  DIMTXTDIRECTION; /*!< r2010+ */
2605   BITCODE_BD DIMALTMZF; /*!< r2010+ */
2606   BITCODE_T  DIMALTMZS; /*!< r2010+ */
2607   BITCODE_BD DIMMZF;    /*!< r2010+ */
2608   BITCODE_T  DIMMZS;    /*!< r2010+ */
2609   BITCODE_BSd DIMLWD;
2610   BITCODE_BSd DIMLWE;
2611   BITCODE_B flag0;
2612 
2613   BITCODE_H DIMTXSTY;
2614 
2615   BITCODE_H DIMLDRBLK;
2616   BITCODE_H DIMBLK;
2617   BITCODE_H DIMBLK1;
2618   BITCODE_H DIMBLK2;
2619 
2620   BITCODE_H DIMLTYPE;
2621   BITCODE_H DIMLTEX1;
2622   BITCODE_H DIMLTEX2;
2623 } Dwg_Object_DIMSTYLE;
2624 
2625 /**
2626  VX_CONTROL (70) table object (r11-r2000)
2627  The table header for all viewport entities (unused in newer versions)
2628  Called VXTable
2629  */
2630 typedef struct _dwg_object_VX_CONTROL
2631 {
2632   COMMON_TABLE_CONTROL_FIELDS;
2633 } Dwg_Object_VX_CONTROL;
2634 
2635 /**
2636  VX_TABLE_RECORD (71) table object (r11-r2000)
2637  Called VXTableRecord / VX_TABLE_RECORD
2638  */
2639 typedef struct _dwg_object_VX_TABLE_RECORD
2640 {
2641   COMMON_TABLE_FIELDS(RC);
2642   BITCODE_B is_on;
2643   BITCODE_H viewport;
2644   BITCODE_H prev_entry;
2645 } Dwg_Object_VX_TABLE_RECORD;
2646 
2647 /**
2648  GROUP (72) object
2649  */
2650 typedef struct _dwg_object_GROUP
2651 {
2652   struct _dwg_object_object *parent;
2653   BITCODE_TV name;
2654   BITCODE_BS unnamed;
2655   BITCODE_BS selectable;
2656   BITCODE_BL num_groups;
2657   BITCODE_H* groups;
2658 } Dwg_Object_GROUP;
2659 
2660 /**
2661  MLINESTYLE (73) object
2662  */
2663 typedef struct _dwg_MLINESTYLE_line
2664 {
2665   struct _dwg_object_MLINESTYLE *parent;
2666   BITCODE_BD  offset;
2667   BITCODE_CMC color;
2668   BITCODE_BSd lt_index;   /* until 2018 */
2669   BITCODE_H   lt_ltype;   /* since 2018 */
2670 } Dwg_MLINESTYLE_line;
2671 
2672 typedef struct _dwg_object_MLINESTYLE
2673 {
2674   struct _dwg_object_object *parent;
2675   BITCODE_TV name;
2676   BITCODE_TV description;
2677   BITCODE_BS flag;
2678   BITCODE_CMC fill_color;
2679   BITCODE_BD start_angle;
2680   BITCODE_BD end_angle;
2681   BITCODE_RC num_lines;
2682   Dwg_MLINESTYLE_line* lines;
2683 } Dwg_Object_MLINESTYLE;
2684 
2685 /**
2686  OLE2FRAME (74 + varies) object
2687  */
2688 typedef struct _dwg_entity_OLE2FRAME
2689 {
2690   struct _dwg_object_entity *parent;
2691 
2692   BITCODE_BS type;         /*!< DXF 71, 1: Link, 2: Embedded, 3: Static */
2693   BITCODE_BS mode;         /*!< r2000+ DXF 72, tile_mode, 0: mspace, 1: pspace */
2694   BITCODE_RC lock_aspect;  /*!< r2000+ DXF 73, 0 or 1 (locked) */
2695   BITCODE_BL data_size;    /*!< DXF 90 */
2696   BITCODE_TF data;         /*!< DXF 310, the binary object data */
2697   // embedded into data, not yet decoded:
2698   // the MS-CFB (ole2 stream) starts at 0x80 in data
2699   // before is probably:
2700   BITCODE_BS oleversion;   /*!< DXF 70, always 2 */
2701   BITCODE_TF oleclient;    /*!< DXF 3, e.g. OLE or Paintbrush Picture */
2702   BITCODE_3BD pt1;         /*!< DXF 10, upper left corner */
2703   BITCODE_3BD pt2;         /*!< DXF 11, lower right corner */
2704 } Dwg_Entity_OLE2FRAME;
2705 
2706 /**
2707  DUMMY (75) object, placeholder for unsupported types on encode.
2708  */
2709 typedef struct _dwg_object_DUMMY
2710 {
2711   struct _dwg_object_object *parent;
2712 } Dwg_Object_DUMMY;
2713 
2714 /**
2715  LONG_TRANSACTION (76) object
2716  */
2717 typedef struct _dwg_object_LONG_TRANSACTION
2718 {
2719   struct _dwg_object_object *parent;
2720   /* ??? not seen */
2721 } Dwg_Object_LONG_TRANSACTION;
2722 
2723 /* NOT SURE ABOUT THIS ONE (IS IT OBJECT OR ENTITY?): */
2724 /**
2725  subtype PROXY_LWPOLYLINE (33) in a PROXY object
2726  Not a LWPOLYLINE (77? + varies)
2727  */
2728 typedef struct _dwg_LWPOLYLINE_width
2729 {
2730   BITCODE_BD start; /* 40 */
2731   BITCODE_BD end;   /* 41 */
2732 } Dwg_LWPOLYLINE_width;
2733 
2734 typedef struct _dwg_PROXY_LWPOLYLINE
2735 {
2736   struct _dwg_entity_PROXY_ENTITY *parent;
2737 
2738   BITCODE_RL size; /* from flags to *widths */
2739   BITCODE_BS flags;
2740   BITCODE_BD const_width;
2741   BITCODE_BD elevation;
2742   BITCODE_BD thickness;
2743   BITCODE_BE extrusion;
2744   BITCODE_BL num_points;
2745   BITCODE_2RD* points;
2746   BITCODE_BL num_bulges;
2747   BITCODE_BD* bulges;
2748   BITCODE_BL num_widths;
2749   Dwg_LWPOLYLINE_width* widths;
2750   BITCODE_RC unknown_1;
2751   BITCODE_RC unknown_2;
2752   BITCODE_RC unknown_3;
2753 } Dwg_PROXY_LWPOLYLINE;
2754 
2755 /**
2756  (ACAD_)PROXY_ENTITY (498, 0x1f2) object
2757  */
2758 typedef struct _dwg_entity_PROXY_ENTITY
2759 {
2760   struct _dwg_object_entity *parent;
2761 
2762   BITCODE_BL class_id;      /*!< DXF 91, always 498, same as obj->type */
2763   BITCODE_BL version;       /*!< DXF 95 <r2018, 71 r2018+ */
2764   BITCODE_BL maint_version; /*!< DXF 97 r2018+ */
2765   BITCODE_B from_dxf;       /*!< DXF 70 */
2766   BITCODE_BL data_numbits;
2767   BITCODE_BL data_size;     /*!< DXF 93 */
2768   BITCODE_RC *data;         /*!< DXF 310 */
2769   BITCODE_BL num_objids;
2770   BITCODE_H* objids;        /*!< DXF 340 */
2771 } Dwg_Entity_PROXY_ENTITY;
2772 
2773 /**
2774  (ACAD_)PROXY OBJECT (499, 0x1f3) object
2775  */
2776 typedef struct _dwg_object_PROXY_OBJECT
2777 {
2778   struct _dwg_object_object *parent;
2779 
2780   BITCODE_BL class_id;      /*!< DXF 91, always 499, same as obj->type */
2781   BITCODE_BL version;       /*!< DXF 95 <r2018, 71 r2018+ */
2782   BITCODE_BL maint_version; /*!< DXF 97 r2018+ */
2783   BITCODE_B from_dxf;       /*!< DXF 70 */
2784   BITCODE_BL data_numbits;
2785   BITCODE_BL data_size;     /*!< DXF 93 */
2786   BITCODE_RC *data;         /*!< DXF 310 */
2787   BITCODE_BL num_objids;
2788   BITCODE_H* objids;        /*!< DXF 340 */
2789 } Dwg_Object_PROXY_OBJECT;
2790 
2791 /**
2792  * types which are fixed and non-fixed:
2793  * also OLE2FRAME above
2794  */
2795 
2796 /**
2797  Structs for HATCH (78 + varies)
2798  */
2799 typedef struct _dwg_HATCH_Color
2800 {
2801   struct _dwg_entity_HATCH *parent;
2802   BITCODE_BD shift_value; //0.0 non-shifted, 1.0 shifted
2803   BITCODE_CMC color;
2804 } Dwg_HATCH_Color;
2805 
2806 typedef struct _dwg_HATCH_ControlPoint
2807 {
2808   struct _dwg_HATCH_PathSeg *parent;
2809   BITCODE_2RD point;
2810   BITCODE_BD weight;
2811 } Dwg_HATCH_ControlPoint;
2812 
2813 typedef struct _dwg_HATCH_PathSeg
2814 {
2815   struct _dwg_HATCH_Path *parent;
2816   BITCODE_RC curve_type; // i.e. curve_type: 1-4
2817   // could be a union
2818   /* LINE */
2819   BITCODE_2RD first_endpoint;
2820   BITCODE_2RD second_endpoint;
2821   /* CIRCULAR ARC */
2822   BITCODE_2RD center;
2823   BITCODE_BD radius;
2824   BITCODE_BD start_angle;
2825   BITCODE_BD end_angle;
2826   BITCODE_B is_ccw;
2827   /* ELLIPTICAL ARC */
2828   /* BITCODE_2RD center */
2829   BITCODE_2RD endpoint;
2830   BITCODE_BD minor_major_ratio;
2831   /* BITCODE_BD start_angle; */
2832   /* BITCODE_BD end_angle; */
2833   /* BITCODE_B is_ccw; */
2834   /* SPLINE */
2835   BITCODE_BL degree;
2836   BITCODE_B is_rational;
2837   BITCODE_B is_periodic;
2838   BITCODE_BL num_knots;
2839   BITCODE_BL num_control_points;
2840   BITCODE_BD* knots;
2841   Dwg_HATCH_ControlPoint* control_points;
2842   BITCODE_BL num_fitpts;
2843   BITCODE_2RD *fitpts;
2844   BITCODE_2RD start_tangent;
2845   BITCODE_2RD end_tangent;
2846 } Dwg_HATCH_PathSeg;
2847 
2848 typedef struct _dwg_HATCH_PolylinePath
2849 {
2850   struct _dwg_HATCH_Path *parent;
2851   BITCODE_2RD point;
2852   BITCODE_BD bulge;
2853 } Dwg_HATCH_PolylinePath;
2854 
2855 typedef struct _dwg_HATCH_Path
2856 {
2857   struct _dwg_entity_HATCH *parent;
2858   /* Segment path */
2859   BITCODE_BL flag; /* 2: is_polyline, 4: is_derived, 8: is_textbox,
2860                       0x20: is_open, 0x80: is_textisland, 0x100: is_duplicate, 0x200: is_annotative */
2861   BITCODE_BL num_segs_or_paths;
2862   Dwg_HATCH_PathSeg* segs;
2863 
2864   /* Polyline path */
2865   BITCODE_B bulges_present;
2866   BITCODE_B closed;
2867   Dwg_HATCH_PolylinePath* polyline_paths;
2868 
2869   // needed?
2870   BITCODE_BL num_boundary_handles;
2871   BITCODE_H* boundary_handles;
2872 } Dwg_HATCH_Path;
2873 
2874 typedef struct _dwg_HATCH_DefLine
2875 {
2876   struct _dwg_entity_HATCH *parent;
2877   BITCODE_BD  angle;
2878   BITCODE_2BD pt0;
2879   BITCODE_2BD offset;
2880   BITCODE_BS  num_dashes;
2881   BITCODE_BD* dashes;
2882 } Dwg_HATCH_DefLine;
2883 
2884 typedef struct _dwg_entity_HATCH
2885 {
2886   struct _dwg_object_entity *parent;
2887 
2888   BITCODE_BL is_gradient_fill;
2889   BITCODE_BL reserved;
2890   BITCODE_BD gradient_angle;
2891   BITCODE_BD gradient_shift;
2892   BITCODE_BL single_color_gradient;
2893   BITCODE_BD gradient_tint;
2894   BITCODE_BL num_colors;
2895   Dwg_HATCH_Color* colors;
2896   BITCODE_T gradient_name; /* 1: SPHERICAL, 2: HEMISPHERICAL, 3: CURVED, 4: LINEAR, 5: CYLINDER */
2897 
2898   BITCODE_BD elevation;
2899   BITCODE_BE extrusion;
2900   BITCODE_TV name;
2901   BITCODE_B is_solid_fill;
2902   BITCODE_B is_associative;
2903   BITCODE_BL num_paths;
2904   Dwg_HATCH_Path* paths; // also named loop
2905   BITCODE_BS style;
2906   BITCODE_BS pattern_type;
2907   BITCODE_BD angle;
2908   BITCODE_BD scale_spacing;
2909   BITCODE_B double_flag;
2910   BITCODE_BS num_deflines;
2911   Dwg_HATCH_DefLine * deflines;
2912   BITCODE_B has_derived;
2913   BITCODE_BD pixel_size;
2914   BITCODE_BL num_seeds;
2915   BITCODE_2RD * seeds;
2916   //BITCODE_BL sum_boundary_handles;
2917   //BITCODE_H* boundary_handles;
2918 } Dwg_Entity_HATCH;
2919 
2920 // derived from Hatch
2921 typedef struct _dwg_entity_MPOLYGON
2922 {
2923   struct _dwg_object_entity *parent;
2924 
2925   BITCODE_BL is_gradient_fill;
2926   BITCODE_BL reserved;
2927   BITCODE_BD gradient_angle;
2928   BITCODE_BD gradient_shift;
2929   BITCODE_BL single_color_gradient;
2930   BITCODE_BD gradient_tint;
2931   BITCODE_BL num_colors;
2932   Dwg_HATCH_Color* colors;
2933   BITCODE_T gradient_name; /* 1: SPHERICAL, 2: HEMISPHERICAL, 3: CURVED, 4: LINEAR, 5: CYLINDER */
2934 
2935   BITCODE_BD elevation;
2936   BITCODE_BE extrusion;
2937   BITCODE_T name;
2938   BITCODE_B is_solid_fill;
2939   BITCODE_B is_associative;
2940   BITCODE_BL num_paths;
2941   Dwg_HATCH_Path* paths; // also named loop
2942   BITCODE_BS style;
2943   BITCODE_BS pattern_type;
2944   BITCODE_BD angle;
2945   BITCODE_BD scale_spacing;
2946   BITCODE_B double_flag;
2947   BITCODE_BS num_deflines;
2948   Dwg_HATCH_DefLine * deflines;
2949 
2950   BITCODE_CMC color;  /* DXF 62 */
2951   BITCODE_2RD x_dir;  /* DXF 11 (ocs) */
2952   BITCODE_BL num_boundary_handles; /* DXF 99 */
2953   //BITCODE_H* boundary_handles;
2954 
2955 } Dwg_Entity_MPOLYGON;
2956 
2957 /**
2958  XRECORD (79 + varies) object
2959  */
2960 typedef struct _dwg_object_XRECORD
2961 {
2962   struct _dwg_object_object *parent;
2963 
2964   BITCODE_BS cloning; /* DXF 280, as with DICTIONARY.
2965                          DuplicateRecordCloning mergeStyle:
2966                          1: erase allowed,
2967                          0x80: cloning allowed */
2968   BITCODE_BL xdata_size;
2969   BITCODE_BL num_xdata; /* computed */
2970   Dwg_Resbuf* xdata;
2971   BITCODE_BL num_objid_handles;
2972   BITCODE_H* objid_handles;
2973 } Dwg_Object_XRECORD;
2974 
2975 /**
2976  PLACEHOLDER (80 + varies) object
2977  ACDBPLACEHOLDER
2978  */
2979 typedef struct _dwg_object_PLACEHOLDER
2980 {
2981   struct _dwg_object_object *parent;
2982 } Dwg_Object_PLACEHOLDER;
2983 
2984 /**
2985  * Entity MULTILEADER (varies)
2986  * R2000+ in work
2987  */
2988 
2989 typedef struct _dwg_LEADER_Break
2990 {
2991   struct _dwg_LEADER_Line *parent;
2992   BITCODE_3BD start;         /*!< DXF 12 */
2993   BITCODE_3BD end;           /*!< DXF 13 */
2994 } Dwg_LEADER_Break;
2995 
2996 typedef struct _dwg_LEADER_Line // as documented by DXF
2997 {
2998   struct _dwg_LEADER_Node *parent;
2999   BITCODE_BL num_points;
3000   BITCODE_3DPOINT* points;         /*!< DXF 10 */
3001   BITCODE_BL num_breaks;
3002   Dwg_LEADER_Break * breaks;       /*!< DXF 12, 13 */
3003   BITCODE_BL  line_index;          /*!< DXF 91 */
3004 
3005   /*!< r2010+: */
3006   BITCODE_BS type; // 0 = invisible leader, 1 = straight leader, 2 = spline leader
3007   BITCODE_CMC color; // of the line
3008   BITCODE_H ltype; // 5 340
3009   BITCODE_BLd linewt;
3010   BITCODE_BD arrow_size;
3011   BITCODE_H  arrow_handle; // 5 341
3012   BITCODE_BL flags; // 1 = leader type, 2 = line color, 4 = line type, 8 = line weight,
3013                     // 16 = arrow size, 32 = arrow symbol (handle)
3014 } Dwg_LEADER_Line;
3015 
3016 typedef struct _dwg_LEADER_ArrowHead
3017 {
3018   struct _dwg_entity_MULTILEADER *parent;
3019   BITCODE_B is_default;
3020   BITCODE_H arrowhead;
3021 } Dwg_LEADER_ArrowHead;
3022 
3023 typedef struct _dwg_LEADER_BlockLabel
3024 {
3025   struct _dwg_entity_MULTILEADER *parent;
3026   BITCODE_H attdef;
3027   BITCODE_TV label_text;
3028   BITCODE_BS ui_index;
3029   BITCODE_BD width;
3030 } Dwg_LEADER_BlockLabel;
3031 
3032 typedef struct _dwg_LEADER_Node
3033 {
3034   struct _dwg_entity_MULTILEADER *parent;
3035   BITCODE_B has_lastleaderlinepoint;    /*!< DXF 290 */
3036   BITCODE_B has_dogleg;                 /*!< DXF 291 */
3037   BITCODE_3BD lastleaderlinepoint;      /*!< DXF 10 */
3038   BITCODE_3BD dogleg_vector;            /*!< DXF 11 */
3039   BITCODE_BL branch_index;              /*!< DXF 90 */
3040   BITCODE_BD dogleg_length;             /*!< DXF 40 */
3041   BITCODE_BL num_lines;
3042   Dwg_LEADER_Line *lines;               /*!< DXF 10 */
3043   BITCODE_BL num_breaks;
3044   Dwg_LEADER_Break * breaks;            /*!< DXF 12, 13 */
3045 
3046   BITCODE_BS attach_dir; //2010+ 271
3047 } Dwg_LEADER_Node;
3048 
3049 // common to text and block
3050 #define CMLContent_fields                                                     \
3051   BITCODE_RC type; /* 1 for blk, 2 for text */                                \
3052   BITCODE_3BD normal;                                                         \
3053   BITCODE_3BD location;                                                       \
3054   BITCODE_BD rotation
3055 
3056 typedef struct _dwg_MLEADER_Content_MText
3057 {
3058   CMLContent_fields;
3059   BITCODE_T default_text;
3060   BITCODE_H style;
3061   BITCODE_3BD direction;
3062   BITCODE_BD width;
3063   BITCODE_BD height;
3064   BITCODE_BD line_spacing_factor;
3065   BITCODE_BS line_spacing_style;
3066   BITCODE_CMC color;
3067   BITCODE_BS alignment;
3068   BITCODE_BS flow;
3069   BITCODE_CMC bg_color;
3070   BITCODE_BD bg_scale;
3071   BITCODE_BL bg_transparency;
3072   BITCODE_B is_bg_fill;
3073   BITCODE_B is_bg_mask_fill;
3074   BITCODE_BS col_type;
3075   BITCODE_B is_height_auto;
3076   BITCODE_BD col_width;
3077   BITCODE_BD col_gutter;
3078   BITCODE_B is_col_flow_reversed;
3079   BITCODE_BL num_col_sizes;
3080   BITCODE_BD *col_sizes;
3081   BITCODE_B word_break;
3082   BITCODE_B unknown;
3083 } Dwg_MLEADER_Content_MText;
3084 
3085 typedef struct _dwg_MLEADER_Content_Block
3086 {
3087   CMLContent_fields;
3088   BITCODE_H block_table;
3089   BITCODE_3BD scale;
3090   BITCODE_CMC color;
3091   BITCODE_BD *transform;
3092 } Dwg_MLEADER_Content_Block;
3093 
3094 typedef union _dwg_MLEADER_Content
3095 {
3096   Dwg_MLEADER_Content_MText txt;
3097   Dwg_MLEADER_Content_Block blk;
3098 } Dwg_MLEADER_Content;
3099 
3100 /* The MLeaderAnnotContext object (par 20.4.86), embedded into an MLEADER */
3101 typedef struct _dwg_MLEADER_AnnotContext
3102 {
3103   // AcDbObjectContextData:
3104   // BITCODE_BS class_version;  /*!< r2010+ DXF 70 4 */
3105   // BITCODE_B is_default;      /*!< r2010+ DXF 290 1 */
3106   // BITCODE_B has_xdic;        /*!< r2010+  */
3107   // AcDbAnnotScaleObjectContextData:
3108   // BITCODE_H scale;           /*!< DXF 340 hard ptr to AcDbScale */
3109 
3110   BITCODE_BL num_leaders;
3111   Dwg_LEADER_Node *leaders;
3112 
3113   BITCODE_BS attach_dir;
3114 
3115   BITCODE_BD scale_factor;
3116   BITCODE_3BD content_base;
3117   BITCODE_BD text_height;
3118   BITCODE_BD arrow_size;
3119   BITCODE_BD landing_gap;
3120   BITCODE_BS text_left;
3121   BITCODE_BS text_right;
3122   BITCODE_BS text_angletype;
3123   BITCODE_BS text_alignment;
3124 
3125   BITCODE_B has_content_txt;
3126   BITCODE_B has_content_blk;
3127   Dwg_MLEADER_Content content; // union txt/blk
3128 
3129   BITCODE_3BD base;
3130   BITCODE_3BD base_dir;
3131   BITCODE_3BD base_vert;
3132   BITCODE_B is_normal_reversed;
3133 
3134   BITCODE_BS text_top;
3135   BITCODE_BS text_bottom;
3136 
3137 } Dwg_MLEADER_AnnotContext;
3138 
3139 // dbmleader.h
3140 typedef struct _dwg_entity_MULTILEADER
3141 {
3142   struct _dwg_object_entity *parent;
3143 
3144   BITCODE_BS class_version; /*!< r2010+ =2 */
3145   Dwg_MLEADER_AnnotContext ctx;
3146   BITCODE_H mleaderstyle; /* DXF  340 */
3147   BITCODE_BL flags;       /* override. DXF 90 */
3148   BITCODE_BS type;
3149   BITCODE_CMC color;
3150   BITCODE_H ltype;
3151   BITCODE_BLd linewt;
3152   BITCODE_B has_landing;
3153   BITCODE_B has_dogleg;
3154   BITCODE_BD landing_dist;
3155   BITCODE_H arrow_handle;
3156   BITCODE_BD arrow_size; /* the default */
3157   BITCODE_BS style_content;
3158   BITCODE_H text_style;
3159   BITCODE_BS text_left;
3160   BITCODE_BS text_right;
3161   BITCODE_BS text_angletype;
3162   BITCODE_BS text_alignment;
3163   BITCODE_CMC text_color;
3164   BITCODE_B has_text_frame;
3165   BITCODE_H block_style; // internal blocks mostly, _TagSlot, _TagHexagon,
3166                          // _DetailCallout, ...
3167   BITCODE_CMC block_color;
3168   BITCODE_3BD block_scale;
3169   BITCODE_BD block_rotation;
3170   BITCODE_BS style_attachment; // 0 = center extents, 1 = insertion point
3171   BITCODE_B is_annotative;
3172 
3173   /* until r2007: */
3174   BITCODE_BL num_arrowheads;
3175   Dwg_LEADER_ArrowHead *arrowheads;
3176   BITCODE_BL num_blocklabels;
3177   Dwg_LEADER_BlockLabel *blocklabels;
3178   BITCODE_B is_neg_textdir;
3179   BITCODE_BS ipe_alignment;
3180   BITCODE_BS justification;
3181   BITCODE_BD scale_factor;
3182 
3183   BITCODE_BS attach_dir;    /*!< r2010+ (0 = horizontal, 1 = vertical) */
3184   BITCODE_BS attach_top;    /*!< r2010+ */
3185   BITCODE_BS attach_bottom; /*!< r2010+ */
3186 
3187   BITCODE_B is_text_extended; /*!< r2013+ */
3188 } Dwg_Entity_MULTILEADER;
3189 
3190 /**
3191  * Object MLEADERSTYLE (varies)
3192  * R2000+
3193  */
3194 typedef struct _dwg_object_MLEADERSTYLE
3195 {
3196   struct _dwg_object_object *parent;
3197 
3198   BITCODE_BS class_version; /*!< DXF 179, r2010+ =2 */
3199   BITCODE_BS content_type;
3200   BITCODE_BS mleader_order;
3201   BITCODE_BS leader_order;
3202   BITCODE_BL max_points;
3203   BITCODE_BD first_seg_angle;
3204   BITCODE_BD second_seg_angle;
3205   BITCODE_BS type;
3206   BITCODE_CMC line_color;
3207   BITCODE_H line_type;
3208   BITCODE_BLd linewt;
3209   BITCODE_B has_landing;
3210   BITCODE_B has_dogleg;
3211   BITCODE_BD landing_gap;
3212   BITCODE_BD landing_dist;
3213   BITCODE_TV description;
3214   BITCODE_H arrow_head;
3215   BITCODE_BD arrow_head_size;
3216   BITCODE_TV text_default;
3217   BITCODE_H text_style;
3218   BITCODE_BS attach_left;
3219   BITCODE_BS attach_right;
3220   BITCODE_BS text_angle_type;
3221   BITCODE_BS text_align_type;
3222   BITCODE_CMC text_color;
3223   BITCODE_BD text_height;
3224   BITCODE_B has_text_frame;
3225   BITCODE_B text_always_left;
3226   BITCODE_BD align_space;
3227   BITCODE_H block;
3228   BITCODE_CMC block_color;
3229   BITCODE_3BD block_scale;
3230   BITCODE_B use_block_scale;
3231   BITCODE_BD block_rotation;
3232   BITCODE_B use_block_rotation;
3233   BITCODE_BS block_connection;
3234   BITCODE_BD scale;
3235   BITCODE_B is_changed;
3236   BITCODE_B is_annotative;
3237   BITCODE_BD break_size;
3238 
3239   BITCODE_BS attach_dir;    /*!< r2010+ (0 = horizontal, 1 = vertical) */
3240   BITCODE_BS attach_top;    /*!< r2010+ */
3241   BITCODE_BS attach_bottom; /*!< r2010+ */
3242 
3243   BITCODE_B text_extended; /*!< r2013+ */
3244 } Dwg_Object_MLEADERSTYLE;
3245 
3246 /**
3247  VBA_PROJECT (81 + varies) object
3248  Has its own optional section? section[5]?
3249  */
3250 typedef struct _dwg_object_VBA_PROJECT
3251 {
3252   struct _dwg_object_object *parent;
3253 
3254   BITCODE_BL data_size;
3255   BITCODE_TF data;
3256 } Dwg_Object_VBA_PROJECT;
3257 
3258 /**
3259  Object PLOTSETTINGS (varies)
3260  See also LAYOUT.
3261  */
3262 typedef struct _dwg_object_PLOTSETTINGS
3263 {
3264   struct _dwg_object_object *parent;
3265 
3266   BITCODE_T printer_cfg_file;     /*!< DXF 1 */
3267   BITCODE_T paper_size;           /*!< DXF 2 */
3268   BITCODE_T canonical_media_name; /*!< DXF 4 */
3269   BITCODE_BS plot_flags;          /*!< DXF 70
3270                                  1 = PlotViewportBorders
3271                                  2 = ShowPlotStyles
3272                                  4 = PlotCentered
3273                                  8 = PlotHidden
3274                                  16 = UseStandardScale
3275                                  32 = PlotPlotStyles
3276                                  64 = ScaleLineweights
3277                                  128 = PrintLineweights
3278                                  512 = DrawViewportsFirst
3279                                  1024 = ModelType
3280                                  2048 = UpdatePaper
3281                                  4096 = ZoomToPaperOnUpdate
3282                                  8192 = Initializing
3283                                  16384 = PrevPlotInit */
3284   BITCODE_H plotview;             /*!< DXF 6, r2004+ */
3285   BITCODE_T plotview_name;        /*!< DXF 6, until r2000 */
3286   BITCODE_BD left_margin;         /*!< DXF 40, margins in mm */
3287   BITCODE_BD bottom_margin;       /*!< DXF 42 */
3288   BITCODE_BD right_margin;        /*!< DXF 43 */
3289   BITCODE_BD top_margin;          /*!< DXF 44 */
3290   BITCODE_BD paper_width;         /*!< DXF 44, in mm */
3291   BITCODE_BD paper_height;        /*!< DXF 45, in mm */
3292   BITCODE_2BD_1 plot_origin;      /*!< DXF 46,47 */
3293   BITCODE_2BD_1 plot_window_ll;   /*!< DXF 48,49 */
3294   BITCODE_2BD_1 plot_window_ur;   /*!< DXF 140,141 */
3295   BITCODE_BS plot_paper_unit;     /*!< DXF 72,  0 inches, 1 mm, 2 pixel */
3296   BITCODE_BS
3297       plot_rotation_mode; /*!< DXF 73,  0 normal, 1 90, 2 180, 3 270 deg */
3298   BITCODE_BS plot_type; /*!< DXF 74,  0 display, 1 extents, 2 limits, 3 view
3299                            (see DXF 6), 4 window (see 48-140), 5 layout */
3300   BITCODE_BD paper_units;   /*!< DXF 142 */
3301   BITCODE_BD drawing_units; /*!< DXF 143 */
3302   BITCODE_T stylesheet;     /*!< DXF 7 */
3303   BITCODE_BS
3304       std_scale_type;               /*!< DXF 75, 0 = scaled to fit,
3305                                       1 = 1/128"=1', 2 = 1/64"=1', 3 = 1/32"=1'
3306                                       4 = 1/16"=1', 5 = 3/32"=1', 6 = 1/8"=1'
3307                                       7 = 3/16"=1', 8 = 1/4"=1', 9 = 3/8"=1'
3308                                       10 = 1/2"=1', 11 = 3/4"=1', 12 = 1"=1'
3309                                       13 = 3"=1', 14 = 6"=1', 15 = 1'=1'
3310                                       16 = 1:1, 17= 1:2, 18 = 1:4 19 = 1:8, 20 = 1:10, 21=
3311                                       1:16               22 = 1:20, 23 = 1:30, 24 = 1:40, 25 = 1:50, 26 =
3312                                       1:100               27 = 2:1, 28 = 4:1, 29 = 8:1, 30 = 10:1, 31 =
3313                                       100:1, 32 = 1000:1
3314                                     */
3315   BITCODE_BD std_scale_factor;      /*!< DXF 147, value of 75 */
3316   BITCODE_2BD_1 paper_image_origin; /*!< DXF 148 + 149 */
3317   BITCODE_BS shadeplot_type; /*!< DXF 76, 0 display, 1 wireframe, 2 hidden, 3
3318                                 rendered, 4 visualstyle, 5 renderPreset */
3319   BITCODE_BS
3320       shadeplot_reslevel;         /*!< DXF 77, 0 draft, 1 preview, 2 nomal,
3321                                                3 presentation, 4 maximum, 5 custom */
3322   BITCODE_BS shadeplot_customdpi; /*!< DXF 78, 100-32767 */
3323   BITCODE_H shadeplot;            /*!< DXF 333 optional. As in VIEWPORT */
3324 } Dwg_Object_PLOTSETTINGS;
3325 
3326 /**
3327  LAYOUT (82 + varies) object
3328  */
3329 typedef struct _dwg_object_LAYOUT
3330 {
3331   struct _dwg_object_object *parent;
3332   // AcDbPlotSettings:
3333   Dwg_Object_PLOTSETTINGS plotsettings;
3334 
3335   // AcDbLayout:
3336   BITCODE_T layout_name;
3337   BITCODE_BS tab_order;
3338   BITCODE_BS layout_flags; /* 1: PSLTSCALE, 2: LIMCHECK */
3339   BITCODE_3DPOINT INSBASE;
3340   BITCODE_2DPOINT LIMMIN;
3341   BITCODE_2DPOINT LIMMAX;
3342   BITCODE_3DPOINT UCSORG;
3343   BITCODE_3DPOINT UCSXDIR;
3344   BITCODE_3DPOINT UCSYDIR;
3345   BITCODE_BD ucs_elevation;
3346   BITCODE_BS UCSORTHOVIEW;
3347   BITCODE_3DPOINT EXTMIN;
3348   BITCODE_3DPOINT EXTMAX;
3349   BITCODE_H block_header;
3350   BITCODE_H active_viewport;
3351   BITCODE_H base_ucs;
3352   BITCODE_H named_ucs;
3353   BITCODE_BL num_viewports; // r2004+
3354   BITCODE_H *viewports;     // r2004+
3355 } Dwg_Object_LAYOUT;
3356 
3357 /**
3358  * And the non-fixed types, classes, only
3359  */
3360 
3361 /**
3362  Class DICTIONARYVAR (varies)
3363  */
3364 typedef struct _dwg_object_DICTIONARYVAR
3365 {
3366   struct _dwg_object_object *parent;
3367 
3368   BITCODE_RC schema;
3369   BITCODE_T  strvalue;
3370 } Dwg_Object_DICTIONARYVAR;
3371 
3372 /**
3373  Class TABLE (varies)
3374  */
3375 
3376 // 20.4.99. also for FIELD
3377 typedef struct _dwg_TABLE_value
3378 {
3379   BITCODE_BL flags;        /* DXF 90 */
3380   BITCODE_BL format_flags; /* DXF 93, r2007+ */
3381   BITCODE_BL data_type;
3382   BITCODE_BL data_size;
3383   BITCODE_BL data_long;
3384   BITCODE_BD data_double;
3385   BITCODE_T data_string;
3386   BITCODE_TF data_date;
3387   BITCODE_2RD data_point;
3388   BITCODE_3RD data_3dpoint;
3389   BITCODE_H data_handle;
3390   BITCODE_BL unit_type;
3391   BITCODE_T format_string;
3392   BITCODE_T value_string;
3393 } Dwg_TABLE_value;
3394 
3395 // 20.4.100 Custom data collection for table cells, cols, rows
3396 typedef struct _dwg_TABLE_CustomDataItem
3397 {
3398   BITCODE_T name;
3399   Dwg_TABLE_value value;
3400 
3401   struct _dwg_TableCell *cell_parent;
3402   struct _dwg_TableRow *row_parent;
3403 } Dwg_TABLE_CustomDataItem;
3404 
3405 typedef struct _dwg_TABLE_AttrDef
3406 {
3407   struct _dwg_TABLE_Cell *parent;
3408   BITCODE_H attdef;
3409   BITCODE_BS index;
3410   BITCODE_T text;
3411 } Dwg_TABLE_AttrDef;
3412 
3413 typedef struct _dwg_TABLE_Cell
3414 {
3415   struct _dwg_entity_TABLE *parent;
3416   BITCODE_BS type;
3417   BITCODE_RC flags;
3418   BITCODE_B is_merged_value;
3419   BITCODE_B is_autofit_flag;
3420   BITCODE_BL merged_width_flag;
3421   BITCODE_BL merged_height_flag;
3422   BITCODE_BD rotation;
3423   BITCODE_T text_value;
3424   BITCODE_H text_style;
3425   BITCODE_H block_handle;
3426   BITCODE_BD block_scale;
3427   BITCODE_B additional_data_flag;
3428   BITCODE_BL cell_flag_override;
3429   BITCODE_RC virtual_edge_flag;
3430   BITCODE_RS cell_alignment;
3431   BITCODE_B bg_fill_none;
3432   BITCODE_CMC bg_color;
3433   BITCODE_CMC content_color;
3434   BITCODE_BD text_height;
3435   BITCODE_CMC top_grid_color;
3436   BITCODE_BS top_grid_linewt;
3437   BITCODE_BS top_visibility;
3438   BITCODE_CMC right_grid_color;
3439   BITCODE_BS right_grid_linewt;
3440   BITCODE_BS right_visibility;
3441   BITCODE_CMC bottom_grid_color;
3442   BITCODE_BS bottom_grid_linewt;
3443   BITCODE_BS bottom_visibility;
3444   BITCODE_CMC left_grid_color;
3445   BITCODE_BS left_grid_linewt;
3446   BITCODE_BS left_visibility;
3447   BITCODE_BL unknown;
3448   Dwg_TABLE_value value;
3449   BITCODE_BL num_attr_defs;
3450   Dwg_TABLE_AttrDef *attr_defs;
3451   // BITCODE_H text_style_override;
3452 } Dwg_TABLE_Cell;
3453 
3454 typedef struct _dwg_TABLE_BreakHeight
3455 {
3456   struct _dwg_entity_TABLE *parent;
3457   BITCODE_3BD position;
3458   BITCODE_BD height;
3459   BITCODE_BL flag;
3460 } Dwg_TABLE_BreakHeight;
3461 
3462 typedef struct _dwg_TABLE_BreakRow
3463 {
3464   struct _dwg_entity_TABLE *parent;
3465   BITCODE_3BD position;
3466   BITCODE_BL start;
3467   BITCODE_BL end;
3468 } Dwg_TABLE_BreakRow;
3469 
3470 typedef struct _dwg_LinkedData
3471 {
3472   BITCODE_T name;        // max 16, dxf 1
3473   BITCODE_T description; // max 24, dxf 300
3474 } Dwg_LinkedData;
3475 
3476 typedef struct _dwg_TableCellContent_Attr
3477 {
3478   struct _dwg_TableCellContent *parent;
3479   BITCODE_H attdef;
3480   BITCODE_TV value;
3481   BITCODE_BL index;
3482 } Dwg_TableCellContent_Attr;
3483 
3484 // Content format 20.4.101.3
3485 typedef struct _dwg_ContentFormat
3486 {
3487   BITCODE_BL property_override_flags;
3488   BITCODE_BL property_flags;
3489   BITCODE_BL value_data_type; /* see 20.4.98 */
3490   BITCODE_BL value_unit_type; /* see 20.4.98 */
3491   BITCODE_TV value_format_string;
3492   BITCODE_BD rotation;
3493   BITCODE_BD block_scale;
3494   BITCODE_BL cell_alignment;
3495   BITCODE_CMC content_color;
3496   BITCODE_H text_style;
3497   BITCODE_BD text_height;
3498 } Dwg_ContentFormat;
3499 
3500 typedef struct _dwg_TableCellContent
3501 {
3502   struct _dwg_TableCell *parent;
3503   BITCODE_BL type;
3504   Dwg_TABLE_value value; // 20.4.99 Value
3505   BITCODE_H handle;
3506   BITCODE_BL num_attrs;
3507   Dwg_TableCellContent_Attr *attrs;
3508   BITCODE_BS has_content_format_overrides;
3509   Dwg_ContentFormat content_format;
3510 } Dwg_TableCellContent;
3511 
3512 // 20.4.98
3513 typedef struct _dwg_CellContentGeometry
3514 {
3515   BITCODE_3BD dist_top_left;
3516   BITCODE_3BD dist_center;
3517   BITCODE_BD content_width;
3518   BITCODE_BD content_height;
3519   BITCODE_BD width;
3520   BITCODE_BD height;
3521   BITCODE_BL unknown; /* ODA bug, BD there. DXF 95 */
3522 
3523   struct _dwg_TableCell *cell_parent;
3524   struct _dwg_TABLEGEOMETRY_Cell *geom_parent;
3525 } Dwg_CellContentGeometry;
3526 
3527 typedef struct _dwg_TableCell
3528 {
3529   BITCODE_BL flag;
3530   BITCODE_TV tooltip;
3531   BITCODE_BL customdata;
3532   BITCODE_BL num_customdata_items;
3533   Dwg_TABLE_CustomDataItem *customdata_items;
3534   BITCODE_BL has_linked_data;
3535   BITCODE_H data_link;
3536   BITCODE_BL num_rows;
3537   BITCODE_BL num_cols;
3538   BITCODE_BL unknown;
3539   BITCODE_BL num_cell_contents;
3540   Dwg_TableCellContent *cell_contents;
3541   BITCODE_BL style_id;
3542   BITCODE_BL has_geom_data;
3543   BITCODE_BL geom_data_flag;
3544   BITCODE_BD width_w_gap;
3545   BITCODE_BD height_w_gap;
3546   BITCODE_H tablegeometry;
3547   BITCODE_BL num_geometry;
3548   Dwg_CellContentGeometry *geometry;
3549 
3550   struct _dwg_CellStyle *style_parent;
3551   struct _dwg_TableRow *row_parent;
3552 } Dwg_TableCell;
3553 
3554 // almost like GridLine/TABLESTYLE_border
3555 // in ODA named OdTableGridLine, was BorderStyle
3556 typedef struct _dwg_GridFormat
3557 {
3558   struct _dwg_CellStyle *parent;
3559   BITCODE_BL index_mask; /* 95. ie: 1,2,4,8,16,32 */
3560   BITCODE_BL border_overrides;
3561   BITCODE_BL border_type;
3562   BITCODE_CMC color;
3563   BITCODE_BLd linewt;
3564   BITCODE_H ltype;
3565   BITCODE_B visible;
3566   BITCODE_BD double_line_spacing;
3567 } Dwg_GridFormat;
3568 
3569 /**
3570   Cell style 20.4.101.4
3571   for TABLE, TABLECONTENT, CELLSTYLEMAP
3572 */
3573 typedef struct _dwg_CellStyle
3574 {
3575   BITCODE_BL type; /* 1 cell, 2 row, 3 col, 4 fmt data, 5 table */
3576   BITCODE_BS data_flags;
3577   BITCODE_BL property_override_flags;
3578   BITCODE_BL merge_flags;
3579   BITCODE_CMC bg_color;
3580   BITCODE_BL content_layout;
3581   Dwg_ContentFormat content_format;
3582   BITCODE_BS margin_override_flags;
3583   BITCODE_BD vert_margin;
3584   BITCODE_BD horiz_margin;
3585   BITCODE_BD bottom_margin;
3586   BITCODE_BD right_margin;
3587   BITCODE_BD margin_horiz_spacing;
3588   BITCODE_BD margin_vert_spacing;
3589   BITCODE_BL num_borders; /* 0-6, number of edge_flags set */
3590   Dwg_GridFormat *borders;
3591 
3592   struct _dwg_TableRow *tablerow_parent;
3593   struct _dwg_TableDataColumn *tabledatacolumn_parent;
3594 } Dwg_CellStyle;
3595 
3596 typedef struct _dwg_TableRow
3597 {
3598   struct _dwg_LinkedTableData *parent;
3599   BITCODE_BL num_cells;
3600   Dwg_TableCell *cells;
3601   BITCODE_BL custom_data;
3602   BITCODE_BL num_customdata_items;
3603   Dwg_TABLE_CustomDataItem *customdata_items;
3604   Dwg_CellStyle cellstyle;
3605   BITCODE_BL style_id;
3606   BITCODE_BL height;
3607 } Dwg_TableRow;
3608 
3609 typedef struct _dwg_TableDataColumn
3610 {
3611   struct _dwg_LinkedTableData *parent;
3612   BITCODE_T name;
3613   BITCODE_BL custom_data;
3614   // BITCODE_TV data;
3615   Dwg_CellStyle cellstyle;
3616   BITCODE_BL cellstyle_id;
3617   BITCODE_BL width;
3618 } Dwg_TableDataColumn;
3619 
3620 typedef struct _dwg_LinkedTableData
3621 {
3622   BITCODE_BL num_cols;
3623   Dwg_TableDataColumn *cols;
3624   BITCODE_BL num_rows;
3625   Dwg_TableRow *rows;
3626   BITCODE_BL num_field_refs;
3627   BITCODE_H *field_refs;
3628 } Dwg_LinkedTableData;
3629 
3630 typedef struct _dwg_FormattedTableMerged
3631 {
3632   struct _dwg_FormattedTableData *parent;
3633   BITCODE_BL top_row;
3634   BITCODE_BL left_col;
3635   BITCODE_BL bottom_row;
3636   BITCODE_BL right_col;
3637 } Dwg_FormattedTableMerged;
3638 
3639 typedef struct _dwg_FormattedTableData
3640 {
3641   struct _dwg_object_TABLECONTENT *parent;
3642   Dwg_CellStyle cellstyle;
3643   BITCODE_BL num_merged_cells;
3644   Dwg_FormattedTableMerged *merged_cells;
3645 } Dwg_FormattedTableData;
3646 
3647 #define TABLECONTENT_fields                                                   \
3648   Dwg_LinkedData ldata;                                                       \
3649   Dwg_LinkedTableData tdata;                                                  \
3650   Dwg_FormattedTableData fdata;                                               \
3651   BITCODE_H tablestyle
3652 
3653 typedef struct _dwg_object_TABLECONTENT
3654 {
3655   struct _dwg_object_object *parent;
3656   TABLECONTENT_fields;
3657 } Dwg_Object_TABLECONTENT;
3658 
3659 typedef struct _dwg_entity_TABLE
3660 {
3661   struct _dwg_object_entity *parent;
3662   //r2010+ TABLECONTENT:
3663   TABLECONTENT_fields;
3664 
3665   BITCODE_RC unknown_rc;
3666   BITCODE_H unknown_h;
3667   BITCODE_BL unknown_bl;
3668   BITCODE_B unknown_b;
3669   BITCODE_BL unknown_bl1;
3670   BITCODE_3BD ins_pt; 	    /*!< DXF 10 */
3671   BITCODE_3BD scale;        /*!< DXF 41 */
3672   BITCODE_BB scale_flag;
3673   BITCODE_BD rotation;      /*!< DXF 50 */
3674   BITCODE_BE extrusion;     /*!< DXF 210 */
3675   BITCODE_B has_attribs;    /*!< DXF 66 */
3676   BITCODE_BL num_owned;
3677   BITCODE_BS flag_for_table_value; /*!< DXF 90.
3678                                      Bit flags, 0x06 (0x02 + 0x04): has block,
3679                                      0x10: table direction, 0 = up, 1 = down,
3680                                      0x20: title suppressed.
3681                                      Normally 0x06 is always set. */
3682   BITCODE_3BD horiz_direction; /*!< DXF 11 */
3683   BITCODE_BL num_cols;     /*!< DXF 90 */
3684   BITCODE_BL num_rows;     /*!< DXF 91 */
3685   unsigned long num_cells; /*!< computed */
3686   BITCODE_BD* col_widths;  /*!< DXF 142 */
3687   BITCODE_BD* row_heights; /*!< DXF 141 */
3688   Dwg_TABLE_Cell* cells;
3689   BITCODE_B has_table_overrides;
3690   BITCODE_BL table_flag_override; /*!< DXF 93 */
3691   BITCODE_B title_suppressed;     /*!< DXF 280 */
3692   BITCODE_B header_suppressed;    /*!< DXF 281 */
3693   BITCODE_BS flow_direction;      /*!< DXF 70 */
3694   BITCODE_BD horiz_cell_margin;   /*!< DXF 40 */
3695   BITCODE_BD vert_cell_margin;    /*!< DXF 41 */
3696   BITCODE_CMC title_row_color;    /*!< DXF 64 */
3697   BITCODE_CMC header_row_color;   /*!< DXF 64 */
3698   BITCODE_CMC data_row_color;     /*!< DXF 64 */
3699   BITCODE_B title_row_fill_none;  /*!< DXF 283 */
3700   BITCODE_B header_row_fill_none; /*!< DXF 283 */
3701   BITCODE_B data_row_fill_none;   /*!< DXF 283 */
3702   BITCODE_CMC title_row_fill_color;  /*!< DXF 63 */
3703   BITCODE_CMC header_row_fill_color; /*!< DXF 63 */
3704   BITCODE_CMC data_row_fill_color;   /*!< DXF 63 */
3705   BITCODE_BS title_row_alignment;   /*!< DXF 170 */
3706   BITCODE_BS header_row_alignment;  /*!< DXF 170 */
3707   BITCODE_BS data_row_alignment;    /*!< DXF 170 */
3708   BITCODE_H title_text_style;   /*!< DXF 7 */
3709   BITCODE_H header_text_style;  /*!< DXF 7 */
3710   BITCODE_H data_text_style;    /*!< DXF 7 */
3711   BITCODE_BD title_row_height;  /*!< DXF 140 */
3712   BITCODE_BD header_row_height; /*!< DXF 140 */
3713   BITCODE_BD data_row_height;   /*!< DXF 140 */
3714 
3715   BITCODE_B has_border_color_overrides;   /*!< if DXF 94 > 0 */
3716   BITCODE_BL border_color_overrides_flag; /*!< DXF 94 */
3717   BITCODE_CMC title_horiz_top_color;      /*!< DXF 64 if DXF 94 & 0x1 */
3718   BITCODE_CMC title_horiz_ins_color;      /*!< DXF 65 if DXF 94 & 0x2 */
3719   BITCODE_CMC title_horiz_bottom_color;   /*!< DXF 66 if DXF 94 & 0x4 */
3720   BITCODE_CMC title_vert_left_color;      /*!< DXF 63 if DXF 94 & 0x8 */
3721   BITCODE_CMC title_vert_ins_color;       /*!< DXF 68 if DXF 94 & 0x10 */
3722   BITCODE_CMC title_vert_right_color;     /*!< DXF 69 if DXF 94 & 0x20 */
3723   BITCODE_CMC header_horiz_top_color;     /*!< DXF 64 if DXF 94 & 0x40 */
3724   BITCODE_CMC header_horiz_ins_color;     /*!< DXF 65 */
3725   BITCODE_CMC header_horiz_bottom_color;  /*!< DXF 66 */
3726   BITCODE_CMC header_vert_left_color;     /*!< DXF 63 */
3727   BITCODE_CMC header_vert_ins_color;      /*!< DXF 68 */
3728   BITCODE_CMC header_vert_right_color;    /*!< DXF 69 */
3729   BITCODE_CMC data_horiz_top_color;       /*!< DXF 64 */
3730   BITCODE_CMC data_horiz_ins_color;       /*!< DXF 65 */
3731   BITCODE_CMC data_horiz_bottom_color;    /*!< DXF 66 */
3732   BITCODE_CMC data_vert_left_color;       /*!< DXF 63 */
3733   BITCODE_CMC data_vert_ins_color;        /*!< DXF 68 */
3734   BITCODE_CMC data_vert_right_color;      /*!< DXF 69 */
3735 
3736   BITCODE_B has_border_lineweight_overrides;   /*!< if DXF 95 > 0 */
3737   BITCODE_BL border_lineweight_overrides_flag; /*!< DXF 95 */
3738   BITCODE_BS title_horiz_top_linewt;
3739   BITCODE_BS title_horiz_ins_linewt;
3740   BITCODE_BS title_horiz_bottom_linewt;
3741   BITCODE_BS title_vert_left_linewt;
3742   BITCODE_BS title_vert_ins_linewt;
3743   BITCODE_BS title_vert_right_linewt;
3744   BITCODE_BS header_horiz_top_linewt;
3745   BITCODE_BS header_horiz_ins_linewt;
3746   BITCODE_BS header_horiz_bottom_linewt;
3747   BITCODE_BS header_vert_left_linewt;
3748   BITCODE_BS header_vert_ins_linewt;
3749   BITCODE_BS header_vert_right_linewt;
3750   BITCODE_BS data_horiz_top_linewt;
3751   BITCODE_BS data_horiz_ins_linewt;
3752   BITCODE_BS data_horiz_bottom_linewt;
3753   BITCODE_BS data_vert_left_linewt;
3754   BITCODE_BS data_vert_ins_linewt;
3755   BITCODE_BS data_vert_right_linewt;
3756 
3757   BITCODE_B has_border_visibility_overrides;
3758   BITCODE_BL border_visibility_overrides_flag; /*!< DXF 96 */
3759   BITCODE_BS title_horiz_top_visibility;
3760   BITCODE_BS title_horiz_ins_visibility;
3761   BITCODE_BS title_horiz_bottom_visibility;
3762   BITCODE_BS title_vert_left_visibility;
3763   BITCODE_BS title_vert_ins_visibility;
3764   BITCODE_BS title_vert_right_visibility;
3765   BITCODE_BS header_horiz_top_visibility;
3766   BITCODE_BS header_horiz_ins_visibility;
3767   BITCODE_BS header_horiz_bottom_visibility;
3768   BITCODE_BS header_vert_left_visibility;
3769   BITCODE_BS header_vert_ins_visibility;
3770   BITCODE_BS header_vert_right_visibility;
3771   BITCODE_BS data_horiz_top_visibility;
3772   BITCODE_BS data_horiz_ins_visibility;
3773   BITCODE_BS data_horiz_bottom_visibility;
3774   BITCODE_BS data_vert_left_visibility;
3775   BITCODE_BS data_vert_ins_visibility;
3776   BITCODE_BS data_vert_right_visibility;
3777 
3778   BITCODE_H block_header;
3779   BITCODE_H first_attrib;
3780   BITCODE_H last_attrib;
3781   BITCODE_H* attribs;
3782   BITCODE_H seqend;
3783   BITCODE_H title_row_style_override;
3784   BITCODE_H header_row_style_override;
3785   BITCODE_H data_row_style_override;
3786 
3787   BITCODE_BS unknown_bs;
3788   BITCODE_3BD hor_dir;
3789   BITCODE_BL has_break_data;
3790   BITCODE_BL break_flag;
3791   BITCODE_BL break_flow_direction;
3792   BITCODE_BD break_spacing;
3793   BITCODE_BL break_unknown1;
3794   BITCODE_BL break_unknown2;
3795   BITCODE_BL num_break_heights;
3796   Dwg_TABLE_BreakHeight *break_heights;
3797   BITCODE_BL num_break_rows;
3798   Dwg_TABLE_BreakRow *break_rows;
3799 
3800 } Dwg_Entity_TABLE;
3801 
3802 #undef TABLECONTENT_fields
3803 
3804 /**
3805  Class TABLESTYLE (varies)
3806  */
3807 
3808 typedef struct _dwg_TABLESTYLE_CellStyle
3809 {
3810   struct _dwg_object_TABLESTYLE *parent;
3811   BITCODE_BL id;   /* 1=title, 2=header, 3=data, 4=table.
3812                       ref TABLESTYLE. custom IDs > 100 */
3813   BITCODE_BL type; /* 1=data, 2=label */
3814   BITCODE_T  name;
3815   struct _dwg_CellStyle cellstyle;
3816 } Dwg_TABLESTYLE_CellStyle;
3817 
3818 // very similar to GridLine, or GridFormat. but no overrides, type, ltype, ...
3819 typedef struct _dwg_TABLESTYLE_border
3820 {
3821   BITCODE_BSd linewt;
3822   BITCODE_B visible;
3823   BITCODE_CMC color;
3824   //TODO
3825   // BITCODE_H ltype;
3826   // BITCODE_BD double_line_spacing;
3827 } Dwg_TABLESTYLE_border; // child of TABLE/TABLESTYLE/...
3828 
3829 typedef struct _dwg_TABLESTYLE_rowstyles
3830 {
3831   struct _dwg_object_TABLESTYLE *parent;
3832   BITCODE_H text_style;
3833   BITCODE_BD text_height;
3834   BITCODE_BS text_alignment;
3835   BITCODE_CMC text_color;
3836   BITCODE_CMC fill_color;
3837   BITCODE_B has_bgcolor;
3838 
3839   // 6: top, horizontal inside, bottom, left, vertical inside, right
3840   BITCODE_BL num_borders; // always 6
3841   Dwg_TABLESTYLE_border *borders;
3842 
3843   BITCODE_BL data_type;  // r2007+
3844   BITCODE_BL unit_type;
3845   BITCODE_TU format_string;
3846 } Dwg_TABLESTYLE_rowstyles;
3847 
3848 typedef struct _dwg_object_TABLESTYLE
3849 {
3850   struct _dwg_object_object *parent;
3851 
3852   BITCODE_BS class_version;
3853   BITCODE_T name;
3854   BITCODE_BS flags;
3855   BITCODE_BS flow_direction;
3856   BITCODE_BD horiz_cell_margin;
3857   BITCODE_BD vert_cell_margin;
3858   BITCODE_B is_title_suppressed;
3859   BITCODE_B is_header_suppressed;
3860   BITCODE_RC unknown_rc;         //r2007+ signed
3861   BITCODE_BL unknown_bl1;
3862   BITCODE_BL unknown_bl2;
3863   BITCODE_H cellstyle;           //r2007+. was called template
3864   Dwg_TABLESTYLE_CellStyle sty;  //r2007+. Note: embedded struct
3865   BITCODE_BL numoverrides;      // ??
3866   BITCODE_BL unknown_bl3;
3867   Dwg_TABLESTYLE_CellStyle ovr;  // ??
3868 
3869   // 0: data, 1: title, 2: header
3870   BITCODE_BL num_rowstyles; // always 3
3871   Dwg_TABLESTYLE_rowstyles *rowstyles;
3872 } Dwg_Object_TABLESTYLE;
3873 
3874 /**
3875  Class CELLSTYLEMAP (varies)
3876  R2008+ TABLESTYLE extension class
3877  */
3878 typedef struct _dwg_object_CELLSTYLEMAP
3879 {
3880   struct _dwg_object_object *parent;
3881   BITCODE_BL num_cells;
3882   Dwg_TABLESTYLE_CellStyle *cells;
3883 } Dwg_Object_CELLSTYLEMAP;
3884 
3885 /* 20.4.103 TABLEGEOMETRY
3886  r2008+ optional, == 20.4.98
3887  */
3888 
3889 typedef struct _dwg_TABLEGEOMETRY_Cell
3890 {
3891   struct _dwg_object_TABLEGEOMETRY *parent;
3892   BITCODE_BL geom_data_flag;
3893   BITCODE_BD width_w_gap;
3894   BITCODE_BD height_w_gap;
3895   BITCODE_H tablegeometry;
3896   BITCODE_BL num_geometry;
3897   Dwg_CellContentGeometry *geometry;
3898 } Dwg_TABLEGEOMETRY_Cell;
3899 
3900 typedef struct _dwg_object_TABLEGEOMETRY
3901 {
3902   struct _dwg_object_object *parent;
3903   BITCODE_BL numrows;
3904   BITCODE_BL numcols;
3905   BITCODE_BL num_cells; /* = num_rows * num_cols */
3906   Dwg_TABLEGEOMETRY_Cell *cells;
3907 } Dwg_Object_TABLEGEOMETRY;
3908 
3909 
3910 /**
3911   Abstract class UNDERLAYDEFINITION (varies)
3912   Parent of {PDF,DGN,DWF}DEFINITION
3913  */
3914 typedef struct _dwg_abstractobject_UNDERLAYDEFINITION
3915 {
3916   struct _dwg_object_object *parent;
3917 
3918   BITCODE_T filename; /*!< DXF 1, relative or absolute path to the image file */
3919   BITCODE_T name;     /*!< DXF 2, pdf: page number, dgn: default, dwf: ? */
3920 } Dwg_Object_UNDERLAYDEFINITION;
3921 
3922 typedef struct _dwg_abstractobject_UNDERLAYDEFINITION Dwg_Object_PDFDEFINITION;
3923 typedef struct _dwg_abstractobject_UNDERLAYDEFINITION Dwg_Object_DGNDEFINITION;
3924 typedef struct _dwg_abstractobject_UNDERLAYDEFINITION Dwg_Object_DWFDEFINITION;
3925 
3926 /**
3927  Abstract entity UNDERLAY, the reference (varies)
3928  As IMAGE or WIPEOUT but snappable, and with holes.
3929  Parent of {PDF,DGN,DWF}UNDERLAY
3930  In C++ as UnderlayReference
3931  */
3932 typedef struct _dwg_abstractentity_UNDERLAY
3933 {
3934   struct _dwg_object_entity *parent;
3935 
3936   BITCODE_BE extrusion; /*!< DXF 210 normal */
3937   BITCODE_3BD ins_pt;  /*!< DXF 10 */
3938   BITCODE_3BD scale;   /*!< DXF 41 */
3939   BITCODE_BD angle;    /*!< DXF 50 */
3940   BITCODE_RC flag;     /*!< DXF 280: 1 is_clipped, 2 is_on, 4 is_monochrome,
3941                             8 is_adjusted_for_background, 16 is_clip_inverted,
3942                             ? is_frame_visible, ? is_frame_plottable */
3943   BITCODE_RC contrast; /*!< DXF 281 20-100, def: 100 */
3944   BITCODE_RC fade;     /*!< DXF 282 0-80, def: 0 */
3945   BITCODE_BL num_clip_verts;
3946   BITCODE_2RD *clip_verts;     /*!< DXF 11: if 2 rectangle, > polygon */
3947   /* Note that neither Wipeout nor RasterImage has these inverted clips, allowing one hole.
3948      They just have an clip_mode flag for is_inverted.
3949      GeoJSON/GIS has multiple polygons, allowing multiple nested holes. */
3950   BITCODE_BS num_clip_inverts; /*!< DXF 170 */
3951   BITCODE_2RD *clip_inverts;   /*!< DXF 12  */
3952   BITCODE_H definition_id;     /*!< DXF 340 */
3953 } Dwg_Entity_UNDERLAY;
3954 
3955 typedef struct _dwg_abstractentity_UNDERLAY Dwg_Entity_PDFUNDERLAY;
3956 typedef struct _dwg_abstractentity_UNDERLAY Dwg_Entity_DGNUNDERLAY;
3957 typedef struct _dwg_abstractentity_UNDERLAY Dwg_Entity_DWFUNDERLAY;
3958 
3959 /**
3960  Class DBCOLOR (varies)
3961  */
3962 typedef struct _dwg_object_DBCOLOR
3963 {
3964   struct _dwg_object_object *parent;
3965   BITCODE_CMC color;   //62,420,430
3966 } Dwg_Object_DBCOLOR;
3967 
3968 /**
3969  Class FIELDLIST AcDbField (varies)
3970  R2018+
3971  */
3972 typedef struct _dwg_FIELD_ChildValue
3973 {
3974   struct _dwg_object_FIELD *parent;
3975   BITCODE_TV key;   /*!< DXF 6 */
3976   Dwg_TABLE_value value;
3977 } Dwg_FIELD_ChildValue;
3978 
3979 typedef struct _dwg_object_FIELD
3980 {
3981   struct _dwg_object_object *parent;
3982                     /* dxf group code */
3983   BITCODE_TV id;           /* 1 */
3984   BITCODE_TV code;         /* 2,3 */
3985   BITCODE_BL num_childs;   /* 90 */
3986   BITCODE_H *childs;       /* code:3, 360 */
3987   BITCODE_BL num_objects;  /* 97 */
3988   BITCODE_H *objects;      /* code:5, 331 */
3989   BITCODE_TV format;       /* 4, until r2004 only */
3990   BITCODE_BL evaluation_option; /* 91 */
3991   BITCODE_BL filing_option;     /* 92 */
3992   BITCODE_BL field_state;       /* 94 */
3993   BITCODE_BL evaluation_status; /* 95 */
3994   BITCODE_BL evaluation_error_code; /* 96 */
3995   BITCODE_TV evaluation_error_msg;  /* 300 */
3996   Dwg_TABLE_value value;
3997   BITCODE_TV value_string;        /* 301,9 */
3998   BITCODE_BL value_string_length; /* 98 ODA bug: TV */
3999   BITCODE_BL num_childval;      /* 93 */
4000   Dwg_FIELD_ChildValue *childval;
4001 } Dwg_Object_FIELD;
4002 
4003 /**
4004  * Object FIELDLIST (varies)
4005  */
4006 typedef struct _dwg_object_FIELDLIST
4007 {
4008   struct _dwg_object_object *parent;
4009 
4010   BITCODE_BL num_fields;
4011   BITCODE_B unknown;
4012   BITCODE_H *fields;
4013 } Dwg_Object_FIELDLIST;
4014 
4015 /**
4016  Class GEODATA (varies)
4017  R2009+
4018  */
4019 typedef struct _dwg_GEODATA_meshpt
4020 {
4021   BITCODE_2RD source_pt;
4022   BITCODE_2RD dest_pt;
4023 } Dwg_GEODATA_meshpt;
4024 
4025 typedef struct _dwg_GEODATA_meshface
4026 {
4027   BITCODE_BL face1;
4028   BITCODE_BL face2;
4029   BITCODE_BL face3;
4030 } Dwg_GEODATA_meshface;
4031 
4032 typedef struct _dwg_object_GEODATA
4033 {                   /* dxf group code */
4034   struct _dwg_object_object *parent;
4035 
4036   BITCODE_BL class_version;
4037   BITCODE_H host_block;
4038   BITCODE_BS coord_type; /* 0 unknown, 1 local grid, 2 projected grid,
4039                             3 geographic defined by latitude/longitude) */
4040   BITCODE_3BD design_pt;
4041   BITCODE_3BD ref_pt;
4042   BITCODE_3BD obs_pt;
4043   BITCODE_3BD scale_vec; // always 1.0,1.0,1.0
4044   BITCODE_BD unit_scale_horiz;
4045   BITCODE_BL units_value_horiz; // enum 0-20
4046   BITCODE_BD unit_scale_vert;
4047   BITCODE_BL units_value_vert; // enum 0-20
4048   BITCODE_3BD up_dir;
4049   BITCODE_3BD north_dir;
4050   BITCODE_BL scale_est; /* None = 1, User specified scale factor = 2,
4051                            Grid scale at reference point = 3, Prismodial = 4 */
4052   BITCODE_BD user_scale_factor;
4053   BITCODE_B do_sea_level_corr;
4054   BITCODE_BD sea_level_elev;
4055   BITCODE_BD coord_proj_radius;
4056   BITCODE_T coord_system_def;
4057   BITCODE_T geo_rss_tag;
4058   BITCODE_T coord_system_datum; /* obsolete */
4059   BITCODE_T coord_system_wkt; /* obsolete */
4060 
4061   BITCODE_T observation_from_tag;
4062   BITCODE_T observation_to_tag;
4063   BITCODE_T observation_coverage_tag;
4064   BITCODE_BL num_geomesh_pts;
4065   Dwg_GEODATA_meshpt *geomesh_pts;
4066   BITCODE_BL num_geomesh_faces;
4067   Dwg_GEODATA_meshface *geomesh_faces;
4068 
4069   BITCODE_B has_civil_data;
4070   BITCODE_B obsolete_false;
4071   BITCODE_2RD ref_pt2d; // (y, x) of ref_pt reversed
4072   BITCODE_3BD zero1, zero2;
4073   BITCODE_BL unknown1;
4074   BITCODE_BL unknown2;
4075   BITCODE_B unknown_b;
4076   BITCODE_BD north_dir_angle_deg;
4077   BITCODE_BD north_dir_angle_rad;
4078 } Dwg_Object_GEODATA;
4079 
4080 /**
4081  Class IDBUFFER (varies)
4082  */
4083 typedef struct _dwg_object_IDBUFFER
4084 {
4085   struct _dwg_object_object *parent;
4086 
4087   BITCODE_RC unknown;
4088   BITCODE_BL num_obj_ids;
4089   BITCODE_H* obj_ids;
4090 } Dwg_Object_IDBUFFER;
4091 
4092 /**
4093  Classes for IMAGE (varies)
4094  */
4095 
4096 typedef struct _dwg_entity_IMAGE
4097 {
4098   struct _dwg_object_entity *parent;
4099   // also used in WIPEOUT
4100   BITCODE_BL class_version;
4101   BITCODE_3BD pt0;
4102   BITCODE_3BD uvec;
4103   BITCODE_3BD vvec;
4104   BITCODE_2RD size; 	/*!< DXF 13/23; width, height in pixel */
4105   BITCODE_BS display_props;
4106   BITCODE_B clipping;
4107   BITCODE_RC brightness;
4108   BITCODE_RC contrast;
4109   BITCODE_RC fade;
4110   BITCODE_B clip_mode;           // 0 outside, 1 inside (inverted)
4111   BITCODE_BS clip_boundary_type; // 1 rect, 2 polygon
4112   BITCODE_BL num_clip_verts;
4113   BITCODE_2RD* clip_verts;
4114   BITCODE_H imagedef;
4115   BITCODE_H imagedefreactor;
4116 } Dwg_Entity_IMAGE;
4117 
4118 /**
4119  Class IMAGEDEF (varies)
4120  */
4121 typedef struct _dwg_object_IMAGEDEF
4122 {
4123   struct _dwg_object_object *parent;
4124 
4125   BITCODE_BL class_version;
4126   BITCODE_2RD image_size;
4127   BITCODE_T file_path;
4128   BITCODE_B is_loaded;
4129   BITCODE_RC resunits;
4130   BITCODE_2RD pixel_size;  // resolution MM/pixel
4131   //BITCODE_H xrefctrl;    /*!< r2010+ */
4132 } Dwg_Object_IMAGEDEF;
4133 
4134 /**
4135  Class IMAGEDEF_REACTOR (varies)
4136  */
4137 typedef struct _dwg_object_IMAGEDEF_REACTOR
4138 {
4139   struct _dwg_object_object *parent;
4140 
4141   BITCODE_BL class_version;
4142 } Dwg_Object_IMAGEDEF_REACTOR;
4143 
4144 /**
4145  Class INDEX (varies)
4146  Registered as "AutoCAD 2000", but not seen in the wild.
4147  */
4148 typedef struct _dwg_object_INDEX
4149 {
4150   struct _dwg_object_object *parent;
4151   BITCODE_TIMEBLL last_updated;
4152 } Dwg_Object_INDEX;
4153 
4154 /**
4155  Class LAYER_INDEX (varies)
4156  */
4157 typedef struct _dwg_LAYER_entry
4158 {
4159   struct _dwg_object_LAYER_INDEX *parent;
4160   BITCODE_BL numlayers;
4161   BITCODE_T name;
4162   BITCODE_H handle;
4163 } Dwg_LAYER_entry;
4164 
4165 typedef struct _dwg_object_LAYER_INDEX
4166 {
4167   struct _dwg_object_object *parent;
4168   BITCODE_TIMEBLL last_updated;
4169   BITCODE_BL num_entries;
4170   Dwg_LAYER_entry* entries;
4171 } Dwg_Object_LAYER_INDEX;
4172 
4173 /**
4174  Class LWPOLYLINE (77 + varies)
4175  */
4176 typedef struct _dwg_entity_LWPOLYLINE
4177 {
4178   struct _dwg_object_entity *parent;
4179 
4180   BITCODE_BS flag;              /*!< DXF 70
4181                                   512 closed, 128 plinegen, 4 constwidth, 8 elevation, 2 thickness
4182                                   1 extrusion, 16 num_bulges, 1024 vertexidcount, 32 has_widths */
4183   BITCODE_BD const_width;       /*!< DXF 43 */
4184   BITCODE_BD elevation;         /*!< DXF 38 */
4185   BITCODE_BD thickness;         /*!< DXF 39 */
4186   BITCODE_BE extrusion;        /*!< DXF 210 */
4187   BITCODE_BL num_points;        /*!< DXF 90 */
4188   BITCODE_2RD* points;          /*!< DXF 10,20 */
4189   BITCODE_BL num_bulges;
4190   BITCODE_BD* bulges;           /*!< DXF 42 */
4191   BITCODE_BL num_vertexids;     /*!< r2010+, same as num_points */
4192   BITCODE_BL* vertexids;        /*!< r2010+ DXF 91 */
4193   BITCODE_BL num_widths;
4194   Dwg_LWPOLYLINE_width* widths; /*!< DXF 40,41 */
4195 } Dwg_Entity_LWPOLYLINE;
4196 
4197 /**
4198  Class RASTERVARIABLES (varies)
4199  (used in conjunction with IMAGE entities)
4200  */
4201 typedef struct _dwg_object_RASTERVARIABLES
4202 {
4203   struct _dwg_object_object *parent;
4204 
4205   BITCODE_BL class_version;
4206   BITCODE_BS image_frame;
4207   BITCODE_BS image_quality;
4208   BITCODE_BS units; // DXF 72, i.e. user_scale
4209 } Dwg_Object_RASTERVARIABLES;
4210 
4211 /**
4212  Object SCALE (varies)
4213  */
4214 typedef struct _dwg_object_SCALE
4215 {
4216   struct _dwg_object_object *parent;
4217 
4218   BITCODE_BS flag; /* 1: is_temporary */
4219   BITCODE_TV name;
4220   BITCODE_BD paper_units;
4221   BITCODE_BD drawing_units;
4222   BITCODE_B is_unit_scale;
4223 } Dwg_Object_SCALE;
4224 
4225 /**
4226  Class SORTENTSTABLE (varies)
4227  */
4228 typedef struct _dwg_object_SORTENTSTABLE
4229 {
4230   struct _dwg_object_object *parent;
4231 
4232   BITCODE_BL num_ents;
4233   BITCODE_H* sort_ents;
4234   BITCODE_H block_owner; // mspace or pspace
4235   BITCODE_H* ents;
4236 } Dwg_Object_SORTENTSTABLE;
4237 
4238 /**
4239  Class SPATIAL_FILTER (varies)
4240  */
4241 typedef struct _dwg_object_SPATIAL_FILTER
4242 {
4243   struct _dwg_object_object *parent;
4244 
4245   BITCODE_BS num_clip_verts;
4246   BITCODE_2RD* clip_verts;
4247   BITCODE_BE extrusion;
4248   BITCODE_3BD origin;
4249   BITCODE_BS display_boundary_on;
4250   BITCODE_BS front_clip_on;
4251   BITCODE_BD front_clip_z;
4252   BITCODE_BS back_clip_on;
4253   BITCODE_BD back_clip_z;
4254   BITCODE_BD* inverse_transform;
4255   BITCODE_BD* transform;
4256 } Dwg_Object_SPATIAL_FILTER;
4257 
4258 /**
4259  Class SPATIAL_INDEX (varies)
4260  ODA only covers the AcDbFilter class, but misses the rest.
4261  */
4262 typedef struct _dwg_object_SPATIAL_INDEX
4263 {
4264   struct _dwg_object_object *parent;
4265 
4266   BITCODE_TIMEBLL last_updated;
4267   BITCODE_BD num1, num2, num3, num4, num5, num6;
4268   BITCODE_BL num_hdls;
4269   BITCODE_H *hdls;
4270   BITCODE_BL bindata_size;
4271   BITCODE_TF bindata;
4272 } Dwg_Object_SPATIAL_INDEX;
4273 
4274 /**
4275  WIPEOUT (varies, 504)
4276  R2000+, undocumented = IMAGE layover
4277  */
4278 typedef struct _dwg_entity_WIPEOUT
4279 {
4280   struct _dwg_object_entity *parent;
4281 
4282   BITCODE_BL class_version;
4283   BITCODE_3BD pt0;
4284   BITCODE_3BD uvec;
4285   BITCODE_3BD vvec;
4286   BITCODE_2RD size;
4287   BITCODE_BS display_props;
4288   BITCODE_B clipping;
4289   BITCODE_RC brightness;
4290   BITCODE_RC contrast;
4291   BITCODE_RC fade;
4292   BITCODE_B clip_mode;           // 0 outside, 1 inside (inverted)
4293   BITCODE_BS clip_boundary_type; // 1 rect, 2 polygon
4294   BITCODE_BL num_clip_verts;
4295   BITCODE_2RD* clip_verts;
4296   BITCODE_H imagedef;
4297   BITCODE_H imagedefreactor;
4298 } Dwg_Entity_WIPEOUT;
4299 
4300 /**
4301  Class WIPEOUTVARIABLES (varies, 505)
4302  R2000+, Object bitsize: 96
4303  */
4304 typedef struct _dwg_object_WIPEOUTVARIABLES
4305 {
4306   struct _dwg_object_object *parent;
4307   //BITCODE_BL class_version;  /*!< DXF 90 NY */
4308   BITCODE_BS display_frame;    /*!< DXF 70  */
4309 } Dwg_Object_WIPEOUTVARIABLES;
4310 
4311 /* SECTIONPLANE, r2007+
4312  * Looks like the livesection ptr from VIEW
4313  */
4314 typedef struct _dwg_entity_SECTIONOBJECT
4315 {
4316   struct _dwg_object_entity *parent;
4317   BITCODE_BL state;		/*!< DXF 90. Plane=1, Boundary=2, Volume=4 */
4318   BITCODE_BL flags;		/*!< DXF 91. hitflags: sectionline=1, sectionlinetop=2, sectionlinebottom=4,
4319                                   backline=8, backlinetop=16, backlinebottom=32, verticallinetop=64,
4320                                   verticallinebottom=128.
4321                                   heightflags: HeightAboveSectionLine=1, HeightBelowSectionLine=2
4322                                  */
4323   BITCODE_T name;		/*!< DXF 1 */
4324   //BITCODE_3BD viewing_dir;	/*!< normal of the 1st segment plane */
4325   BITCODE_3BD vert_dir;	        /*!< DXF 10. normal to the segment line, on the plane */
4326   BITCODE_BD top_height;	/*!< DXF 40 */
4327   BITCODE_BD bottom_height;	/*!< DXF 41 */
4328   BITCODE_BS indicator_alpha;	/*!< DXF 70 */
4329   BITCODE_CMC indicator_color;	/*!< DXF 62/420 (but documented as 63/411) */
4330   BITCODE_BL num_verts;		/*!< DXF 92 */
4331   BITCODE_3BD *verts;		/*!< DXF 11 */
4332   BITCODE_BL num_blverts;	/*!< DXF 93 */
4333   BITCODE_3BD *blverts;		/*!< DXF 12 */
4334   BITCODE_H section_settings;	/*!< DXF 360 */
4335 
4336 } Dwg_Entity_SECTIONOBJECT;
4337 
4338 /**
4339  Unstable
4340  Class VISUALSTYLE (varies)
4341  R2007+
4342 
4343  32 types, with 3 categories: Face, Edge, Display, plus 58 props r2013+
4344  */
4345 typedef struct _dwg_object_VISUALSTYLE
4346 {
4347   struct _dwg_object_object *parent;
4348   BITCODE_T description;          /*!< DXF 2  */
4349   BITCODE_BL style_type;          /*!< DXF 70 enum 0-32: (kFlat-kEmptyStyle acgivisualstyle.h) */
4350   BITCODE_BS ext_lighting_model;  /*!< DXF 177, r2010+ ? required on has_xdata */
4351   BITCODE_B internal_only;        /*!< DXF 291, has internal_use_only flags */
4352   BITCODE_BL face_lighting_model; /*!< DXF 71 0:Invisible 1:Visible 2:Phong 3:Gooch */
4353   BITCODE_BS face_lighting_model_int;   /*!< DXF 176 r2010+ */
4354   BITCODE_BL face_lighting_quality;     /*!< DXF 72 0:No lighting 1:Per face 2:Per vertex */
4355   BITCODE_BS face_lighting_quality_int; /*!< DXF 176 r2010+ */
4356   BITCODE_BL face_color_mode;   /*!< DXF 73 0 = No color
4357                                             1 = Object color
4358                                             2 = Background color
4359                                             3 = Custom color
4360                                             4 = Mono color
4361                                             5 = Tinted
4362                                             6 = Desaturated */
4363   BITCODE_BS face_color_mode_int; /*!< DXF 176 r2010+ */
4364   BITCODE_BD face_opacity;      /*!< DXF 40  */
4365   BITCODE_BS face_opacity_int;  /*!< DXF 176 r2010+ */
4366   BITCODE_BD face_specular;     /*!< DXF 41  */
4367   BITCODE_BS face_specular_int; /*!< DXF 176 r2010+ */
4368   BITCODE_BL face_modifier;     /*!< DXF 90 0:No modifiers 1:Opacity 2:Specular */
4369   BITCODE_BS face_modifier_int; /*!< DXF 176 r2010+ */
4370   BITCODE_CMC face_mono_color;  /*!< DXF 63 + 421 */
4371   BITCODE_BS face_mono_color_int; /*!< DXF 176 r2010+ */
4372   BITCODE_BS edge_model;        /*!< DXF 74 0:No edges 1:Isolines 2:Facet edges */
4373   BITCODE_BS edge_model_int;    /*!< DXF 176 r2010+ */
4374   BITCODE_BL edge_style;        /*!< DXF 91  */
4375   BITCODE_BS edge_style_int;    /*!< DXF 176 r2010+ */
4376   BITCODE_CMC edge_intersection_color;  /*!< DXF 64  */
4377   BITCODE_BS edge_intersection_color_int; /*!< DXF 176 r2010+ */
4378   BITCODE_CMC edge_obscured_color;      /*!< DXF 65  */
4379   BITCODE_BS edge_obscured_color_int;   /*!< DXF 176 r2010+ */
4380   BITCODE_BL edge_obscured_ltype;      /*!< DXF 75   */
4381   BITCODE_BS edge_obscured_ltype_int;  /*!< DXF 176 r2010+ */
4382   BITCODE_BL edge_intersection_ltype;  /*!< DXF 175  */
4383   BITCODE_BS edge_intersection_ltype_int; /*!< DXF 176 r2010+ */
4384   BITCODE_BD edge_crease_angle;         /*!< DXF 42  */
4385   BITCODE_BS edge_crease_angle_int;     /*!< DXF 176 r2010+ */
4386   BITCODE_BL edge_modifier;             /*!< DXF 92  */
4387   BITCODE_BS edge_modifier_int;         /*!< DXF 176 r2010+ */
4388   BITCODE_CMC edge_color;               /*!< DXF 66  */
4389   BITCODE_BS edge_color_int;            /*!< DXF 176 r2010+ */
4390   BITCODE_BD edge_opacity;              /*!< DXF 43  */
4391   BITCODE_BS edge_opacity_int;          /*!< DXF 176 r2010+ */
4392   BITCODE_BL edge_width;                /*!< DXF 76  */
4393   BITCODE_BS edge_width_int;            /*!< DXF 176 r2010+ */
4394   BITCODE_BL edge_overhang;             /*!< DXF 77  */
4395   BITCODE_BS edge_overhang_int;         /*!< DXF 176 r2010+ */
4396   BITCODE_BL edge_jitter;               /*!< DXF 78  */
4397   BITCODE_BS edge_jitter_int;           /*!< DXF 176 r2010+ */
4398   BITCODE_CMC edge_silhouette_color;    /*!< DXF 67  */
4399   BITCODE_BS edge_silhouette_color_int; /*!< DXF 176 r2010+ */
4400   BITCODE_BL edge_silhouette_width;     /*!< DXF 79  */
4401   BITCODE_BS edge_silhouette_width_int; /*!< DXF 176 r2010+ */
4402   BITCODE_BL edge_halo_gap;             /*!< DXF 170  */
4403   BITCODE_BS edge_halo_gap_int;         /*!< DXF 176 r2010+ */
4404   BITCODE_BL edge_isolines;             /*!< DXF 171  */
4405   BITCODE_BS edge_isolines_int;         /*!< DXF 176 r2010+ */
4406   BITCODE_B  edge_do_hide_precision;    /*!< DXF 290  */
4407   BITCODE_BS edge_do_hide_precision_int;/*!< DXF 176 r2010+ */
4408   BITCODE_BL edge_style_apply;     	/*!< DXF 174  */
4409   BITCODE_BS edge_style_apply_int; 	/*!< DXF 176 r2010+  */
4410   BITCODE_BL display_settings;          /*!< DXF 93 flags  */
4411   BITCODE_BS display_settings_int;      /*!< DXF 176 r2010+ */
4412   BITCODE_BLd display_brightness_bl;    /*!< DXF 44 <=r2007 */
4413   BITCODE_BD display_brightness;        /*!< DXF 44  r2010+ */
4414   BITCODE_BS display_brightness_int;    /*!< DXF 176 r2010+ */
4415   BITCODE_BL display_shadow_type;       /*!< DXF 173  */
4416   BITCODE_BS display_shadow_type_int;   /*!< DXF 176 r2010+ */
4417   BITCODE_BD bd2007_45;                 /*!< DXF 45 r2007-only 0.0 */
4418 
4419   BITCODE_BS num_props; 		/*!< r2013+ version3 58x */
4420   /* the rest of the props:
4421      all bool are 290, all BS/BL are 90, all BD are 40, colors 62, text 1 */
4422   BITCODE_B b_prop1c;   BITCODE_BS b_prop1c_int;
4423   BITCODE_B b_prop1d;   BITCODE_BS b_prop1d_int;
4424   BITCODE_B b_prop1e;   BITCODE_BS b_prop1e_int;
4425   BITCODE_B b_prop1f;   BITCODE_BS b_prop1f_int;
4426   BITCODE_B b_prop20;   BITCODE_BS b_prop20_int;
4427   BITCODE_B b_prop21;   BITCODE_BS b_prop21_int;
4428   BITCODE_B b_prop22;   BITCODE_BS b_prop22_int;
4429   BITCODE_B b_prop23;   BITCODE_BS b_prop23_int;
4430   BITCODE_B b_prop24;   BITCODE_BS b_prop24_int;
4431   BITCODE_BL bl_prop25; BITCODE_BS bl_prop25_int;
4432   BITCODE_BD bd_prop26; BITCODE_BS bd_prop26_int;
4433   BITCODE_BD bd_prop27; BITCODE_BS bd_prop27_int;
4434   BITCODE_BL bl_prop28; BITCODE_BS bl_prop28_int;
4435   BITCODE_CMC c_prop29; BITCODE_BS c_prop29_int;
4436   BITCODE_BL bl_prop2a; BITCODE_BS bl_prop2a_int;
4437   BITCODE_BL bl_prop2b; BITCODE_BS bl_prop2b_int;
4438   BITCODE_CMC c_prop2c; BITCODE_BS c_prop2c_int;
4439   BITCODE_B b_prop2d;   BITCODE_BS b_prop2d_int;
4440   BITCODE_BL bl_prop2e; BITCODE_BS bl_prop2e_int;
4441   BITCODE_BL bl_prop2f; BITCODE_BS bl_prop2f_int;
4442   BITCODE_BL bl_prop30; BITCODE_BS bl_prop30_int;
4443   BITCODE_B b_prop31;   BITCODE_BS b_prop31_int;
4444   BITCODE_BL bl_prop32; BITCODE_BS bl_prop32_int;
4445   BITCODE_CMC c_prop33; BITCODE_BS c_prop33_int;
4446   BITCODE_BD bd_prop34; BITCODE_BS bd_prop34_int;
4447   BITCODE_BL edge_wiggle;BITCODE_BS edge_wiggle_int;
4448   BITCODE_T strokes;    BITCODE_BS strokes_int;
4449   BITCODE_B b_prop37;   BITCODE_BS b_prop37_int;
4450   BITCODE_BD bd_prop38; BITCODE_BS bd_prop38_int;
4451   BITCODE_BD bd_prop39; BITCODE_BS bd_prop39_int;
4452 
4453 } Dwg_Object_VISUALSTYLE;
4454 
4455 /**
4456  Object LIGHTLIST (varies)
4457  R2010+
4458  */
4459 
4460 typedef struct _dwg_LIGHTLIST_light
4461 {
4462   struct _dwg_object_LIGHTLIST *parent;
4463   BITCODE_T name;
4464   BITCODE_H handle;
4465 } Dwg_LIGHTLIST_light;
4466 
4467 /* 2010+ */
4468 typedef struct _dwg_object_LIGHTLIST
4469 {
4470   struct _dwg_object_object *parent;
4471   BITCODE_BL class_version;
4472   BITCODE_BL num_lights;
4473   Dwg_LIGHTLIST_light *lights;
4474 } Dwg_Object_LIGHTLIST;
4475 
4476 
4477 typedef struct _dwg_MATERIAL_color
4478 {
4479   struct _dwg_object_object *parent;
4480   BITCODE_RC flag;    /*!< 0 Use current color, 1 Override */
4481   BITCODE_BD factor;  /*!< 0.0 - 1.0 */
4482   BITCODE_BL rgb;
4483 } Dwg_MATERIAL_color;
4484 
4485 typedef struct _dwg_MATERIAL_mapper
4486 {
4487   struct _dwg_object_object *parent;
4488   BITCODE_BD blendfactor;   /*!< DXF 42  def: 1.0 */
4489   BITCODE_BD* transmatrix;  /*!< DXF 43: 16x BD */
4490   BITCODE_T filename;       /*!< DXF 3   if NULL no diffuse map */
4491   Dwg_MATERIAL_color color1;
4492   Dwg_MATERIAL_color color2;
4493   BITCODE_RC source;        /*!< DXF 72  0 current, 1 image file (def), 2 2nd map? */
4494   BITCODE_RC projection;    /*!< DXF 73  1 Planar (def), 2 Box, 3 Cylinder, 4 Sphere */
4495   BITCODE_RC tiling;        /*!< DXF 74  1 = Tile (def), 2 = Crop, 3 = Clamp */
4496   BITCODE_RC autotransform; /*!< DXF 75  1 no, 2: scale to curr ent,
4497                                          4: w/ current block transform */
4498   /* marble, wood and procedural modes */
4499   BITCODE_BS texturemode;
4500 } Dwg_MATERIAL_mapper;
4501 
4502 typedef struct _dwg_MATERIAL_gentexture
4503 {
4504   struct _dwg_object_MATERIAL *parent;
4505   BITCODE_T genprocname;
4506   struct _dwg_object_MATERIAL *material;
4507 } Dwg_MATERIAL_gentexture;
4508 
4509 /**
4510  Object MATERIAL (varies)
4511  Acad Naming: e.g. Materials/assetlibrary_base.fbm/shaders/AdskShaders.mi
4512                   Materials/assetlibrary_base.fbm/Mats/SolidGlass/Generic.xml
4513  */
4514 typedef struct _dwg_object_MATERIAL
4515 {
4516   struct _dwg_object_object *parent;
4517 
4518   BITCODE_T name; 			/*!< DXF 1 */
4519   BITCODE_T description; 		/*!< DXF 2 optional */
4520 
4521   Dwg_MATERIAL_color ambient_color;    /*!< DXF 70, 40, 90 */
4522   Dwg_MATERIAL_color diffuse_color;    /*!< DXF 71, 41, 91 */
4523   Dwg_MATERIAL_mapper diffusemap;      /*!< DXF 42, 72, 3, 73, 74, 75, 43 */
4524 
4525   BITCODE_BD specular_gloss_factor;    /*!< DXF 44 def: 0.5 */
4526   Dwg_MATERIAL_color specular_color;   /*!< DXF 76, 45, 92 */
4527   Dwg_MATERIAL_mapper specularmap;     /*!< DXF 46, 77, 4, 78, 79, 170, 47 */
4528 
4529   //?? BD reflection_depth
4530   //reflection_glossy_samples
4531   Dwg_MATERIAL_mapper reflectionmap;   /*!< DXF 48, 171, 6, 172, 173, 174, 49 */
4532 
4533   BITCODE_BD opacity_percent;          /*!< DXF 140 def: 1.0 */
4534   Dwg_MATERIAL_mapper opacitymap;      /*!< DXF 141, 175, 7, 176, 177, 178, 142 */
4535 
4536   //BITCODE_B bump_enable
4537   //?BD bump_amount
4538   Dwg_MATERIAL_mapper bumpmap;         /*!< DXF 143, 179, 8, 270, 271, 272, 144 */
4539 
4540   BITCODE_BD refraction_index;         /*!< DXF 145 def: 1.0 */
4541   //?? BD refraction_depth
4542   //?? BD refraction_translucency_weight
4543   //?? refraction_glossy_samples
4544   Dwg_MATERIAL_mapper refractionmap;   /*!< DXF 146, 273, 9, 274, 275, 276, 147 */
4545 
4546   BITCODE_BD color_bleed_scale;    /*!< DXF 460 */
4547   BITCODE_BD indirect_bump_scale;  /*!< DXF 461 */
4548   BITCODE_BD reflectance_scale;    /*!< DXF 462 */
4549   BITCODE_BD transmittance_scale;  /*!< DXF 463 */
4550   BITCODE_B two_sided_material;    /*!< DXF 290 */
4551   BITCODE_BD luminance;            /*!< DXF 464 */
4552   BITCODE_BS luminance_mode;       /*!< DXF 270 */
4553   BITCODE_BD translucence;         /*!< DXF 148 */
4554   BITCODE_BD self_illumination;    /*!< DXF 149 */
4555   BITCODE_BD reflectivity;         /*!< DXF 468 */
4556   BITCODE_BL illumination_model;   /*!< DXF 93 */
4557   BITCODE_BL channel_flags;        /*!< DXF 94 */
4558   BITCODE_BL mode;                 /*!< DXF 282 */
4559 
4560   BITCODE_T genprocname;           /*!< DXF 300 */
4561   BITCODE_BS genproctype;
4562   BITCODE_B genprocvalbool;        /*!< DXF 291 */
4563   BITCODE_BS genprocvalint;        /*!< DXF 271 */
4564   BITCODE_BD genprocvalreal;       /*!< DXF 469 */
4565   BITCODE_T genprocvaltext;        /*!< DXF 301 */
4566   BITCODE_CMC genprocvalcolor;     /*!< DXF 62 */
4567   BITCODE_B genproctableend;       /*!< DXF 292 */
4568   BITCODE_BS num_gentextures;
4569   Dwg_MATERIAL_gentexture* gentextures;
4570 
4571 #if 0
4572   BITCODE_BS normalmap_method;     /*!< DXF 271 */
4573   BITCODE_BD normalmap_strength;   /*!< DXF 465 def: 1.0 */
4574   Dwg_MATERIAL_mapper normalmap;   /*!< DXF 42, 72, 3, 73, 74, 75, 43 */
4575   BITCODE_B is_anonymous;          /*!< DXF 293 */
4576   BITCODE_BS global_illumination;  /*!< DXF 272 */
4577   BITCODE_BS final_gather;         /*!< DXF 273 */
4578 #endif
4579   //? BD backface_cull
4580   //? BD self_illum_luminance
4581   //? BD self_illum_color_temperature
4582 } Dwg_Object_MATERIAL;
4583 
4584 /**
4585  Object OBJECT_PTR (varies) UNKNOWN FIELDS
4586  yet unsorted, and unused.
4587  */
4588 typedef struct _dwg_object_OBJECT_PTR
4589 {
4590   struct _dwg_object_object *parent;
4591 } Dwg_Object_OBJECT_PTR;
4592 
4593 /**
4594  Entity LIGHT (varies)
4595  UNSTABLE, now complete
4596  */
4597 typedef struct _dwg_entity_LIGHT
4598 {
4599   struct _dwg_object_entity *parent;
4600 
4601   BITCODE_BL class_version; /*!< DXF 90 */
4602   BITCODE_T name;       /*!< DXF 1 */
4603   BITCODE_BL type;      /*!< DXF 70, distant = 1; point = 2; spot = 3 */
4604   BITCODE_B status;     /*!< DXF 290, on or off */
4605   BITCODE_CMC color;    /*!< DXF 63 + 421. r2000: 90 for the rgb value */
4606   BITCODE_B plot_glyph; /*!< DXF 291 */
4607   BITCODE_BD intensity; /*!< DXF 40 */
4608   BITCODE_3BD position; /*!< DXF 10 */
4609   BITCODE_3BD target;   /*!< DXF 11 */
4610   BITCODE_BL attenuation_type;        /*!< DXF 72. None=0, Inverse Linear=1,
4611                                                    Inverse Square=2 */
4612   BITCODE_B use_attenuation_limits;   /*!< DXF 292 */
4613   BITCODE_BD attenuation_start_limit; /*!< DXF 41 */
4614   BITCODE_BD attenuation_end_limit;   /*!< DXF 42 */
4615   BITCODE_BD hotspot_angle; 	  /*!< DXF 50 */
4616   BITCODE_BD falloff_angle; 	  /*!< DXF 51, with type=spot */
4617   BITCODE_B cast_shadows;   	  /*!< DXF 293 */
4618   BITCODE_BL shadow_type;   	  /*!< DXF 73, ray_traced=0, shadow_maps=1 */
4619   BITCODE_BS shadow_map_size;     /*!< DXF 91 in pixel: 64,128,256,...4096 */
4620   BITCODE_RC shadow_map_softness; /*!< DXF 280 1-10 (num pixels blend into) */
4621 
4622   BITCODE_B is_photometric;       /* if LIGHTINGUNITS == "2" */
4623   BITCODE_B has_photometric_data;
4624   BITCODE_B has_webfile;          /*!< DXF 290 */
4625   BITCODE_T webfile;              /*!< DXF 300 IES file */
4626   BITCODE_BS physical_intensity_method; /*!< DXF 70 */
4627   BITCODE_BD physical_intensity;  /*!< DXF 40 */
4628   BITCODE_BD illuminance_dist;    /*!< DXF 41 */
4629   BITCODE_BS lamp_color_type;     /*!< DXF 71 0: in kelvin, 1: as preset */
4630   BITCODE_BD lamp_color_temp;     /*!< DXF 42 Temperature in Kelvin */
4631   BITCODE_BS lamp_color_preset;   /*!< DXF 72 */
4632   BITCODE_BL lamp_color_rgb;      /*!< if lamp_color_preset is Custom */
4633   BITCODE_3BD web_rotation;       /*!< DXF 43-45 rotation offset in XYZ Euler angles */
4634   BITCODE_BS extlight_shape;      /*!< DXF 73: 0 linear, 1 rect, 2 disk, 3 cylinder, 4 sphere */
4635   BITCODE_BD extlight_length;     /*!< DXF 46 */
4636   BITCODE_BD extlight_width;      /*!< DXF 47 */
4637   BITCODE_BD extlight_radius;     /*!< DXF 48 */
4638   BITCODE_BS webfile_type;        /*!< DXF 74 */
4639   BITCODE_BS web_symetry;         /*!< DXF 75 */
4640   BITCODE_BS has_target_grip;     /*!< DXF 76
4641                                        if the light displays a target grip for orienting
4642                                        the light */
4643   BITCODE_BD web_flux;        /*!< DXF 49 */
4644   BITCODE_BD web_angle1;      /*!< DXF 50 */
4645   BITCODE_BD web_angle2;      /*!< DXF 51 */
4646   BITCODE_BD web_angle3;      /*!< DXF 52 */
4647   BITCODE_BD web_angle4;      /*!< DXF 53 */
4648   BITCODE_BD web_angle5;      /*!< DXF 54 */
4649   BITCODE_BS glyph_display_type;  /*!< DXF 77 0:auto, 1:on, 2:off */
4650 } Dwg_Entity_LIGHT;
4651 
4652 /**
4653  Entity CAMERA (varies) UNKNOWN FIELDS
4654  not DWG persistent. yet unsorted, and unused.
4655  */
4656 typedef struct _dwg_entity_CAMERA
4657 {
4658   struct _dwg_object_entity *parent;
4659   BITCODE_H view;
4660 } Dwg_Entity_CAMERA;
4661 
4662 /**
4663  Entity GEOPOSITIONMARKER (varies)
4664 */
4665 typedef struct _dwg_entity_GEOPOSITIONMARKER
4666 {
4667   struct _dwg_object_entity *parent;
4668   BITCODE_BS class_version; /*!< DXF 90 point, lat_lon, mylocation */
4669   BITCODE_3BD position;     /*!< DXF 10 */
4670   BITCODE_BD radius;        /*!< DXF 40 */
4671   BITCODE_BD landing_gap;   /*!< DXF 40 */
4672   BITCODE_T notes;          /*!< DXF 1 */
4673   BITCODE_RC text_alignment;   /*!< DXF 70  0 left, 1 center, 2 right */
4674   BITCODE_B mtext_visible;     /*!< DXF 290 */
4675   BITCODE_B enable_frame_text; /*!< DXF 290 */
4676   struct _dwg_object *mtext;
4677 } Dwg_Entity_GEOPOSITIONMARKER;
4678 
4679 /**
4680  Object GEOMAPIMAGE (varies), LiveMap image overlay.
4681  yet unsorted, and unused.
4682 */
4683 typedef struct _dwg_object_GEOMAPIMAGE
4684 {
4685   struct _dwg_object_object *parent;
4686   BITCODE_BL class_version; // 90
4687   BITCODE_3BD pt0; // 10
4688   BITCODE_2RD size; // 13
4689   BITCODE_BS display_props; // 70
4690   BITCODE_B clipping; // 280 i.e. clipping_enabled
4691   BITCODE_RC brightness; // 281
4692   BITCODE_RC contrast; // 282
4693   BITCODE_RC fade; // 283
4694   BITCODE_BD rotation;
4695   //?
4696   //BITCODE_3BD origin;
4697   BITCODE_BD image_width;
4698   BITCODE_BD image_height;
4699   BITCODE_T name;
4700   BITCODE_BD image_file;
4701   BITCODE_BD image_visibility;
4702   BITCODE_BS transparency;
4703   BITCODE_BD height;
4704   BITCODE_BD width;
4705   BITCODE_B show_rotation;
4706   BITCODE_BD scale_factor;
4707   BITCODE_BS geoimage_brightness;
4708   BITCODE_BS geoimage_contrast;
4709   BITCODE_BS geoimage_fade;
4710   BITCODE_BS geoimage_position;
4711   BITCODE_BS geoimage_width;
4712   BITCODE_BS geoimage_height;
4713 } Dwg_Object_GEOMAPIMAGE;
4714 
4715 /**
4716  Entity HELIX (varies) UNSTABLE
4717  subclass of SPLINE
4718 */
4719 typedef struct _dwg_entity_HELIX
4720 {
4721   struct _dwg_object_entity *parent;
4722 
4723   // AcDbSpline
4724   BITCODE_BS flag; /* computed */
4725   BITCODE_BS scenario; /* 1 spline, 2 bezier */
4726   BITCODE_BS degree;
4727   BITCODE_BL splineflags1; /* 2013+: method fit points = 1, CV frame show = 2, closed = 4 */
4728   BITCODE_BL knotparam;    /* 2013+: Chord = 0, Square root = 1, Uniform = 2, Custom = 15 */
4729   BITCODE_BD fit_tol;
4730   BITCODE_3BD beg_tan_vec;
4731   BITCODE_3BD end_tan_vec;
4732   BITCODE_B rational;
4733   BITCODE_B closed_b;
4734   BITCODE_B periodic;
4735   BITCODE_B weighted; /* bit 4 of 70 */
4736   BITCODE_BD knot_tol;
4737   BITCODE_BD ctrl_tol;
4738   BITCODE_BS num_fit_pts;
4739   BITCODE_3DPOINT* fit_pts;
4740   BITCODE_BL num_knots;
4741   BITCODE_BD* knots;
4742   BITCODE_BL num_ctrl_pts;
4743   Dwg_SPLINE_control_point* ctrl_pts;
4744   // AcDbHelix
4745   BITCODE_BL major_version; /*!< DXF 90: 27 */
4746   BITCODE_BL maint_version; /*!< DXF 91: 1 */
4747   BITCODE_3BD axis_base_pt; /*!< DXF 10 */
4748   BITCODE_3BD start_pt;     /*!< DXF 11 */
4749   BITCODE_3BD axis_vector;  /*!< DXF 12 */
4750   BITCODE_BD radius;        /*!< DXF 40 */
4751   BITCODE_BD turns;         /*!< DXF 41 */
4752   BITCODE_BD turn_height;   /*!< DXF 42 */
4753   BITCODE_B handedness;       /*!< DXF 290: 0: left, 1: right (twist) */
4754   BITCODE_RC constraint_type; /*!< DXF 280: 0: turn_height, 1: turns, 2: height */
4755 
4756 } Dwg_Entity_HELIX;
4757 
4758 // TODO ACSH_SWEEP_CLASS has different names,
4759 // ACIS (sweep:options) even more so. ACIS key names are weird though, Acad didnt take them.
4760 #define SWEEPOPTIONS_fields  \
4761   BITCODE_BD draft_angle;   	   /*!< DXF 42 */ \
4762   BITCODE_BD draft_start_distance; /*!< DXF 43 */ \
4763   BITCODE_BD draft_end_distance;   /*!< DXF 44 */ \
4764   BITCODE_BD twist_angle;   	   /*!< DXF 45 */ \
4765   BITCODE_BD scale_factor;  /*!< DXF 48 */ \
4766   BITCODE_BD align_angle;   /*!< DXF 49 */ \
4767   BITCODE_BD* sweep_entity_transmatrix; /*!< DXF 46: 16x BD */ \
4768   BITCODE_BD* path_entity_transmatrix;  /*!< DXF 47: 16x BD */ \
4769   BITCODE_B is_solid;          /*!< DXF 290 */ \
4770   BITCODE_BS sweep_alignment_flags; /*!< DXF 70. \
4771                                       0=No alignment, 1=Align sweep entity to path, \
4772                                       2=Translate sweep entity to path, \
4773                                       3=Translate path to sweep entity */ \
4774   BITCODE_BS path_flags; /*!< DXF 71 */                                 \
4775   BITCODE_B align_start;                        /*!< DXF 292 */ \
4776   BITCODE_B bank;                               /*!< DXF 293 */ \
4777   BITCODE_B base_point_set;                     /*!< DXF 294 */ \
4778   BITCODE_B sweep_entity_transform_computed;    /*!< DXF 295 */ \
4779   BITCODE_B path_entity_transform_computed;     /*!< DXF 296 */ \
4780   BITCODE_3BD reference_vector_for_controlling_twist; /*!< DXF 11 */ \
4781   BITCODE_H sweep_entity; \
4782   BITCODE_H path_entity
4783 
4784 /**
4785  Entity EXTRUDEDSURFACE (varies)
4786  in DXF encrypted.
4787 */
4788 typedef struct _dwg_entity_EXTRUDEDSURFACE
4789 {
4790   struct _dwg_object_entity *parent;
4791   _3DSOLID_FIELDS;
4792   //? sweep_profile, taper_angle
4793   BITCODE_BS modeler_format_version; /*!< DXF 70 */
4794   BITCODE_BL bindata_size; // 90
4795   BITCODE_TF bindata; // 310|1
4796   BITCODE_BS u_isolines;        /*!< DXF 71 */
4797   BITCODE_BS v_isolines;        /*!< DXF 72 */
4798   BITCODE_BL class_version; 	/*!< DXF 90 */
4799   SWEEPOPTIONS_fields;
4800   //BITCODE_BD height;
4801   BITCODE_3BD sweep_vector; 	 /*!< DXF 10 */
4802   BITCODE_BD* sweep_transmatrix; /*!< DXF 40: 16x BD */
4803 } Dwg_Entity_EXTRUDEDSURFACE;
4804 
4805 /**
4806  Entity SWEPTSURFACE (varies)
4807 */
4808 typedef struct _dwg_entity_SWEPTSURFACE
4809 {
4810   struct _dwg_object_entity *parent;
4811   _3DSOLID_FIELDS;
4812   BITCODE_BS modeler_format_version; /*!< DXF 70 */
4813   BITCODE_BS u_isolines;         /*!< DXF 71 */
4814   BITCODE_BS v_isolines;         /*!< DXF 72 */
4815   BITCODE_BL class_version; /*!< DXF 90 */
4816 
4817   BITCODE_BL sweep_entity_id; // 90
4818   BITCODE_BL sweepdata_size;
4819   BITCODE_TF sweepdata;
4820   BITCODE_BL path_entity_id;
4821   BITCODE_BL pathdata_size;
4822   BITCODE_TF pathdata;
4823   SWEEPOPTIONS_fields;
4824 } Dwg_Entity_SWEPTSURFACE;
4825 
4826 /**
4827  Entity LOFTEDSURFACE (varies)
4828 */
4829 typedef struct _dwg_entity_LOFTEDSURFACE
4830 {
4831   struct _dwg_object_entity *parent;
4832   _3DSOLID_FIELDS;
4833   BITCODE_BS modeler_format_version; /*!< DXF 70 */
4834   BITCODE_BS u_isolines;         /*!< DXF 71 */
4835   BITCODE_BS v_isolines;         /*!< DXF 72 */
4836   //BITCODE_BL class_version;      /*!< DXF 90 */
4837   BITCODE_BD* loft_entity_transmatrix; /*!< DXF 40: 16x BD */
4838   BITCODE_BL plane_normal_lofting_type; /*!< DXF 70 */
4839   BITCODE_BD start_draft_angle;     /*!< DXF 41 */
4840   BITCODE_BD end_draft_angle;       /*!< DXF 42 */
4841   BITCODE_BD start_draft_magnitude; /*!< DXF 43 */
4842   BITCODE_BD end_draft_magnitude;   /*!< DXF 44 */
4843   BITCODE_B arc_length_parameterization; // 290
4844   BITCODE_B no_twist; // 291
4845   BITCODE_B align_direction; // 292
4846   BITCODE_B simple_surfaces; // 293
4847   BITCODE_B closed_surfaces; // 294
4848   BITCODE_B solid; // 295
4849   BITCODE_B ruled_surface; // 296
4850   BITCODE_B virtual_guide; // 297
4851 
4852   BITCODE_BS num_cross_sections;
4853   BITCODE_BS num_guide_curves;
4854   BITCODE_H *cross_sections;
4855   BITCODE_H *guide_curves;
4856   BITCODE_H path_curve;
4857 } Dwg_Entity_LOFTEDSURFACE;
4858 
4859 /**
4860  Entity NURBSURFACE (varies)
4861 */
4862 typedef struct _dwg_entity_NURBSURFACE
4863 {
4864   struct _dwg_object_entity *parent;
4865   _3DSOLID_FIELDS;
4866   // AcDbSurface
4867   BITCODE_BS u_isolines;	/*!< DXF 71 */
4868   BITCODE_BS v_isolines;	/*!< DXF 72 */
4869   // AcDbNurbSurface
4870   BITCODE_BS short170;   	/* DXF 170 */
4871   BITCODE_B cv_hull_display;	/* DXF 290 */
4872   BITCODE_3BD uvec1;		/* DXF 10 */
4873   BITCODE_3BD vvec1;		/* DXF 11 */
4874   BITCODE_3BD uvec2;		/* DXF 12 */
4875   BITCODE_3BD vvec2;		/* DXF 13 */
4876 } Dwg_Entity_NURBSURFACE;
4877 
4878 /**
4879  Entity PLANESURFACE (varies)
4880 */
4881 typedef struct _dwg_entity_PLANESURFACE
4882 {
4883   struct _dwg_object_entity *parent;
4884   _3DSOLID_FIELDS;
4885   BITCODE_BS modeler_format_version; /*!< DXF 70 */
4886   BITCODE_BS u_isolines;         /*!< DXF 71 */
4887   BITCODE_BS v_isolines;         /*!< DXF 72 */
4888   BITCODE_BL class_version;      /*!< DXF 90 */
4889 
4890 } Dwg_Entity_PLANESURFACE;
4891 
4892 /**
4893  Entity REVOLVEDSURFACE (varies)
4894 */
4895 typedef struct _dwg_entity_REVOLVEDSURFACE
4896 {
4897   struct _dwg_object_entity *parent;
4898   _3DSOLID_FIELDS;
4899   BITCODE_BS modeler_format_version; /*!< DXF 70 */
4900   BITCODE_BS u_isolines;         /*!< DXF 71 */
4901   BITCODE_BS v_isolines;         /*!< DXF 72 */
4902   BITCODE_BL class_version; /*!< DXF 90 */
4903 
4904   BITCODE_BL id; // 90
4905   BITCODE_3BD axis_point; // 10
4906   BITCODE_3BD axis_vector; // 11
4907   BITCODE_BD revolve_angle; // 40
4908   BITCODE_BD start_angle; // 41
4909   BITCODE_BD* revolved_entity_transmatrix; // 42
4910   BITCODE_BD draft_angle; // 43
4911   BITCODE_BD draft_start_distance; // 44
4912   BITCODE_BD draft_end_distance; // 45
4913   BITCODE_BD twist_angle; // 46
4914   BITCODE_B solid; // 290
4915   BITCODE_B close_to_axis; // 291
4916 
4917 } Dwg_Entity_REVOLVEDSURFACE;
4918 
4919 /**
4920  Entity MESH (varies)
4921  Types: Sphere|Cylinder|Cone|Torus|Box|Wedge|Pyramid
4922 */
4923 typedef struct _dwg_MESH_edge
4924 {
4925   struct _dwg_entity_MESH *parent;
4926   BITCODE_BL idxfrom; // index from
4927   BITCODE_BL idxto; // index to
4928 } Dwg_MESH_edge;
4929 
4930 typedef struct _dwg_entity_MESH
4931 {
4932   struct _dwg_object_entity *parent;
4933   BITCODE_BS dlevel; 		/*!< DXF 71 (2) */
4934   BITCODE_B is_watertight; 	/*!< DXF 72 (0) */
4935   BITCODE_BL num_subdiv_vertex; /*!< DXF 91 (0) */
4936   BITCODE_3DPOINT* subdiv_vertex;/*!< DXF 10 ?? */
4937   BITCODE_BL num_vertex;  	/*!< DXF 92 (14) */
4938   BITCODE_3DPOINT* vertex; 	/*!< DXF 10 */
4939   BITCODE_BL num_faces;  	/*!< DXF 93 (30) */
4940   BITCODE_BL* faces;  	        /*!< DXF 90 */
4941   BITCODE_BL num_edges;  	/*!< DXF 94 (19) */
4942   Dwg_MESH_edge* edges;   	/*!< DXF 90 */
4943   BITCODE_BL num_crease;  	/*!< DXF 95 (19) */
4944   BITCODE_BD* crease;   	/*!< DXF 140 */
4945 } Dwg_Entity_MESH;
4946 
4947 /**
4948  Object SUN (varies), unstable
4949  wrongly documented by ACAD DXF as entity
4950  */
4951 typedef struct _dwg_object_SUN
4952 {
4953   struct _dwg_object_object *parent;
4954 
4955   BITCODE_BL class_version; /*!< DXF 90 */
4956   BITCODE_B is_on;          /*!< DXF 290 */
4957   BITCODE_CMC color;        /*!< DXF 60, 421 */
4958   BITCODE_BD intensity;     /*!< DXF 40 */
4959   BITCODE_B  has_shadow;    /*!< DXF 291 */
4960   BITCODE_BL julian_day;    /*!< DXF 91 */
4961   BITCODE_BL msecs;         /*!< DXF 92 */
4962   BITCODE_B  is_dst;        /*!< DXF 292 */
4963   BITCODE_BL shadow_type;   /*!< DXF 70 */
4964   BITCODE_BS shadow_mapsize;  /*!< DXF 71 */
4965   BITCODE_RC shadow_softness; /*!< DXF 280 */
4966 } Dwg_Object_SUN;
4967 
4968 typedef struct _dwg_SUNSTUDY_Dates
4969 {
4970   BITCODE_BL julian_day;
4971   BITCODE_BL msecs;           //seconds past midnight
4972 } Dwg_SUNSTUDY_Dates;
4973 
4974 /**
4975  Object SUNSTUDY (varies)
4976  --enable-debug only
4977  */
4978 typedef struct _dwg_object_SUNSTUDY
4979 {
4980   struct _dwg_object_object *parent;
4981 
4982   BITCODE_BL class_version;     /*!< DXF 90 */
4983   BITCODE_T setup_name;         /*!< DXF 1 */
4984   BITCODE_T description;        /*!< DXF 2 */
4985   BITCODE_BL output_type;       /*!< DXF 70 */
4986   BITCODE_T sheet_set_name;     /*!< DXF 3 */
4987   BITCODE_B use_subset;         /*!< DXF 290 */
4988   BITCODE_T sheet_subset_name;  /*!< DXF 3 */
4989   BITCODE_B select_dates_from_calendar; /*!< DXF 291 */
4990   BITCODE_BL num_dates;         /*!< DXF 91 */
4991   Dwg_SUNSTUDY_Dates* dates;    /*!< DXF 90[] */
4992   BITCODE_B select_range_of_dates; /*!< DXF 292 */
4993   BITCODE_BL start_time;        /*!< DXF 93 */
4994   BITCODE_BL end_time;          /*!< DXF 94 */
4995   BITCODE_BL interval;          /*!< DXF 95 */
4996   BITCODE_BL num_hours;         /*!< DXF 73 */
4997   BITCODE_B* hours;             /*!< DXF 290 */
4998   BITCODE_BL shade_plot_type;   /*!< DXF 74 */
4999   BITCODE_BL numvports;         /*!< DXF 75 */
5000   BITCODE_BL numrows;           /*!< DXF 76 */
5001   BITCODE_BL numcols;           /*!< DXF 77 */
5002   BITCODE_BD spacing;           /*!< DXF 40 */
5003   BITCODE_B  lock_viewports;    /*!< DXF 293 */
5004   BITCODE_B  label_viewports;   /*!< DXF 294 */
5005 
5006   BITCODE_H  page_setup_wizard; /*!< 5 DXF 340 */
5007   BITCODE_H  view;              /*!< DXF 341 */
5008   BITCODE_H  visualstyle;       /*!< DXF 342 */
5009   BITCODE_H  text_style;        /*!< DXF 343 */
5010 } Dwg_Object_SUNSTUDY;
5011 
5012 typedef struct _dwg_DATATABLE_row
5013 {
5014   struct _dwg_DATATABLE_column *parent;
5015   Dwg_TABLE_value value;
5016 } Dwg_DATATABLE_row;
5017 
5018 typedef struct _dwg_DATATABLE_column
5019 {
5020   struct _dwg_object_DATATABLE *parent;
5021   BITCODE_BL type;          /* DXF 92 */
5022   BITCODE_T  text;          /* DXF 2 */
5023   Dwg_DATATABLE_row *rows;
5024 } Dwg_DATATABLE_column;
5025 
5026 /**
5027  Object DATATABLE (varies)
5028  --enable-debug only
5029  */
5030 typedef struct _dwg_object_DATATABLE
5031 {
5032   struct _dwg_object_object *parent;
5033   BITCODE_BS flags;	/* DXF 70 */
5034   BITCODE_BL num_cols;	/* DXF 90 */
5035   BITCODE_BL num_rows;	/* DXF 91 */
5036   BITCODE_T table_name;	/* DXF 1 */
5037   Dwg_DATATABLE_column *cols;
5038 } Dwg_Object_DATATABLE;
5039 
5040 /**
5041  Object DATALINK (varies)
5042  */
5043 typedef struct _dwg_DATALINK_customdata
5044 {
5045   struct _dwg_object_DATALINK *parent;
5046   BITCODE_H target; // 330
5047   BITCODE_T text;   // 304
5048 } Dwg_DATALINK_customdata;
5049 
5050 typedef struct _dwg_object_DATALINK
5051 {
5052   struct _dwg_object_object *parent;
5053   BITCODE_BS class_version; /*<! DXF 70 1 */
5054   BITCODE_T data_adapter;/*<! DXF 1  */
5055   BITCODE_T description;/*<! DXF 300  */
5056   BITCODE_T tooltip;	/*<! DXF 301  */
5057   BITCODE_T connection_string;	/*<! DXF 302  */
5058   BITCODE_BL option;	/*<! DXF 90  2 */
5059   BITCODE_BL update_option;/*<! DXF 91  1179649 */
5060   BITCODE_BL bl92;	/*<! DXF 92  1 */
5061   BITCODE_BS year;	/*<! DXF 170  */
5062   BITCODE_BS month;	/*<! DXF 171  */
5063   BITCODE_BS day;	/*<! DXF 172  */
5064   BITCODE_BS hour;	/*<! DXF 173  */
5065   BITCODE_BS minute;	/*<! DXF 174  */
5066   BITCODE_BS seconds;	/*<! DXF 175  */
5067   BITCODE_BS msec;	/*<! DXF 176  */
5068   BITCODE_BS path_option; /*<! DXF 177  1 */
5069   BITCODE_BL bl93;	  /*<! DXF 93   0 */
5070   BITCODE_T update_status;/*<! DXF 304  */
5071   BITCODE_BL num_customdata; // 94
5072   Dwg_DATALINK_customdata *customdata; // 330 + 304
5073   BITCODE_H hardowner;	/*<! DXF 360  */
5074 } Dwg_Object_DATALINK;
5075 
5076 /**
5077  Object DIMASSOC (varies) DEBUGGING
5078  --enable-debug only
5079  */
5080 typedef struct _dwg_DIMASSOC_Ref
5081 {
5082   struct _dwg_object_DIMASSOC *parent;
5083   BITCODE_T classname;         /*!< DXF 1 constant */
5084   BITCODE_RC osnap_type;       /*!< DXF 72 */
5085   BITCODE_BD osnap_dist;       /*!< DXF 40 */
5086   BITCODE_3BD osnap_pt;        /*!< DXF 10-30 */
5087   BITCODE_BS num_xrefs;
5088   BITCODE_H *xrefs;            /*!< DXF 331 the geometry objects, 1 or 2 */
5089   BITCODE_BS main_subent_type; /*!< DXF 73 */
5090   BITCODE_BL main_gsmarker;    /*!< DXF 91 */
5091   BITCODE_BS num_xrefpaths;
5092   BITCODE_T *xrefpaths;        /*!< DXF 301 */
5093   BITCODE_B  has_lastpt_ref;   /*!< DXF 75 */
5094   BITCODE_3BD lastpt_ref;      /*!< DXF ?? */
5095   BITCODE_BL num_intsectobj;   /*!< DXF 74 */
5096   BITCODE_H* intsectobj;       /*!< DXF 332 the intersection objects, 1 or 2 */
5097 } Dwg_DIMASSOC_Ref;
5098 
5099 typedef struct _dwg_object_DIMASSOC
5100 {
5101   struct _dwg_object_object *parent;
5102   BITCODE_H dimensionobj;
5103   BITCODE_BL associativity;   /*!< DXF 90, bitmask 0-15*/
5104   BITCODE_B trans_space_flag; /*!< DXF 70 boolean */
5105   BITCODE_RC rotated_type;      /*!< DXF 71 */
5106   Dwg_DIMASSOC_Ref *ref;       /* 1-4x, with possible holes,
5107                                   depend. on associativity bitmask */
5108 } Dwg_Object_DIMASSOC;
5109 
5110 typedef struct _dwg_ACTIONBODY
5111 {
5112   struct _dwg_object_ASSOCNETWORK *parent;
5113   BITCODE_T  evaluatorid;
5114   BITCODE_T  expression;
5115   BITCODE_BL value; //resbuf
5116 } Dwg_ACTIONBODY;
5117 
5118 typedef struct _dwg_EvalVariant
5119 {
5120   BITCODE_BS code; /* the DXF code */
5121   union {
5122     BITCODE_BD bd;
5123     BITCODE_BL bl;
5124     BITCODE_BS bs;
5125     BITCODE_RC rc;
5126     BITCODE_T text;
5127     BITCODE_H handle;
5128   } u;
5129 } Dwg_EvalVariant;
5130 
5131 typedef struct _dwg_VALUEPARAM_vars
5132 {
5133   //struct _dwg_VALUEPARAM *parent;
5134   Dwg_EvalVariant value;
5135   BITCODE_H handle;
5136 } Dwg_VALUEPARAM_vars;
5137 
5138 /* AcDbAssocParamBasedActionBody */
5139 typedef struct _dwg_ASSOCPARAMBASEDACTIONBODY
5140 {
5141   struct _dwg_object_object *parent;
5142   BITCODE_BL version;    /* 90 0 */
5143   BITCODE_BL minor;      /* 90 0 */
5144   BITCODE_BL num_deps;   /* 90 1 */
5145   BITCODE_H *deps;       /* 360 */
5146   BITCODE_BL l4;         /* 90: 0 */
5147   BITCODE_BL l5;         /* 90 */
5148   BITCODE_H  assocdep;   /* 330 */
5149   BITCODE_BL num_values; /* 90 */
5150   struct _dwg_VALUEPARAM *values;
5151 } Dwg_ASSOCPARAMBASEDACTIONBODY;
5152 
5153 typedef struct _dwg_ASSOCACTION_Deps
5154 {
5155   struct _dwg_object_ASSOCACTION *parent;
5156   BITCODE_B is_owned; // with AssocNewtwork means code 3 (hardowned) or 4 (softptr)
5157   BITCODE_H dep;
5158 } Dwg_ASSOCACTION_Deps;
5159 
5160 #define ASSOCACTION_fields                                  \
5161   /* until r2010: 1, 2013+: 2 */                            \
5162   BITCODE_BS class_version;   /* 90 */                      \
5163   /* 0 WellDefined, 1 UnderConstrained, 2 OverConstrained,  \
5164      3 Inconsistent, 4 NotEvaluated, 5 NotAvailable,        \
5165      6 RejectedByClient */                                  \
5166   BITCODE_BL geometry_status;         /* 90 */              \
5167   BITCODE_H owningnetwork;            /* 330 */             \
5168   BITCODE_H actionbody;               /* 360 */             \
5169   BITCODE_BL action_index;            /* 90 */              \
5170   BITCODE_BL max_assoc_dep_index;     /* 90 */              \
5171   BITCODE_BL num_deps;                /* 90 */              \
5172   Dwg_ASSOCACTION_Deps *deps;         /* 330 or 360 */      \
5173   BITCODE_BL num_owned_params;        /* 90 */              \
5174   BITCODE_H *owned_params;            /* 360 */             \
5175   BITCODE_BL num_values;              /* 90 */              \
5176   struct _dwg_VALUEPARAM *values
5177 
5178 // AcDbAssocDependency
5179 typedef struct _dwg_object_ASSOCDEPENDENCY
5180 {
5181   struct _dwg_object_object *parent;
5182   BITCODE_BS class_version;			/*<! DXF 90 */
5183   BITCODE_BL status;				/*<! DXF 90 */
5184   BITCODE_B is_read_dep;			/*<! DXF 290 */
5185   BITCODE_B is_write_dep;			/*<! DXF 290 */
5186   BITCODE_B is_attached_to_object;		/*<! DXF 290 */
5187   BITCODE_B is_delegating_to_owning_action;	/*<! DXF 290 */
5188   BITCODE_BLd order;				/*<! DXF 90 */
5189   BITCODE_H dep_on;				/*<! DXF 330 */
5190   BITCODE_B has_name;				/*<! DXF 290 */
5191   BITCODE_T name;				/*<! DXF 1 */
5192   BITCODE_BLd depbodyid;			/*<! DXF 90 */
5193   BITCODE_H  readdep; 				/*<! DXF 330 */
5194   BITCODE_H  dep_body;  			/*<! DXF 360 */
5195   BITCODE_H  node; 				/*<! DXF 330 */
5196 } Dwg_Object_ASSOCDEPENDENCY;
5197 
5198 #define ASSOCPERSSUBENTID_fields                \
5199   BITCODE_T classname; /* DXF  1 */             \
5200   BITCODE_B dependent_on_compound_object /* DXF 290 */
5201 
5202 #define ASSOCEDGEPERSSUBENTID_fields            \
5203   BITCODE_T classname; /* DXF  1 */             \
5204   BITCODE_B has_classname;                      \
5205   BITCODE_BL bl1;                               \
5206   BITCODE_BS class_version;                     \
5207   BITCODE_BL index1;                            \
5208   BITCODE_BL index2;                            \
5209   BITCODE_B dependent_on_compound_object /* DXF 290 */
5210 
5211 #define ASSOCINDEXPERSSUBENTID_fields            \
5212   BITCODE_T classname; /* DXF  1 */             \
5213   BITCODE_B has_classname;                      \
5214   BITCODE_BL bl1;                               \
5215   BITCODE_BS class_version;                     \
5216   BITCODE_BL subent_type;                       \
5217   BITCODE_BL subent_index;                      \
5218   BITCODE_B dependent_on_compound_object /* DXF 290 */
5219 
5220 typedef struct _dwg_object_ASSOCVALUEDEPENDENCY
5221 {
5222   struct _dwg_object_object *parent;
5223   Dwg_Object_ASSOCDEPENDENCY assocdep;
5224 } Dwg_Object_ASSOCVALUEDEPENDENCY;
5225 
5226 // stable
5227 typedef struct _dwg_object_ASSOCGEOMDEPENDENCY
5228 {
5229   struct _dwg_object_object *parent;
5230   Dwg_Object_ASSOCDEPENDENCY assocdep;
5231   // AcDbAssocGeomDependency
5232   BITCODE_BS class_version;	/*<! DXF 90 0 */
5233   BITCODE_B enabled;		/*<! DXF 290 1 */
5234   ASSOCPERSSUBENTID_fields;
5235 } Dwg_Object_ASSOCGEOMDEPENDENCY;
5236 
5237 typedef struct _dwg_object_ASSOCACTION
5238 {
5239   struct _dwg_object_object *parent;
5240   ASSOCACTION_fields;
5241 } Dwg_Object_ASSOCACTION;
5242 
5243 /**
5244  Object ASSOCNETWORK (varies)
5245  subclass of AcDbAssocAction
5246  Object1 --ReadDep--> Action1 --WriteDep1--> Object2 --ReadDep--> Action2 ...
5247  extdict: ACAD_ASSOCNETWORK
5248  */
5249 typedef struct _dwg_object_ASSOCNETWORK
5250 {
5251   struct _dwg_object_object *parent;
5252   ASSOCACTION_fields;
5253   BITCODE_BS network_version;       // DXF 90, always 0
5254   BITCODE_BL network_action_index;  // 90
5255   BITCODE_BL num_actions;           // 90
5256   Dwg_ASSOCACTION_Deps *actions;    // 330 or 360
5257   BITCODE_BL num_owned_actions;
5258   BITCODE_H *owned_actions;         // 4. 330
5259 } Dwg_Object_ASSOCNETWORK;
5260 
5261 /*  BITCODE_BS status;90: 0 uptodate, 1 changed_directly, 2 changed_transitive,
5262                           3 ChangedNoDifference, 4 FailedToEvaluate, 5 Erased, 6 Suppressed
5263                           7 Unresolved */
5264 #define ASSOCACTIONPARAM_fields        \
5265   BITCODE_BS is_r2013;                 \
5266   BITCODE_BL aap_version; /* DXF 90 */ \
5267   BITCODE_T  name         /* DXF 1 */
5268 
5269 #define ASSOCACTIONBODY_fields         \
5270   BITCODE_BL aab_version /* DXF 90. r2013+: 2, earlier 1 */
5271 
5272 /* Constraints still in work: */
5273 typedef struct _dwg_CONSTRAINTGROUPNODE
5274 {
5275   struct _dwg_object_ASSOC2DCONSTRAINTGROUP *parent;
5276   BITCODE_BL nodeid;
5277   BITCODE_RC status;
5278   BITCODE_BL num_connections;
5279   BITCODE_BL *connections;
5280 } Dwg_CONSTRAINTGROUPNODE;
5281 
5282 #define ACGEOMCONSTRAINT_fields                 \
5283   Dwg_CONSTRAINTGROUPNODE node;                 \
5284   BITCODE_BL ownerid; /* DXF 90 */              \
5285   BITCODE_B is_implied; /* DXF 290 */           \
5286   BITCODE_B is_active; /* DXF 290 */
5287 
5288 #define ACCONSTRAINTGEOMETRY_fields(node)      \
5289   Dwg_CONSTRAINTGROUPNODE node;                \
5290   BITCODE_H geom_dep; /* 4, 330 */             \
5291   BITCODE_BL nodeid   /*  90 */
5292 
5293 #define ACCONSTRAINTPOINT_fields(node)         \
5294   ACCONSTRAINTGEOMETRY_fields (node);          \
5295   SUBCLASS (AcConstraintPoint);                \
5296   BITCODE_3BD point /* 10 */
5297 
5298 #define ACCONSTRAINTIMPLICITPOINT_fields(node) \
5299   ACCONSTRAINTPOINT_fields (node);             \
5300   /*SUBCLASS (AcConstraintImplicitPoint);*/    \
5301   BITCODE_RC point_type; /* 280 */             \
5302   BITCODE_BLd point_idx; /* 90 default: -1 */  \
5303   BITCODE_BLd curve_id   /* 90 default: 0 */
5304 
5305 #define ACEXPLICITCONSTRAINT_fields            \
5306   ACGEOMCONSTRAINT_fields;                     \
5307   BITCODE_H value_dep; /* 3, 340 */            \
5308   BITCODE_H dim_dep    /* 3, 340 */
5309 
5310 #define ACANGLECONSTRAINT_fields                \
5311   ACEXPLICITCONSTRAINT_fields;                  \
5312   BITCODE_RC sector_type  /* 280 */
5313 
5314 #define ACPARALLELCONSTRAINT_fields             \
5315   ACGEOMCONSTRAINT_fields;                      \
5316   BITCODE_BLd datum_line_idx  /* 90 */
5317 
5318 #define ACDISTANCECONSTRAINT_fields              \
5319   ACEXPLICITCONSTRAINT_fields;                   \
5320   BITCODE_RC dir_type; /* 280 if has_distance */ \
5321   BITCODE_3BD distance /* 10 */
5322 
5323 #define ACCONSTRAINEDELLIPSE_fields              \
5324   ACGEOMCONSTRAINT_fields;                       \
5325   BITCODE_3BD center;   /* 10 */                 \
5326   BITCODE_3BD sm_axis;  /* 11 */                 \
5327   BITCODE_BD axis_ratio /* 40 i.e RadiusRatio */
5328 
5329 #define ACCONSTRAINEDBOUNDEDELLIPSE_fields       \
5330   ACCONSTRAINEDELLIPSE_fields;                   \
5331   BITCODE_3BD start_pt;   /* 10 */               \
5332   BITCODE_3BD end_pt      /* 11 */
5333 
5334 typedef struct _dwg_object_ASSOC2DCONSTRAINTGROUP
5335 {
5336   struct _dwg_object_object *parent;
5337   ASSOCACTION_fields;
5338 
5339   BITCODE_BL version; // 90 1
5340   BITCODE_B  b1;      // 70 0
5341   BITCODE_3BD workplane[3]; // 3x10 workplane
5342   BITCODE_H h1; // 360
5343   BITCODE_BL num_actions;// 90
5344   BITCODE_H* actions;    // 360
5345   BITCODE_BL num_nodes;  // 90 9
5346   Dwg_CONSTRAINTGROUPNODE *nodes;
5347 } Dwg_Object_ASSOC2DCONSTRAINTGROUP;
5348 
5349 typedef struct _dwg_object_ASSOCVARIABLE
5350 {
5351   struct _dwg_object_object *parent;
5352   BITCODE_BS av_class_version;
5353   ASSOCACTION_fields;
5354   BITCODE_T name;
5355   BITCODE_T t58;
5356   BITCODE_T evaluator;
5357   BITCODE_T desc;
5358   Dwg_EvalVariant value;
5359   BITCODE_B has_t78;
5360   BITCODE_T t78;
5361   BITCODE_B b290;
5362 } Dwg_Object_ASSOCVARIABLE;
5363 
5364 typedef struct _dwg_VALUEPARAM
5365 {
5366   struct _dwg_object_object *parent;
5367   BITCODE_BL class_version; /* 0 */
5368   BITCODE_T name;
5369   BITCODE_BL unit_type;
5370   BITCODE_BL num_vars; // input vars
5371   Dwg_VALUEPARAM_vars *vars;
5372   BITCODE_H controlled_objdep;
5373 } Dwg_VALUEPARAM;
5374 
5375 // NodeInfo
5376 typedef struct _dwg_EVAL_Node
5377 {
5378   struct _dwg_object_EVALUATION_GRAPH *parent;
5379   BITCODE_BL  id;         /* 91 */
5380   BITCODE_BL  edge_flags; // 93, always 32
5381   BITCODE_BLd nextid;     // 95
5382   BITCODE_H   evalexpr;   // 360
5383   BITCODE_BLd node[4];    // 4x 92, def: 4x -1
5384   BITCODE_B   active_cycles;
5385 } Dwg_EVAL_Node;
5386 
5387 // EdgeInfo
5388 typedef struct _dwg_EVAL_Edge
5389 {
5390   struct _dwg_object_EVALUATION_GRAPH *parent;
5391   BITCODE_BL  id;         /* 92 */
5392   BITCODE_BLd nextid;     /* 93 */
5393   BITCODE_BLd e1;         /* 94 */
5394   BITCODE_BLd e2;         /* 91 */
5395   BITCODE_BLd e3;         /* 91 */
5396   BITCODE_BLd out_edge[5]; /* 5x 92 */
5397 } Dwg_EVAL_Edge;
5398 
5399 typedef struct _dwg_object_EVALUATION_GRAPH
5400 {
5401   struct _dwg_object_object *parent;
5402   BITCODE_BL major;
5403   BITCODE_BL minor;
5404   BITCODE_BLd first_nodeid;      // 96
5405   BITCODE_BLd first_nodeid_copy; // 97
5406   BITCODE_BL num_nodes;
5407   Dwg_EVAL_Node *nodes;
5408   BITCODE_B has_graph;
5409   BITCODE_BL num_edges;
5410   Dwg_EVAL_Edge *edges;
5411 } Dwg_Object_EVALUATION_GRAPH;
5412 
5413 // stable
5414 typedef struct _dwg_object_DYNAMICBLOCKPURGEPREVENTER
5415 {
5416   struct _dwg_object_object *parent;
5417   BITCODE_BS flag;         /*!< DXF 70 0 */
5418   BITCODE_H  block;
5419 } Dwg_Object_DYNAMICBLOCKPURGEPREVENTER;
5420 
5421 typedef struct _dwg_object_PERSUBENTMGR
5422 {
5423   struct _dwg_object_object *parent;
5424   BITCODE_BL class_version;   /*!< DXF 90 2 */
5425   BITCODE_BL unknown_0;       /*!< DXF 90 0 */
5426   BITCODE_BL unknown_2;       /*!< DXF 90 2 */
5427   BITCODE_BL numassocsteps;   /*!< DXF 90 3 from ASSOCPERSSUBENTMANAGER */
5428   BITCODE_BL numassocsubents; /*!< DXF 90 0 from ASSOCPERSSUBENTMANAGER */
5429   BITCODE_BL num_steps;       /*!< DXF 90 1 */
5430   BITCODE_BL *steps;          /*!< DXF 90 */
5431   BITCODE_BL num_subents;     /*!< DXF 90 */
5432   BITCODE_BL *subents;        /*!< DXF 90 types/handles? */
5433 } Dwg_Object_PERSUBENTMGR;
5434 
5435 // The dynamic variant of above. May be frozen as static PERSUBENTMGR
5436 // TODO subentities
5437 typedef struct _dwg_object_ASSOCPERSSUBENTMANAGER
5438 {
5439   struct _dwg_object_object *parent;
5440   BITCODE_BL class_version; /*!< DXF 90 1 or r2013+ 2 */
5441   BITCODE_BL unknown_3;     /*!< DXF 90 always 3 */
5442   BITCODE_BL unknown_0;     /*!< DXF 90 always 0 */
5443   BITCODE_BL unknown_2;     /*!< DXF 90 always 2 */
5444   BITCODE_BL num_steps;   /*!< DXF 90 3 */
5445   BITCODE_BL num_subents; /*!< DXF 90 5 */
5446   BITCODE_BL *steps;      /*!< DXF 90 */
5447   BITCODE_BL *subents;    /*!< FIXME: subent struct */
5448 
5449   BITCODE_BL unknown_bl6;   /*!< DXF 90 5 */
5450   BITCODE_BL unknown_bl6a;  /*!< DXF 90 0 */
5451   BITCODE_BL unknown_bl7a;  /*!< DXF 90 3 */
5452   BITCODE_BL unknown_bl7;   /*!< DXF 90 2 */
5453   BITCODE_BL unknown_bl8;   /*!< DXF 90 2 */
5454   BITCODE_BL unknown_bl9;   /*!< DXF 90 2 */
5455   BITCODE_BL unknown_bl10;  /*!< DXF 90 21 */
5456   BITCODE_BL unknown_bl11;  /*!< DXF 90 0 */
5457   BITCODE_BL unknown_bl12;  /*!< DXF 90 0 */
5458   BITCODE_BL unknown_bl13;  /*!< DXF 90 0 */
5459   BITCODE_BL unknown_bl14;  /*!< DXF 90 0 */
5460   BITCODE_BL unknown_bl15;  /*!< DXF 90 1 */
5461   BITCODE_BL unknown_bl16;  /*!< DXF 90 3 */
5462   BITCODE_BL unknown_bl17;  /*!< DXF 90 1 */
5463   BITCODE_BL unknown_bl18;  /*!< DXF 90 1000000000 */
5464   BITCODE_BL unknown_bl19;  /*!< DXF 90 1001 */
5465   BITCODE_BL unknown_bl20;  /*!< DXF 90 1 */
5466   BITCODE_BL unknown_bl21;  /*!< DXF 90 1000000000 */
5467   BITCODE_BL unknown_bl22;  /*!< DXF 90 51001 */
5468   BITCODE_BL unknown_bl23;  /*!< DXF 90 1 */
5469   BITCODE_BL unknown_bl24;  /*!< DXF 90 1000000000 */
5470   BITCODE_BL unknown_bl25;  /*!< DXF 90 351001 */
5471   BITCODE_BL unknown_bl26;  /*!< DXF 90 0 */
5472   BITCODE_BL unknown_bl27;  /*!< DXF 90 0 */
5473   BITCODE_BL unknown_bl28;  /*!< DXF 90 0 */
5474   BITCODE_BL unknown_bl29;  /*!< DXF 90 900 */
5475   BITCODE_BL unknown_bl30;  /*!< DXF 90 0 */
5476   BITCODE_BL unknown_bl31;  /*!< DXF 90 900 */
5477   BITCODE_BL unknown_bl32;  /*!< DXF 90 0 */
5478   BITCODE_BL unknown_bl33;  /*!< DXF 90 2 */
5479   BITCODE_BL unknown_bl34;  /*!< DXF 90 2 */
5480   BITCODE_BL unknown_bl35;  /*!< DXF 90 3 0100000011 */
5481   BITCODE_BL unknown_bl36;  /*!< DXF 90 0 */
5482   BITCODE_B  unknown_b37;   /*!< DXF 290 0 */
5483 } Dwg_Object_ASSOCPERSSUBENTMANAGER;
5484 
5485 
5486 
5487 #define ASSOCPARAMBASEDACTIONBODY_fields        \
5488   Dwg_ASSOCPARAMBASEDACTIONBODY pab
5489 
5490 #define ASSOCCOMPOUNDACTIONPARAM_fields \
5491   BITCODE_BS class_version; \
5492   BITCODE_BS bs1; \
5493   BITCODE_BL num_params; \
5494   BITCODE_H *params; \
5495   BITCODE_B has_child_param; \
5496   BITCODE_BS child_status; \
5497   BITCODE_BL child_id; \
5498   BITCODE_H child_param; \
5499   BITCODE_H h330_2; \
5500   BITCODE_BL bl2; \
5501   BITCODE_H h330_3
5502 
5503 typedef struct _dwg_object_ASSOCACTIONPARAM
5504 {
5505   struct _dwg_object_object *parent;
5506   ASSOCACTIONPARAM_fields;
5507 } Dwg_Object_ASSOCACTIONPARAM;
5508 
5509 /**
5510  Object ASSOCOSNAPPOINTREFACTIONPARAM (varies)
5511  Action parameter that owns other AcDbAssocActionParameters,
5512  allowing the representation of hierarchical structures of action parameters.
5513  */
5514 typedef struct _dwg_object_ASSOCOSNAPPOINTREFACTIONPARAM
5515 {
5516   struct _dwg_object_object *parent;
5517   ASSOCACTIONPARAM_fields;
5518   ASSOCCOMPOUNDACTIONPARAM_fields;
5519   BITCODE_BS status;
5520   BITCODE_RC osnap_mode;
5521   BITCODE_BD param; // 40 -1.0
5522 } Dwg_Object_ASSOCOSNAPPOINTREFACTIONPARAM;
5523 
5524 typedef struct _dwg_object_ASSOCPOINTREFACTIONPARAM
5525 {
5526   struct _dwg_object_object *parent;
5527   ASSOCACTIONPARAM_fields;
5528   ASSOCCOMPOUNDACTIONPARAM_fields;
5529 } Dwg_Object_ASSOCPOINTREFACTIONPARAM;
5530 
5531 typedef struct _dwg_object_ASSOCASMBODYACTIONPARAM
5532 {
5533   struct _dwg_object_object *parent;
5534   ASSOCACTIONPARAM_fields;
5535   /* AcDbAssocSingleDependencyActionParam */
5536   BITCODE_BL asdap_class_version; // 0
5537   BITCODE_H  dep;
5538   /* AcDbAssocAsmbodyActionParam */
5539   BITCODE_BL class_version;
5540   _3DSOLID_FIELDS;
5541 } Dwg_Object_ASSOCASMBODYACTIONPARAM;
5542 
5543 typedef struct _dwg_object_ASSOCCOMPOUNDACTIONPARAM
5544 {
5545   struct _dwg_object_object *parent;
5546   ASSOCACTIONPARAM_fields;
5547   ASSOCCOMPOUNDACTIONPARAM_fields;
5548 } Dwg_Object_ASSOCCOMPOUNDACTIONPARAM;
5549 
5550 typedef struct _dwg_object_ASSOCOBJECTACTIONPARAM
5551 {
5552   struct _dwg_object_object *parent;
5553   ASSOCACTIONPARAM_fields;
5554   /* AcDbAssocSingleDependencyActionParam */
5555   BITCODE_BL asdap_class_version; // 0
5556   BITCODE_H  dep;
5557   /* AcDbAssocObjectActionParam */
5558   BITCODE_BS class_version; /* DXF 90: 0 */
5559 } Dwg_Object_ASSOCOBJECTACTIONPARAM;
5560 
5561 typedef struct _dwg_object_ASSOCEDGEACTIONPARAM
5562 {
5563   struct _dwg_object_object *parent;
5564   ASSOCACTIONPARAM_fields;
5565   /* AcDbAssocSingleDependencyActionParam */
5566   BITCODE_BL asdap_class_version; // 0
5567   BITCODE_H  dep;
5568   /* AcDbAssocEdgeActionParam */
5569   BITCODE_BL class_version;
5570   BITCODE_H  param;
5571   BITCODE_B  has_action;
5572   BITCODE_BL action_type;
5573   BITCODE_H subent;
5574 } Dwg_Object_ASSOCEDGEACTIONPARAM;
5575 
5576 typedef struct _dwg_object_ASSOCFACEACTIONPARAM
5577 {
5578   struct _dwg_object_object *parent;
5579   ASSOCACTIONPARAM_fields;
5580   /* AcDbAssocSingleDependencyActionParam */
5581   BITCODE_BL asdap_class_version; // 0
5582   BITCODE_H dep;
5583   /* AcDbAssocFaceActionParam */
5584   BITCODE_BL class_version;
5585   BITCODE_BL index;
5586 } Dwg_Object_ASSOCFACEACTIONPARAM;
5587 
5588 typedef struct _dwg_object_ASSOCPATHACTIONPARAM
5589 {
5590   struct _dwg_object_object *parent;
5591   ASSOCACTIONPARAM_fields;
5592   ASSOCCOMPOUNDACTIONPARAM_fields;
5593   /* AcDbAssocPathActionParam */
5594   BITCODE_BL version;	/*!< DXF 90 */
5595 } Dwg_Object_ASSOCPATHACTIONPARAM;
5596 
5597 typedef struct _dwg_object_ASSOCVERTEXACTIONPARAM
5598 {
5599   struct _dwg_object_object *parent;
5600   ASSOCACTIONPARAM_fields;
5601   /* AcDbAssocSingleDependencyActionParam */
5602   BITCODE_BL asdap_class_version; // 0
5603   BITCODE_H dep;
5604   /* AcDbAssocFaceActionParam */
5605   BITCODE_BL class_version;
5606   BITCODE_3BD pt;
5607 } Dwg_Object_ASSOCVERTEXACTIONPARAM;
5608 
5609 // inlined
5610 typedef struct _dwg_ASSOCARRAYITEM
5611 {
5612   struct _dwg_abstractobject_ASSOCARRAYPARAMETERS *parent;
5613   BITCODE_BL class_version; // 0
5614   BITCODE_BL itemloc[3];
5615   BITCODE_BL flags; /* 2: has_relative_transform
5616                        16: has_h2
5617                      */
5618   int is_default_transmatrix; /* computed */
5619   BITCODE_3BD x_dir;         /* DXF 11 */
5620   BITCODE_BD *transmatrix;   /* 16x BD 40 */
5621   BITCODE_BD *rel_transform; /* 16x BD 40 */
5622   int has_h1; /* computed */
5623   BITCODE_H h1;
5624   BITCODE_H h2;
5625 } Dwg_ASSOCARRAYITEM;
5626 
5627 #define ASSOCARRAYPARAMETERS_fields                           \
5628   BITCODE_BL aap_version;                                     \
5629   BITCODE_BL num_items;                                       \
5630   BITCODE_T classname;                                        \
5631   Dwg_ASSOCARRAYITEM *items
5632 
5633 typedef struct _dwg_abstractobject_ASSOCARRAYPARAMETERS
5634 {
5635   struct _dwg_object_object *parent;
5636   ASSOCARRAYPARAMETERS_fields;
5637   BITCODE_BL numitems;
5638   BITCODE_BL numrows;
5639   BITCODE_BL numlevels;
5640 } Dwg_Object_ASSOCARRAYPARAMETERS;
5641 
5642 typedef struct _dwg_abstractobject_ASSOCARRAYPARAMETERS Dwg_Object_ASSOCARRAYMODIFYPARAMETERS;
5643 typedef struct _dwg_abstractobject_ASSOCARRAYPARAMETERS Dwg_Object_ASSOCARRAYPATHPARAMETERS;
5644 typedef struct _dwg_abstractobject_ASSOCARRAYPARAMETERS Dwg_Object_ASSOCARRAYPOLARPARAMETERS;
5645 typedef struct _dwg_abstractobject_ASSOCARRAYPARAMETERS Dwg_Object_ASSOCARRAYRECTANGULARPARAMETERS;
5646 
5647 typedef struct _dwg_object_ASSOCRESTOREENTITYSTATEACTIONBODY
5648 {
5649   struct _dwg_object_object *parent;
5650   ASSOCACTIONBODY_fields;
5651   /* AcDbAssocRestoreEntityStateActionBody */
5652   BITCODE_BL class_version;
5653   BITCODE_H entity;
5654 } Dwg_Object_ASSOCRESTOREENTITYSTATEACTIONBODY;
5655 
5656 /* AcDbAssocSurfaceActionBody */
5657 typedef struct _dwg_ASSOCSURFACEACTIONBODY
5658 {
5659   struct _dwg_object_object *parent;
5660   BITCODE_BL version;		/*!< DXF 90 */
5661   BITCODE_B  is_semi_assoc;	/*!< DXF 290 */
5662   BITCODE_BL l2;		/*!< DXF 90 */
5663   BITCODE_B  is_semi_ovr;	/*!< DXF 290 is_semi_associativity_satisfied_override */
5664   BITCODE_BS grip_status;	/*!< DXF 70 */
5665   BITCODE_H  assocdep;		/* ASSOCDEPENDENCY */
5666 } Dwg_ASSOCSURFACEACTIONBODY;
5667 
5668 #define ASSOCPATHBASEDSURFACEACTIONBODY_fields \
5669   ASSOCACTIONBODY_fields;                      \
5670   Dwg_ASSOCPARAMBASEDACTIONBODY pab;           \
5671   Dwg_ASSOCSURFACEACTIONBODY sab;              \
5672   /* AcDbAssocPathBasedSurfaceActionBody */    \
5673   BITCODE_BL pbsab_status /*!< DXF 90 */
5674 
5675 typedef struct _dwg_object_ASSOCEXTENDSURFACEACTIONBODY
5676 {
5677   struct _dwg_object_object *parent;
5678   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5679   // AcDbAssocExtendSurfaceActionBody
5680   BITCODE_BL class_version;     /*!< DXF 90  */
5681   BITCODE_RC option;       	/*!< DXF 280 edge_extension_type */
5682 } Dwg_Object_ASSOCEXTENDSURFACEACTIONBODY;
5683 
5684 typedef struct _dwg_object_ASSOCEXTRUDEDSURFACEACTIONBODY
5685 {
5686   struct _dwg_object_object *parent;
5687   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5688   // AcDbAssocExtrudedSurfaceActionBody
5689   BITCODE_BL class_version;       /*!< DXF 90  */
5690 } Dwg_Object_ASSOCEXTRUDEDSURFACEACTIONBODY;
5691 
5692 typedef struct _dwg_object_ASSOCPLANESURFACEACTIONBODY
5693 {
5694   struct _dwg_object_object *parent;
5695   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5696   // AcDbAssocPlaneSurfaceActionBody
5697   BITCODE_BL class_version;       /*!< DXF 90  */
5698 } Dwg_Object_ASSOCPLANESURFACEACTIONBODY;
5699 
5700 typedef struct _dwg_object_ASSOCLOFTEDSURFACEACTIONBODY
5701 {
5702   struct _dwg_object_object *parent;
5703   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5704   // AcDbAssocLoftedSurfaceActionBody
5705   BITCODE_BL class_version;       /*!< DXF 90  */
5706 } Dwg_Object_ASSOCLOFTEDSURFACEACTIONBODY;
5707 
5708 typedef struct _dwg_object_ASSOCNETWORKSURFACEACTIONBODY
5709 {
5710   struct _dwg_object_object *parent;
5711   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5712   // AcDbAssocNetworkSurfaceActionBody
5713   BITCODE_BL class_version;       /*!< DXF 90  */
5714 } Dwg_Object_ASSOCNETWORKSURFACEACTIONBODY;
5715 
5716 typedef struct _dwg_object_ASSOCOFFSETSURFACEACTIONBODY
5717 {
5718   struct _dwg_object_object *parent;
5719   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5720   // AcDbAssocOffsetSurfaceActionBody
5721   BITCODE_BL class_version;       /*!< DXF 90  */
5722   BITCODE_B  b1;       /*!< DXF 290  */
5723 } Dwg_Object_ASSOCOFFSETSURFACEACTIONBODY;
5724 
5725 typedef struct _dwg_object_ASSOCREVOLVEDSURFACEACTIONBODY
5726 {
5727   struct _dwg_object_object *parent;
5728   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5729   // AcDbAssocRevolvedSurfaceActionBody
5730   BITCODE_BL class_version;       /*!< DXF 90  */
5731 } Dwg_Object_ASSOCREVOLVEDSURFACEACTIONBODY;
5732 
5733 typedef struct _dwg_object_ASSOCSWEPTSURFACEACTIONBODY
5734 {
5735   struct _dwg_object_object *parent;
5736   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5737   // AcDbAssocSweptSurfaceActionBody
5738   BITCODE_BL class_version;       /*!< DXF 90  */
5739 } Dwg_Object_ASSOCSWEPTSURFACEACTIONBODY;
5740 
5741 typedef struct _dwg_object_ASSOCEDGECHAMFERACTIONBODY
5742 {
5743   struct _dwg_object_object *parent;
5744   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5745 } Dwg_Object_ASSOCEDGECHAMFERACTIONBODY;
5746 
5747 typedef struct _dwg_object_ASSOCEDGEFILLETACTIONBODY
5748 {
5749   struct _dwg_object_object *parent;
5750   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5751 } Dwg_Object_ASSOCEDGEFILLETACTIONBODY;
5752 
5753 typedef struct _dwg_object_ASSOCTRIMSURFACEACTIONBODY
5754 {
5755   struct _dwg_object_object *parent;
5756   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5757   // AcDbAssocTrimSurfaceActionBody
5758   BITCODE_BL class_version;     /*!< DXF 90  */
5759   BITCODE_B b1;			/*!< DXF 290 */
5760   BITCODE_B b2;			/*!< DXF 290 */
5761   BITCODE_BD distance;		/*!< DXF 40  */
5762 } Dwg_Object_ASSOCTRIMSURFACEACTIONBODY;
5763 
5764 typedef struct _dwg_object_ASSOCBLENDSURFACEACTIONBODY
5765 {
5766   struct _dwg_object_object *parent;
5767   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5768   // AcDbAssocBlendSurfaceActionBody
5769   BITCODE_BL class_version;     /*!< DXF 90  */
5770   BITCODE_B b1;			/*!< DXF 290 */
5771   BITCODE_B b2;			/*!< DXF 291 */
5772   BITCODE_B b3;			/*!< DXF 292 */
5773   BITCODE_B b4;			/*!< DXF 293 */
5774   BITCODE_B b5;			/*!< DXF 294 */
5775   BITCODE_BS blend_options;	/*!< DXF 72  */
5776   BITCODE_BS bs2;		/*!< DXF 73  */
5777 } Dwg_Object_ASSOCBLENDSURFACEACTIONBODY;
5778 
5779 typedef struct _dwg_object_ASSOCFILLETSURFACEACTIONBODY
5780 {
5781   struct _dwg_object_object *parent;
5782   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5783   // AcDbAssocFilletSurfaceActionBody
5784   BITCODE_BL class_version;	/*!< DXF 90  */
5785   BITCODE_BS status;		/*!< DXF 70  */
5786   BITCODE_2RD pt1;		/*!< DXF 10  */
5787   BITCODE_2RD pt2;		/*!< DXF 10  */
5788 } Dwg_Object_ASSOCFILLETSURFACEACTIONBODY;
5789 
5790 typedef struct _dwg_object_ASSOCPATCHSURFACEACTIONBODY
5791 {
5792   struct _dwg_object_object *parent;
5793   ASSOCPATHBASEDSURFACEACTIONBODY_fields;
5794   // AcDbAssocPatchSurfaceActionBody
5795   BITCODE_BL class_version;     /*!< DXF 90  */
5796 } Dwg_Object_ASSOCPATCHSURFACEACTIONBODY;
5797 
5798 #define ASSOCANNOTATIONACTIONBODY_fields \
5799   BITCODE_BS aaab_version; \
5800   BITCODE_H assoc_dep; \
5801   BITCODE_BS aab_version; \
5802   BITCODE_H actionbody
5803 
5804 typedef struct _dwg_ASSOCACTIONBODY_action
5805 {
5806   struct _dwg_object_ASSOCMLEADERACTIONBODY *parent;
5807   BITCODE_BL depid;
5808   BITCODE_H dep;
5809 } Dwg_ASSOCACTIONBODY_action;
5810 
5811 typedef struct _dwg_object_ASSOCMLEADERACTIONBODY
5812 {
5813   struct _dwg_object_object *parent;
5814   ASSOCANNOTATIONACTIONBODY_fields;
5815   Dwg_ASSOCPARAMBASEDACTIONBODY pab;
5816   BITCODE_BL class_version; // 90 0
5817   BITCODE_BL num_actions;
5818   Dwg_ASSOCACTIONBODY_action *actions;
5819 } Dwg_Object_ASSOCMLEADERACTIONBODY;
5820 
5821 typedef struct _dwg_object_ASSOCALIGNEDDIMACTIONBODY
5822 {
5823   struct _dwg_object_object *parent;
5824   ASSOCANNOTATIONACTIONBODY_fields;
5825   Dwg_ASSOCPARAMBASEDACTIONBODY pab;
5826   BITCODE_BL class_version; // 90 0
5827   BITCODE_H  r_node; // 330
5828   BITCODE_H  d_node; // 330
5829 } Dwg_Object_ASSOCALIGNEDDIMACTIONBODY;
5830 
5831 typedef struct _dwg_object_ASSOC3POINTANGULARDIMACTIONBODY
5832 {
5833   struct _dwg_object_object *parent;
5834   ASSOCANNOTATIONACTIONBODY_fields;
5835   Dwg_ASSOCPARAMBASEDACTIONBODY pab;
5836   BITCODE_BS class_version; /*!< DXF 90  */
5837   BITCODE_H r_node;		/*!< DXF 330  */
5838   BITCODE_H d_node;		/*!< DXF 330  */
5839   BITCODE_H assocdep;		/*!< DXF 330  */
5840 } Dwg_Object_ASSOC3POINTANGULARDIMACTIONBODY;
5841 
5842 typedef struct _dwg_object_ASSOCORDINATEDIMACTIONBODY
5843 {
5844   struct _dwg_object_object *parent;
5845   ASSOCANNOTATIONACTIONBODY_fields;
5846   Dwg_ASSOCPARAMBASEDACTIONBODY pab;
5847   BITCODE_BL class_version;	/*!< DXF 90  */
5848   BITCODE_H  r_node;		/*!< DXF 330 */
5849   BITCODE_H  d_node;		/*!< DXF 330 */
5850 } Dwg_Object_ASSOCORDINATEDIMACTIONBODY;
5851 
5852 typedef struct _dwg_object_ASSOCROTATEDDIMACTIONBODY
5853 {
5854   struct _dwg_object_object *parent;
5855   ASSOCANNOTATIONACTIONBODY_fields;
5856   Dwg_ASSOCPARAMBASEDACTIONBODY pab;
5857   BITCODE_BS class_version;	/*!< DXF 90  */
5858   BITCODE_H  r_node;		/*!< DXF 330 */
5859   BITCODE_H  d_node;		/*!< DXF 330 */
5860 } Dwg_Object_ASSOCROTATEDDIMACTIONBODY;
5861 
5862 typedef struct _dwg_object_ASSOCDIMDEPENDENCYBODY
5863 {
5864   struct _dwg_object_object *parent;
5865   BITCODE_BS adb_version;     // 90 1
5866   BITCODE_BS dimbase_version; // 90 1
5867   BITCODE_T name;             // 1
5868   BITCODE_BS class_version;   // 90 1
5869 } Dwg_Object_ASSOCDIMDEPENDENCYBODY;
5870 
5871 typedef struct _dwg_object_BLOCKPARAMDEPENDENCYBODY
5872 {
5873   struct _dwg_object_object *parent;
5874   BITCODE_BS adb_version;     // 90 1
5875   BITCODE_BS dimbase_version; // 90 1
5876   BITCODE_T name;             // 1
5877   BITCODE_BS class_version;   // 90 0
5878 } Dwg_Object_BLOCKPARAMDEPENDENCYBODY;
5879 
5880 typedef struct _dwg_ARRAYITEMLOCATOR
5881 {
5882   struct _dwg_object_ASSOCARRAYMODIFYACTIONBODY *parent;
5883   /* BITCODE_BL *itemloc; 3x DXF 90, FIXME dynapi: "itemloc[3]" => "itemloc" */
5884   BITCODE_BL itemloc1;
5885   BITCODE_BL itemloc2;
5886   BITCODE_BL itemloc3;
5887 } Dwg_ARRAYITEMLOCATOR;
5888 
5889 #define ASSOCARRAYACTIONBODY_fields            \
5890   ASSOCACTIONBODY_fields;                      \
5891   Dwg_ASSOCPARAMBASEDACTIONBODY pab;           \
5892   BITCODE_BL aaab_version;                     \
5893   BITCODE_T paramblock; /* classname, i.e. AcDbAssocArrayPolarParameters */ \
5894   BITCODE_BD *transmatrix
5895 
5896 typedef struct _dwg_object_ASSOCARRAYACTIONBODY
5897 {
5898   struct _dwg_object_object *parent;
5899   ASSOCARRAYACTIONBODY_fields;
5900 } Dwg_Object_ASSOCARRAYACTIONBODY;
5901 
5902 typedef struct _dwg_object_ASSOCARRAYMODIFYACTIONBODY
5903 {
5904   struct _dwg_object_object *parent;
5905   ASSOCARRAYACTIONBODY_fields;
5906   BITCODE_BS status;
5907   BITCODE_BL num_items;
5908   Dwg_ARRAYITEMLOCATOR *items;
5909 } Dwg_Object_ASSOCARRAYMODIFYACTIONBODY;
5910 
5911 /* A node in the EVALUATION_GRAPH */
5912 typedef struct _dwg_EvalExpr
5913 {
5914   BITCODE_BLd parentid; /* -1 if none */
5915   BITCODE_BL major;
5916   BITCODE_BL minor;
5917   BITCODE_BSd value_code; // compare to EvalVariant
5918   union
5919   {
5920     BITCODE_BD  num40;
5921     BITCODE_2RD pt2d;
5922     BITCODE_3BD pt3d;
5923     BITCODE_T   text1;
5924     BITCODE_BL  long90;
5925     BITCODE_H   handle91;
5926     BITCODE_BS  short70;
5927   } value;
5928   BITCODE_BL nodeid;
5929 } Dwg_EvalExpr;
5930 
5931 typedef struct _dwg_ACSH_SubentMaterial
5932 {
5933   BITCODE_BL major;
5934   BITCODE_BL minor;
5935   BITCODE_BL reflectance;
5936   BITCODE_BL displacement;
5937 } Dwg_ACSH_SubentMaterial;
5938 
5939 // on body, face or edge
5940 typedef struct _dwg_ACSH_SubentColor
5941 {
5942   BITCODE_BL major;
5943   BITCODE_BL minor;
5944   BITCODE_BL transparency;
5945   BITCODE_BL bl93;
5946   BITCODE_B  is_face_variable;
5947 } Dwg_ACSH_SubentColor;
5948 
5949 typedef struct _dwg_ACSH_HistoryNode
5950 {
5951   BITCODE_BL major;    //33
5952   BITCODE_BL minor;    //29
5953   BITCODE_BD *trans;   //last 16x nums 40-55
5954   BITCODE_CMC color;   /*!< DXF 62 */
5955   BITCODE_BL step_id;  /*!< DXF 92 */
5956   BITCODE_H  material; /*!< DXF 347 */
5957 } Dwg_ACSH_HistoryNode;
5958 
5959 //#define Dwg_EvalExpr evalexpr Dwg_EvalExpr evalexpr
5960 
5961 typedef struct _dwg_object_ACSH_HISTORY_CLASS
5962 {
5963   struct _dwg_object_object *parent;
5964   BITCODE_BL major;
5965   BITCODE_BL minor;
5966   BITCODE_H owner;
5967   BITCODE_BL h_nodeid; // the last nodeid, i.e. num_nodes
5968   BITCODE_B show_history;
5969   BITCODE_B record_history;
5970 } Dwg_Object_ACSH_HISTORY_CLASS;
5971 
5972 // i.e. planesurf?
5973 typedef struct _dwg_object_ACSH_BOX_CLASS
5974 {
5975   struct _dwg_object_object *parent;
5976   Dwg_EvalExpr evalexpr;
5977   Dwg_ACSH_HistoryNode history_node;
5978   // AcDbShPrimitive
5979   // AcDbShBox
5980   BITCODE_BL major;       /*!< DXF 90 (33) */
5981   BITCODE_BL minor;       /*!< DXF 91 (29) */
5982   BITCODE_BD length;     /*!< DXF 40 1300.0 (length?) */
5983   BITCODE_BD width;      /*!< DXF 41 20.0 (width?) */
5984   BITCODE_BD height;     /*!< DXF 42 420.0 (height?) */
5985 
5986 } Dwg_Object_ACSH_BOX_CLASS;
5987 
5988 typedef struct _dwg_object_ACSH_WEDGE_CLASS
5989 {
5990   struct _dwg_object_object *parent;
5991   Dwg_EvalExpr evalexpr;
5992   Dwg_ACSH_HistoryNode history_node;
5993   // AcDbShPrimitive
5994   // AcDbShWedge
5995   BITCODE_BL major;       /*!< DXF 90 (33) */
5996   BITCODE_BL minor;       /*!< DXF 91 (29) */
5997   BITCODE_BD length;     /*!< DXF 40 1300.0 (length?) */
5998   BITCODE_BD width;      /*!< DXF 41 20.0 (width?) */
5999   BITCODE_BD height;     /*!< DXF 42 420.0 (height?) */
6000 
6001 } Dwg_Object_ACSH_WEDGE_CLASS;
6002 
6003 typedef struct _dwg_object_ACSH_BOOLEAN_CLASS
6004 {
6005   struct _dwg_object_object *parent;
6006   Dwg_EvalExpr evalexpr;
6007   Dwg_ACSH_HistoryNode history_node;
6008   // AcDbShPrimitive
6009   // AcDbShBoolean
6010   BITCODE_BL major;       /*!< DXF 90 */
6011   BITCODE_BL minor;       /*!< DXF 91 */
6012   BITCODE_RCd operation;  /*!< DXF 280 */
6013   BITCODE_BL operand1;	  /*!< DXF 92 */
6014   BITCODE_BL operand2;	  /*!< DXF 93 */
6015 } Dwg_Object_ACSH_BOOLEAN_CLASS;
6016 
6017 typedef struct _dwg_object_ACSH_BREP_CLASS
6018 {
6019   struct _dwg_object_object *parent;
6020   _3DSOLID_FIELDS;
6021   Dwg_EvalExpr evalexpr;
6022   Dwg_ACSH_HistoryNode history_node;
6023   // AcDbShPrimitive
6024   // AcDbShBrep
6025   BITCODE_BL major;            /*!< DXF 90 */
6026   BITCODE_BL minor;            /*!< DXF 91 */
6027 
6028 } Dwg_Object_ACSH_BREP_CLASS;
6029 
6030 typedef struct _dwg_object_ACSH_SWEEP_CLASS
6031 {
6032   struct _dwg_object_object *parent;
6033   Dwg_EvalExpr evalexpr;
6034   Dwg_ACSH_HistoryNode history_node;
6035   // AcDbShPrimitive
6036   // AcDbShSweepBase
6037   BITCODE_BL major;            /*!< DXF 90 */
6038   BITCODE_BL minor;            /*!< DXF 91 */
6039   BITCODE_3BD direction;      /*!< DXF 10 */
6040   BITCODE_BL bl92;            /*!< DXF 92 */
6041   BITCODE_BL shsw_text_size;  /*!< DXF 90 */
6042   BITCODE_TF shsw_text;       /*!< DXF 310 */
6043   BITCODE_BL shsw_bl93;       /*!< DXF 93 */
6044   BITCODE_BL shsw_text2_size; /*!< DXF 90 */
6045   BITCODE_TF shsw_text2;      /*!< DXF 310 */
6046   // compare to SWEEPOPTIONS_fields
6047   BITCODE_BD draft_angle;       /*!< DXF 42 0.0 */
6048   BITCODE_BD start_draft_dist;  /*!< DXF 43 0.0 */
6049   BITCODE_BD end_draft_dist;    /*!< DXF 44 0.0 */
6050   BITCODE_BD scale_factor;      /*!< DXF 45 1.0 */
6051   BITCODE_BD twist_angle;       /*!< DXF 48 0.0 */
6052   BITCODE_BD align_angle;       /*!< DXF 49 0.0 */
6053   BITCODE_BD* sweepentity_transform; /*!< DXF 46 16x */
6054   BITCODE_BD* pathentity_transform;  /*!< DXF 47 16x */
6055   BITCODE_RC align_option;      /*!< DXF 70 2 */
6056   BITCODE_RC miter_option;      /*!< DXF 71 2 */
6057   BITCODE_B has_align_start;    /*!< DXF 290 1 */
6058   BITCODE_B bank;       /*!< DXF 292 1 */
6059   BITCODE_B check_intersections; /*!< DXF 293 0 */
6060   BITCODE_B shsw_b294;  /*!< DXF 294  1 */
6061   BITCODE_B shsw_b295;  /*!< DXF 295  1 */
6062   BITCODE_B shsw_b296;  /*!< DXF 296  1 */
6063   BITCODE_3BD pt2;      /*!< DXF 11 0,0,0 */
6064 
6065   // AcDbShSweep
6066 
6067 } Dwg_Object_ACSH_SWEEP_CLASS;
6068 
6069 typedef struct _dwg_object_ACSH_EXTRUSION_CLASS
6070 {
6071   struct _dwg_object_object *parent;
6072   Dwg_EvalExpr evalexpr;
6073   Dwg_ACSH_HistoryNode history_node;
6074   // AcDbShPrimitive
6075   // AcDbShSweepBase
6076   BITCODE_BL major;        /*!< DXF 90 */
6077   BITCODE_BL minor;        /*!< DXF 91 */
6078   BITCODE_3BD direction;  /*!< DXF 10 */
6079   BITCODE_BL bl92;        /*!< DXF 92 */
6080   BITCODE_BL shsw_text_size;  /*!< DXF 90 */
6081   BITCODE_TF shsw_text;       /*!< DXF 310 */
6082   BITCODE_BL shsw_bl93;       /*!< DXF 93 */
6083   BITCODE_BL shsw_text2_size; /*!< DXF 90 */
6084   BITCODE_TF shsw_text2;      /*!< DXF 310 */
6085   // compare to SWEEPOPTIONS_fields
6086   BITCODE_BD draft_angle;       /*!< DXF 42 0.0 */
6087   BITCODE_BD start_draft_dist;  /*!< DXF 43 0.0 */
6088   BITCODE_BD end_draft_dist;    /*!< DXF 44 0.0 */
6089   BITCODE_BD scale_factor;      /*!< DXF 45 1.0 */
6090   BITCODE_BD twist_angle;       /*!< DXF 48 0.0 */
6091   BITCODE_BD align_angle;       /*!< DXF 49 0.0 */
6092   BITCODE_BD* sweepentity_transform; /*!< DXF 46 16x */
6093   BITCODE_BD* pathentity_transform;  /*!< DXF 47 16x */
6094   BITCODE_RC align_option;      /*!< DXF 70 2 */
6095   BITCODE_RC miter_option;      /*!< DXF 71 2 */
6096   BITCODE_B has_align_start;    /*!< DXF 290 1 */
6097   BITCODE_B bank;       /*!< DXF 292 1 */
6098   BITCODE_B check_intersections; /*!< DXF 293 0 */
6099   BITCODE_B shsw_b294;  /*!< DXF 294  1 */
6100   BITCODE_B shsw_b295;  /*!< DXF 295  1 */
6101   BITCODE_B shsw_b296;  /*!< DXF 296  1 */
6102   BITCODE_3BD pt2;      /*!< DXF 11 0,0,0 */
6103 
6104   // AcDbShExtrusion
6105 } Dwg_Object_ACSH_EXTRUSION_CLASS;
6106 
6107 typedef struct _dwg_object_ACSH_LOFT_CLASS
6108 {
6109   struct _dwg_object_object *parent;
6110   Dwg_EvalExpr evalexpr;
6111   Dwg_ACSH_HistoryNode history_node;
6112   // AcDbShPrimitive
6113   // AcDbShLoft
6114   BITCODE_BL major;       /*!< DXF 90 */
6115   BITCODE_BL minor;       /*!< DXF 91 */
6116   BITCODE_BL num_crosssects; /*!< DXF 92 */
6117   BITCODE_H *crosssects;
6118   BITCODE_BL num_guides; /*!< DXF 95 */
6119   BITCODE_H *guides;
6120 } Dwg_Object_ACSH_LOFT_CLASS;
6121 
6122 typedef struct _dwg_object_ACSH_FILLET_CLASS
6123 {
6124   struct _dwg_object_object *parent;
6125   Dwg_EvalExpr evalexpr;
6126   Dwg_ACSH_HistoryNode history_node;
6127   // AcDbShPrimitive
6128   // AcDbShFillet
6129   BITCODE_BL major;       /*!< DXF 90 */
6130   BITCODE_BL minor;       /*!< DXF 91 */
6131   BITCODE_BL bl92;	 /*!< DXF 92 */
6132   BITCODE_BL num_edges;	 /*!< DXF 93 */
6133   BITCODE_BL *edges;     /*!< DXF 94 */
6134   BITCODE_BL num_radiuses;	/*!< DXF 95 */
6135   BITCODE_BL num_startsetbacks;	/*!< DXF 96 */
6136   BITCODE_BL num_endsetbacks;	/*!< DXF 97 */
6137   BITCODE_BD *radiuses;	        /*!< DXF 41 */
6138   BITCODE_BD *startsetbacks;	/*!< DXF 42 */
6139   BITCODE_BD *endsetbacks;	/*!< DXF 43 */
6140 
6141 } Dwg_Object_ACSH_FILLET_CLASS;
6142 
6143 typedef struct _dwg_object_ACSH_CHAMFER_CLASS
6144 {
6145   struct _dwg_object_object *parent;
6146   Dwg_EvalExpr evalexpr;
6147   Dwg_ACSH_HistoryNode history_node;
6148   // AcDbShPrimitive
6149   // AcDbShChamfer
6150   BITCODE_BL major;     /*!< DXF 90 */
6151   BITCODE_BL minor;     /*!< DXF 91 */
6152   BITCODE_BL bl92;	/*!< DXF 92, flat or edge chamfer options? */
6153   BITCODE_BD base_dist;	/*!< DXF 41 (left_range?) */
6154   BITCODE_BD other_dist;/*!< DXF 42 (right_range or -1)? */
6155   BITCODE_BL num_edges;	/*!< DXF 93 */
6156   BITCODE_BL *edges;    /*!< DXF 94 */
6157   BITCODE_BL bl95;	/*!< DXF 95 probably our nodeid */
6158 } Dwg_Object_ACSH_CHAMFER_CLASS;
6159 
6160 typedef struct _dwg_object_ACSH_CYLINDER_CLASS
6161 {
6162   struct _dwg_object_object *parent;
6163   Dwg_EvalExpr evalexpr;
6164   Dwg_ACSH_HistoryNode history_node;
6165   // AcDbShPrimitive
6166   // AcDbShCylinder
6167   BITCODE_BL major;       /*!< DXF 90 */
6168   BITCODE_BL minor;       /*!< DXF 91 */
6169   BITCODE_BD height;      /*!< DXF 40 */
6170   BITCODE_BD major_radius;/*!< DXF 41 */
6171   BITCODE_BD minor_radius;/*!< DXF 42 */
6172   BITCODE_BD x_radius;    /*!< DXF 43 */
6173 } Dwg_Object_ACSH_CYLINDER_CLASS;
6174 
6175 typedef struct _dwg_object_ACSH_CONE_CLASS
6176 {
6177   struct _dwg_object_object *parent;
6178   Dwg_EvalExpr evalexpr;
6179   Dwg_ACSH_HistoryNode history_node;
6180   // AcDbShPrimitive
6181   // AcDbShCone
6182   BITCODE_BL major;      /*!< DXF 90 */
6183   BITCODE_BL minor;      /*!< DXF 91 */
6184   BITCODE_BD height; 	 /*!< DXF 40 */
6185   BITCODE_BD major_radius; /*!< DXF 41 */
6186   BITCODE_BD minor_radius; /*!< DXF 42 */
6187   BITCODE_BD x_radius;    /*!< DXF 43 */
6188 } Dwg_Object_ACSH_CONE_CLASS;
6189 
6190 typedef struct _dwg_object_ACSH_PYRAMID_CLASS
6191 {
6192   struct _dwg_object_object *parent;
6193   Dwg_EvalExpr evalexpr;
6194   Dwg_ACSH_HistoryNode history_node;
6195   // AcDbShPrimitive
6196   // AcDbShPyramid
6197   BITCODE_BL major;       /*!< DXF 90 */
6198   BITCODE_BL minor;       /*!< DXF 91 */
6199   BITCODE_BD height;     /*!< DXF 40 */
6200   BITCODE_BL sides;      /*!< DXF 92 */
6201   BITCODE_BD radius;     /*!< DXF 41 */
6202   BITCODE_BD topradius;  /*!< DXF 42 */
6203 } Dwg_Object_ACSH_PYRAMID_CLASS;
6204 
6205 typedef struct _dwg_object_ACSH_SPHERE_CLASS
6206 {
6207   struct _dwg_object_object *parent;
6208   Dwg_EvalExpr evalexpr;
6209   Dwg_ACSH_HistoryNode history_node;
6210   // AcDbShPrimitive
6211   // AcDbShTorus
6212   BITCODE_BL major;       /*!< DXF 90 */
6213   BITCODE_BL minor;       /*!< DXF 91 */
6214   BITCODE_BD radius;	/*!< DXF 40 */
6215 
6216 } Dwg_Object_ACSH_SPHERE_CLASS;
6217 
6218 typedef struct _dwg_object_ACSH_TORUS_CLASS
6219 {
6220   struct _dwg_object_object *parent;
6221   Dwg_EvalExpr evalexpr;
6222   Dwg_ACSH_HistoryNode history_node;
6223   // AcDbShPrimitive
6224   // AcDbShTorus
6225   BITCODE_BL major;       /*!< DXF 90 */
6226   BITCODE_BL minor;       /*!< DXF 91 */
6227   BITCODE_BD major_radius;	/*!< DXF 40 */
6228   BITCODE_BD minor_radius;	/*!< DXF 41 */
6229 
6230 } Dwg_Object_ACSH_TORUS_CLASS;
6231 
6232 typedef struct _dwg_object_ACSH_REVOLVE_CLASS
6233 {
6234   struct _dwg_object_object *parent;
6235   Dwg_EvalExpr evalexpr;
6236   Dwg_ACSH_HistoryNode history_node;
6237   // AcDbShPrimitive
6238   // AcDbShRevolve?
6239   BITCODE_BL major;       /*!< DXF 90 */
6240   BITCODE_BL minor;       /*!< DXF 91 */
6241   BITCODE_3BD axis_pt;	/*!< DXF 10 */
6242   BITCODE_2RD direction;	/*!< DXF 11 */
6243   BITCODE_BD revolve_angle;	/*!< DXF 40 */
6244   BITCODE_BD start_angle;	/*!< DXF 41 */
6245   BITCODE_BD draft_angle;	/*!< DXF 43 */
6246   BITCODE_BD bd44;		/*!< DXF 44 */
6247   BITCODE_BD bd45;		/*!< DXF 45 */
6248   BITCODE_BD twist_angle;	/*!< DXF 46 */
6249   BITCODE_B b290;		/*!< DXF 290 */
6250   BITCODE_B is_close_to_axis;	/*!< DXF 291 */
6251   BITCODE_H sweep_entity;
6252 
6253 } Dwg_Object_ACSH_REVOLVE_CLASS;
6254 
6255 // called COORDINATION_MODEL in the DXF docs
6256 typedef struct _dwg_entity_NAVISWORKSMODEL
6257 {
6258   struct _dwg_object_entity *parent;
6259   // AcDbNavisworksModel
6260   BITCODE_BS flags;		/*!< DXF 70 */
6261   BITCODE_H definition;		/*!< DXF 340 */
6262   BITCODE_BD *transmatrix;	/*!< DXF 40 */
6263   BITCODE_BD unitfactor;	/*!< DXF 40 */
6264 } Dwg_Entity_NAVISWORKSMODEL;
6265 
6266 typedef struct _dwg_object_NAVISWORKSMODELDEF
6267 {
6268   struct _dwg_object_object *parent;
6269   // AcDbNavisworksModelDef
6270   BITCODE_BS flags;     /*!< DXF 70 */
6271   BITCODE_T path;       /*!< DXF 1 */
6272   BITCODE_B status;     /*!< DXF 290 */
6273   BITCODE_3BD min_extent; /*!< DXF 10 */
6274   BITCODE_3BD max_extent; /*!< DXF 11 */
6275   BITCODE_B host_drawing_visibility; /*!< DXF 290 */
6276 } Dwg_Object_NAVISWORKSMODELDEF;
6277 
6278 #define RENDERSETTINGS_fields                                                 \
6279   /* AcDbRenderSettings */                                                    \
6280   BITCODE_BL class_version;         /*!< DXF 90, default: 1 */                \
6281   BITCODE_T name;                   /*!< DXF 1 */                             \
6282   BITCODE_B fog_enabled;            /*!< DXF 290 */                           \
6283   BITCODE_B fog_background_enabled; /*!< DXF 290 */                           \
6284   BITCODE_B backfaces_enabled;      /*!< DXF 290 */                           \
6285   BITCODE_B environ_image_enabled;  /*!< DXF 290 */                           \
6286   BITCODE_T environ_image_filename; /*!< DXF 1 */                             \
6287   BITCODE_T description;            /*!< DXF 1 */                             \
6288   BITCODE_BL display_index;         /*!< DXF 290 */                           \
6289   BITCODE_B has_predefined          /*!< DXF 290, r2013 only */
6290 
6291 /**
6292  Class RENDERSETTINGS (varies)
6293  */
6294 typedef struct _dwg_object_RENDERSETTINGS
6295 {
6296   struct _dwg_object_object *parent;
6297   RENDERSETTINGS_fields;
6298 } Dwg_Object_RENDERSETTINGS;
6299 
6300 /**
6301  Class MENTALRAYRENDERSETTINGS (varies)
6302  Unstable
6303  */
6304 typedef struct _dwg_object_MENTALRAYRENDERSETTINGS
6305 {
6306   struct _dwg_object_object *parent;
6307   RENDERSETTINGS_fields;
6308   // AcDbMentalRayRenderSettings
6309   BITCODE_BL mr_version;		/*!< DXF 90, always 2 */
6310   BITCODE_BL sampling1;			/*!< DXF 90 */
6311   BITCODE_BL sampling2;			/*!< DXF 90 */
6312   BITCODE_BS sampling_mr_filter;	/*!< DXF 70 */
6313   BITCODE_BD sampling_filter1;		/*!< DXF 40 */
6314   BITCODE_BD sampling_filter2;		/*!< DXF 40 */
6315   BITCODE_BD sampling_contrast_color1;	/*!< DXF 40 */
6316   BITCODE_BD sampling_contrast_color2;	/*!< DXF 40 */
6317   BITCODE_BD sampling_contrast_color3;	/*!< DXF 40 */
6318   BITCODE_BD sampling_contrast_color4;	/*!< DXF 40 */
6319   BITCODE_BS shadow_mode;		/*!< DXF 70 */
6320   BITCODE_B  shadow_maps_enabled;	/*!< DXF 290 */
6321   BITCODE_B  ray_tracing_enabled;	/*!< DXF 290 */
6322   BITCODE_BL ray_trace_depth1;		/*!< DXF 90 */
6323   BITCODE_BL ray_trace_depth2;		/*!< DXF 90 */
6324   BITCODE_BL ray_trace_depth3;		/*!< DXF 90 */
6325   BITCODE_B  global_illumination_enabled;/*!< DXF 290 */
6326   BITCODE_BL gi_sample_count;		/*!< DXF 90 */
6327   BITCODE_B  gi_sample_radius_enabled;	/*!< DXF 290 */
6328   BITCODE_BD gi_sample_radius;		/*!< DXF 40 */
6329   BITCODE_BL gi_photons_per_light;	/*!< DXF 90 */
6330   BITCODE_BL photon_trace_depth1;	/*!< DXF 90 */
6331   BITCODE_BL photon_trace_depth2;	/*!< DXF 90 */
6332   BITCODE_BL photon_trace_depth3;	/*!< DXF 90 */
6333   BITCODE_B  final_gathering_enabled;	/*!< DXF 290 */
6334   BITCODE_BL fg_ray_count;		/*!< DXF 90 */
6335   BITCODE_B  fg_sample_radius_state1;	/*!< DXF 290 */
6336   BITCODE_B  fg_sample_radius_state2;	/*!< DXF 290 */
6337   BITCODE_B  fg_sample_radius_state3;	/*!< DXF 290 */
6338   BITCODE_BD fg_sample_radius1;		/*!< DXF 40 */
6339   BITCODE_BD fg_sample_radius2;		/*!< DXF 40 */
6340   BITCODE_BD light_luminance_scale;		/*!< DXF 40 */
6341   BITCODE_BS diagnostics_mode;		/*!< DXF 70 */
6342   BITCODE_BS diagnostics_grid_mode;	/*!< DXF 70 */
6343   BITCODE_BD diagnostics_grid_float;	/*!< DXF 40 */
6344   BITCODE_BS diagnostics_photon_mode;	/*!< DXF 70 */
6345   BITCODE_BS diagnostics_bsp_mode;	/*!< DXF 70 */
6346   BITCODE_B  export_mi_enabled;		/*!< DXF 290 */
6347   BITCODE_T  mr_description;		/*!< DXF 1 */
6348   BITCODE_BL tile_size;			/*!< DXF 90 */
6349   BITCODE_BS tile_order;		/*!< DXF 70 */
6350   BITCODE_BL memory_limit;		/*!< DXF 90 */
6351   BITCODE_B  diagnostics_samples_mode;	/*!< DXF 290 */
6352   BITCODE_BD energy_multiplier;		/*!< DXF 40 */
6353 } Dwg_Object_MENTALRAYRENDERSETTINGS;
6354 
6355 /**
6356  Class RAPIDRTRENDERSETTINGS (varies)
6357  */
6358 typedef struct _dwg_object_RAPIDRTRENDERSETTINGS
6359 {
6360   struct _dwg_object_object *parent;
6361   RENDERSETTINGS_fields;
6362   // AcDbRapidRTRenderSettings
6363   BITCODE_BL rapidrt_version; /*!< DXF 90 */
6364   BITCODE_BL render_target;	/*!< DXF 70 */
6365   BITCODE_BL render_level;	/*!< DXF 90 */
6366   BITCODE_BL render_time;	/*!< DXF 90 */
6367   BITCODE_BL lighting_model;	/*!< DXF 70 */
6368   BITCODE_BL filter_type;	/*!< DXF 70 */
6369   BITCODE_BD filter_width;	/*!< DXF 40 */
6370   BITCODE_BD filter_height;	/*!< DXF 40 */
6371 } Dwg_Object_RAPIDRTRENDERSETTINGS;
6372 
6373 /**
6374  Class RENDERENVIRONMENT (varies)
6375  */
6376 typedef struct _dwg_object_RENDERENVIRONMENT
6377 {
6378   struct _dwg_object_object *parent;
6379 
6380   BITCODE_BL class_version;     	/*!< DXF 90, default: 1 */
6381   BITCODE_B fog_enabled;        	/*!< DXF 290 */
6382   BITCODE_B fog_background_enabled;  	/*!< DXF 290 */
6383   BITCODE_CMC fog_color;        	/*!< DXF 280 */
6384   BITCODE_BD fog_density_near;  	/*!< DXF 40 */
6385   BITCODE_BD fog_density_far;   	/*!< DXF 40 */
6386   BITCODE_BD fog_distance_near;     	/*!< DXF 40 */
6387   BITCODE_BD fog_distance_far;      	/*!< DXF 40 */
6388   BITCODE_B environ_image_enabled;  	/*!< DXF 290 */
6389   BITCODE_T environ_image_filename; 	/*!< DXF 1 */
6390 } Dwg_Object_RENDERENVIRONMENT;
6391 
6392 /**
6393  Class RENDERGLOBAL (varies)
6394  */
6395 typedef struct _dwg_object_RENDERGLOBAL
6396 {
6397   struct _dwg_object_object *parent;
6398 
6399   BITCODE_BL class_version;    /*!< DXF 90 */
6400   BITCODE_BL procedure;        /*!< DXF 90 */
6401   BITCODE_BL destination;      /*!< DXF 90 */
6402   BITCODE_B save_enabled;      /*!< DXF 290 */
6403   BITCODE_T save_filename;     /*!< DXF 1 */
6404   BITCODE_BL image_width;      /*!< DXF 90 */
6405   BITCODE_BL image_height;     /*!< DXF 90 */
6406   BITCODE_B predef_presets_first; /*!< DXF 290 */
6407   BITCODE_B highlevel_info;    /*!< DXF 290 */
6408 } Dwg_Object_RENDERGLOBAL;
6409 
6410 /**
6411  Class RENDERENTRY (varies)
6412  */
6413 typedef struct _dwg_object_RENDERENTRY
6414 {
6415   struct _dwg_object_object *parent;
6416   BITCODE_BL class_version;	/*!< DXF 90 */
6417   BITCODE_T image_file_name;	/*!< DXF 1 */
6418   BITCODE_T preset_name;	/*!< DXF 1 */
6419   BITCODE_T view_name;		/*!< DXF 1 */
6420   BITCODE_BL dimension_x;	/*!< DXF 90 */
6421   BITCODE_BL dimension_y;	/*!< DXF 90 */
6422   BITCODE_BS start_year;	/*!< DXF 70 */
6423   BITCODE_BS start_month;	/*!< DXF 70 */
6424   BITCODE_BS start_day;		/*!< DXF 70 */
6425   BITCODE_BS start_minute;	/*!< DXF 70 */
6426   BITCODE_BS start_second;	/*!< DXF 70 */
6427   BITCODE_BS start_msec;	/*!< DXF 70 */
6428   BITCODE_BD render_time;	/*!< DXF 40 */
6429   BITCODE_BL memory_amount;	/*!< DXF 90 */
6430   BITCODE_BL material_count;	/*!< DXF 90 */
6431   BITCODE_BL light_count;	/*!< DXF 90 */
6432   BITCODE_BL triangle_count;	/*!< DXF 90 */
6433   BITCODE_BL display_index;	/*!< DXF 90 */
6434 } Dwg_Object_RENDERENTRY;
6435 
6436 /**
6437  Class MOTIONPATH (varies)
6438  Maybe all the Camera paths are under ACAD_NAMEDPATH, but there's also ACAD_MOTION
6439  */
6440 typedef struct _dwg_object_MOTIONPATH
6441 {
6442   struct _dwg_object_object *parent;
6443   // AcDbMotionPath
6444   BITCODE_BS class_version;     /*!< DXF 90, default: 1 */
6445   BITCODE_H camera_path;        /*!< DXF 340 */
6446   BITCODE_H target_path;        /*!< DXF 340 */
6447   BITCODE_H viewtable;          /*!< DXF 340 */
6448   BITCODE_BS frames;            /*!< DXF 90  number of frames? default 30 */
6449   BITCODE_BS frame_rate;        /*!< DXF 90  per second, default 30 */
6450   BITCODE_B corner_decel;       /*!< DXF 290 */
6451 } Dwg_Object_MOTIONPATH;
6452 
6453 /**
6454  Class ACDBCURVEPATH (varies)
6455  */
6456 typedef struct _dwg_object_CURVEPATH
6457 {
6458   struct _dwg_object_object *parent;
6459   // AcDbCurvePath, child of AcDbNamedPath
6460   BITCODE_BS class_version;     /*!< DXF 90, default: 1 */
6461   BITCODE_H entity;             /*!< DXF 340 */
6462 } Dwg_Object_CURVEPATH;
6463 
6464 /**
6465  Class ACDBPOINTPATH (varies)
6466  */
6467 typedef struct _dwg_object_POINTPATH
6468 {
6469   struct _dwg_object_object *parent;
6470   // AcDbPointPath, child of AcDbNamedPath
6471   BITCODE_BS class_version;     /*!< DXF 90, default: 1 */
6472   BITCODE_3BD point;            /*!< DXF 10 */
6473 } Dwg_Object_POINTPATH;
6474 
6475 // not in DXF
6476 typedef struct _dwg_object_TVDEVICEPROPERTIES
6477 {
6478   struct _dwg_object_object *parent;
6479   BITCODE_BL flags; /* 1: double_buffer, 2: blocks_cache, 4: multithreaded, 8: sw_hlr
6480                        16: discard_backfaces, 32: ttf_cache, 64: dyn_subenthlt, 128: force_partial_update
6481                        256: clear_screen, 512: use_visual_styles (bit 9) 1024: use_overlay_buffers,
6482                        2048: scene_graph, 4096: composite_meta_files, ??: create_gl_context (bit 13)
6483                        delay_scenegraphproc (bit 14),
6484                     */
6485   BITCODE_BS max_regen_threads;
6486   BITCODE_BL use_lut_palette;
6487   BITCODE_BLL alt_hlt;
6488   BITCODE_BLL alt_hltcolor;
6489   BITCODE_BLL geom_shader_usage;
6490   // ver > 3
6491   BITCODE_BL blending_mode;
6492   //ver 2 or >4:
6493   BITCODE_BD antialiasing_level;
6494   BITCODE_BD bd2;
6495 } Dwg_Object_TVDEVICEPROPERTIES;
6496 
6497 typedef struct _dwg_object_SKYLIGHT_BACKGROUND
6498 {
6499   struct _dwg_object_object *parent;
6500   BITCODE_BL class_version;     /*!< DXF 90, default 1 */
6501   BITCODE_H sunid;		/*!< DXF 340 */
6502 } Dwg_Object_SKYLIGHT_BACKGROUND;
6503 
6504 typedef struct _dwg_object_SOLID_BACKGROUND
6505 {
6506   struct _dwg_object_object *parent;
6507   BITCODE_BL class_version;     /*!< DXF 90, default 1 */
6508   BITCODE_BLx color;		/*!< DXF 90 */
6509 } Dwg_Object_SOLID_BACKGROUND;
6510 
6511 typedef struct _dwg_object_IMAGE_BACKGROUND
6512 {
6513   struct _dwg_object_object *parent;
6514   BITCODE_BL class_version;     /*!< DXF 90, default 1 */
6515   BITCODE_T filename;		/*!< DXF 300 */
6516   BITCODE_B fit_to_screen;	/*!< DXF 290 */
6517   BITCODE_B maintain_aspect_ratio;	/*!< DXF 291 */
6518   BITCODE_B use_tiling;		/*!< DXF 292 */
6519   BITCODE_2BD offset;		/*!< DXF 140,141 */
6520   BITCODE_2BD scale;		/*!< DXF 142,143 */
6521 } Dwg_Object_IMAGE_BACKGROUND;
6522 
6523 // Image Based Lightning
6524 typedef struct _dwg_object_IBL_BACKGROUND
6525 {
6526   struct _dwg_object_object *parent;
6527   BITCODE_BL class_version;     /*!< DXF 90, default 2 */
6528   BITCODE_B enable;             /*!< DXF 290 */
6529   BITCODE_T name;     		/*!< DXF 1 */
6530   BITCODE_BD rotation;          /*!< DXF 40, normalized -180 +180, in degrees */
6531   BITCODE_B display_image;      /*!< DXF 290 */
6532   BITCODE_H secondary_background;/*!< DXF 340 */
6533 } Dwg_Object_IBL_BACKGROUND;
6534 
6535 typedef struct _dwg_object_GRADIENT_BACKGROUND
6536 {
6537   struct _dwg_object_object *parent;
6538   BITCODE_BL class_version;     /*!< DXF 90, default 1 */
6539   BITCODE_BLx color_top;	/*!< DXF 90 */
6540   BITCODE_BLx color_middle;	/*!< DXF 91 */
6541   BITCODE_BLx color_bottom;	/*!< DXF 91 */
6542   BITCODE_BD horizon;		/*!< DXF 140 */
6543   BITCODE_BD height;		/*!< DXF 141 */
6544   BITCODE_BD rotation;		/*!< DXF 142 */
6545 } Dwg_Object_GRADIENT_BACKGROUND;
6546 
6547 typedef struct _dwg_object_GROUND_PLANE_BACKGROUND
6548 {
6549   struct _dwg_object_object *parent;
6550   BITCODE_BL class_version;     	/*!< DXF 90, default 1 */
6551   BITCODE_BLx color_sky_zenith;		/*!< DXF 90 */
6552   BITCODE_BLx color_sky_horizon;	/*!< DXF 91 */
6553   BITCODE_BLx color_underground_horizon;/*!< DXF 92 */
6554   BITCODE_BLx color_underground_azimuth;/*!< DXF 93 */
6555   BITCODE_BLx color_near;		/*!< DXF 94 groundplane */
6556   BITCODE_BLx color_far;		/*!< DXF 95 groundplane */
6557 } Dwg_Object_GROUND_PLANE_BACKGROUND;
6558 
6559 /**
6560  * Class AcDbAnnotScaleObjectContextData (varies)
6561  * for MTEXT, TEXT, MLEADER, LEADER, BLKREF, ALDIM (AlignedDimension), MTEXTATTRIBUTE, ...
6562  * R2010+
6563  * 20.4.89 SubClass AcDbObjectContextData (varies)
6564  */
6565 #define OBJECTCONTEXTDATA_fields                                              \
6566   struct _dwg_object_object *parent;                                          \
6567   BITCODE_BS class_version; /*!< r2010+ =4, before 3 */                       \
6568   BITCODE_B is_default     /* 290 */
6569 
6570 #define ANNOTSCALEOBJECTCONTEXTDATA_fields                                    \
6571   OBJECTCONTEXTDATA_fields;                                                   \
6572   BITCODE_H scale	/*!< DXF 340 */
6573 
6574 typedef struct _dwg_object_ANNOTSCALEOBJECTCONTEXTDATA
6575 {
6576   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6577 } Dwg_Object_ANNOTSCALEOBJECTCONTEXTDATA;
6578 
6579 typedef struct _dwg_CONTEXTDATA_dict
6580 {
6581   struct _dwg_CONTEXTDATA_submgr *parent;
6582   BITCODE_T text;
6583   BITCODE_H itemhandle;
6584 } Dwg_CONTEXTDATA_dict;
6585 
6586 typedef struct _dwg_CONTEXTDATA_submgr
6587 {
6588   struct _dwg_object_CONTEXTDATAMANAGER *parent;
6589   BITCODE_H handle;
6590   BITCODE_BL num_entries;
6591   Dwg_CONTEXTDATA_dict *entries;
6592 } Dwg_CONTEXTDATA_submgr;
6593 
6594 /**
6595  * R2010+
6596  * A special DICTIONARY
6597  */
6598 typedef struct _dwg_object_CONTEXTDATAMANAGER
6599 {
6600   struct _dwg_object_object *parent;
6601   BITCODE_H objectcontext;
6602   BITCODE_BL num_submgrs;
6603   Dwg_CONTEXTDATA_submgr *submgrs;
6604 } Dwg_Object_CONTEXTDATAMANAGER;
6605 
6606 #define TEXTOBJECTCONTEXTDATA_fields \
6607   BITCODE_BS horizontal_mode;	/*<! DXF 70, default 0 */ \
6608   BITCODE_BD rotation;		/*!< DXF 50, default 0.0 or 90.0 */ \
6609   BITCODE_2RD ins_pt; 		/*!< DXF 10-20 */ \
6610   BITCODE_2RD alignment_pt 	/*!< DXF 11-21 */
6611 
6612 /**
6613  * R2010+
6614  */
6615 typedef struct _dwg_object_TEXTOBJECTCONTEXTDATA
6616 {
6617   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6618   TEXTOBJECTCONTEXTDATA_fields;
6619 } Dwg_Object_TEXTOBJECTCONTEXTDATA;
6620 
6621 /**
6622  * R2010+
6623  */
6624 typedef struct _dwg_object_MTEXTOBJECTCONTEXTDATA
6625 {
6626   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6627   BITCODE_BL attachment;      	/*<! DXF 70 */
6628   BITCODE_3BD ins_pt; 		/*!< DXF 10 */
6629   BITCODE_3BD x_axis_dir; 	/*!< DXF 11 */
6630   BITCODE_BD rect_height;	/*!< DXF 40 */
6631   BITCODE_BD rect_width;	/*!< DXF 41 */
6632   BITCODE_BD extents_width;	/*!< DXF 42 */
6633   BITCODE_BD extents_height;	/*!< DXF 43 */
6634   BITCODE_BL column_type;       /*!< DXF 71 0: none, 1: static, 2: dynamic. Note: BS in MTEXT! */
6635   BITCODE_BD column_width;      /*!< DXF 44 */
6636   BITCODE_BD gutter;            /*!< DXF 45 */
6637   BITCODE_B auto_height;        /*!< DXF 73 */
6638   BITCODE_B flow_reversed;      /*!< DXF 74 */
6639   BITCODE_BL num_column_heights;/*!< DXF 72 or numfragments */
6640   BITCODE_BD *column_heights;   /*!< DXF 46 if dynamic and not auto_height */
6641 } Dwg_Object_MTEXTOBJECTCONTEXTDATA;
6642 
6643 // subclass AcDbDimensionObjectContextData
6644 typedef struct _dwg_OCD_Dimension
6645 {
6646   BITCODE_B b293;		/*!< DXF 293 */
6647   BITCODE_2RD def_pt;  		/*!< DXF 10-30 */
6648   BITCODE_B is_def_textloc;	/*<! DXF 294 if def_pt is default */
6649   BITCODE_BD text_rotation;	/*!< DXF 140 */
6650   BITCODE_H block;		/*!< DXF 2 */
6651   BITCODE_B dimtofl;		/*!< DXF 298 */
6652   BITCODE_B dimosxd;		/*!< DXF 291 */
6653   BITCODE_B dimatfit;		/*!< DXF 70  */
6654   BITCODE_B dimtix;		/*!< DXF 292 */
6655   BITCODE_B dimtmove;		/*!< DXF 71  */
6656   BITCODE_RC override_code;	/*!< DXF 280 */
6657   BITCODE_B has_arrow2;		/*!< DXF 295 */
6658   BITCODE_B flip_arrow2;	/*!< DXF 296 */
6659   BITCODE_B flip_arrow1;	/*!< DXF 297 */
6660 } Dwg_OCD_Dimension;
6661 
6662 /**
6663  * for ALDIM (AlignedDimension)
6664  * R2010+
6665  */
6666 typedef struct _dwg_object_ALDIMOBJECTCONTEXTDATA
6667 {
6668   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6669   Dwg_OCD_Dimension dimension;
6670   // AcDbAlignedDimensionObjectContextData
6671   BITCODE_3BD dimline_pt;	/*!< DXF 11-31 */
6672 } Dwg_Object_ALDIMOBJECTCONTEXTDATA;
6673 
6674 /**
6675  * for ANGDIM (AngularDimension)
6676  * R2010+
6677  */
6678 typedef struct _dwg_object_ANGDIMOBJECTCONTEXTDATA
6679 {
6680   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6681   Dwg_OCD_Dimension dimension;
6682   // AcDbAngularDimensionObjectContextData
6683   BITCODE_3BD arc_pt;	/*!< DXF 11-31 */
6684 } Dwg_Object_ANGDIMOBJECTCONTEXTDATA;
6685 
6686 /**
6687  * for DMDIM (DiametricDimension)
6688  * R2010+
6689  */
6690 typedef struct _dwg_object_DMDIMOBJECTCONTEXTDATA
6691 {
6692   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6693   Dwg_OCD_Dimension dimension;
6694   // AcDbDiametricDimensionObjectContextData
6695   BITCODE_3BD first_arc_pt;	/*!< DXF 11-31 */
6696   BITCODE_3BD def_pt;		/*!< DXF 12-32 */
6697 } Dwg_Object_DMDIMOBJECTCONTEXTDATA;
6698 
6699 /**
6700  * for ORDDIM (OrdinateDimension)
6701  * R2010+
6702  */
6703 typedef struct _dwg_object_ORDDIMOBJECTCONTEXTDATA
6704 {
6705   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6706   Dwg_OCD_Dimension dimension;
6707   // AcDbOrdinateDimensionObjectContextData
6708   BITCODE_3BD feature_location_pt;	/*!< DXF 11-31 = origin */
6709   BITCODE_3BD leader_endpt;		/*!< DXF 12-32 */
6710 } Dwg_Object_ORDDIMOBJECTCONTEXTDATA;
6711 
6712 /**
6713  * for RADIM (Radial Dimension)
6714  * R2010+
6715  */
6716 typedef struct _dwg_object_RADIMOBJECTCONTEXTDATA
6717 {
6718   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6719   Dwg_OCD_Dimension dimension;
6720   // AcDbRadialDimensionObjectContextData
6721   BITCODE_3BD first_arc_pt;   /*!< DXF 11-31 */
6722 } Dwg_Object_RADIMOBJECTCONTEXTDATA;
6723 
6724 /**
6725  * for RADIMLG (Large Radial Dimension)
6726  * R2010+
6727  */
6728 typedef struct _dwg_object_RADIMLGOBJECTCONTEXTDATA
6729 {
6730   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6731   Dwg_OCD_Dimension dimension;
6732   // AcDbRadialDimensionLargeObjectContextData
6733   BITCODE_3BD ovr_center;   /*!< DXF 12-32 */
6734   BITCODE_3BD jog_point;    /*!< DXF 13-33 */
6735 } Dwg_Object_RADIMLGOBJECTCONTEXTDATA;
6736 
6737 typedef struct _dwg_object_MTEXTATTRIBUTEOBJECTCONTEXTDATA
6738 {
6739   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6740   TEXTOBJECTCONTEXTDATA_fields;
6741   // MTEXTATTR
6742   BITCODE_B enable_context;
6743   struct _dwg_object *context;
6744 } Dwg_Object_MTEXTATTRIBUTEOBJECTCONTEXTDATA;
6745 
6746 typedef struct _dwg_object_MLEADEROBJECTCONTEXTDATA
6747 {
6748   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6749   // ...??
6750 } Dwg_Object_MLEADEROBJECTCONTEXTDATA;
6751 
6752 typedef struct _dwg_object_LEADEROBJECTCONTEXTDATA
6753 {
6754   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6755   BITCODE_BL num_points;	/*< DXF 70 */
6756   BITCODE_3DPOINT* points;	/*!< DXF 10 */
6757   BITCODE_B b290;		/*!< DXF 290 */
6758   BITCODE_3DPOINT x_direction;	/*!< DXF 11 */
6759   BITCODE_3DPOINT inspt_offset;	/*!< DXF 12 */
6760   BITCODE_3DPOINT endptproj;	/*!< DXF 13 */
6761 } Dwg_Object_LEADEROBJECTCONTEXTDATA;
6762 
6763 typedef struct _dwg_object_BLKREFOBJECTCONTEXTDATA
6764 {
6765   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6766   BITCODE_BD rotation;           /* 50 */
6767   BITCODE_3BD ins_pt;      	 /* 10 */
6768   BITCODE_3BD scale_factor;      /* 42-44 */
6769 } Dwg_Object_BLKREFOBJECTCONTEXTDATA;
6770 
6771 typedef struct _dwg_object_FCFOBJECTCONTEXTDATA
6772 {
6773   ANNOTSCALEOBJECTCONTEXTDATA_fields;
6774   BITCODE_3BD location;   /*!< DXF 10-30 */
6775   BITCODE_3BD horiz_dir;  /*!< DXF 11-31 */
6776 } Dwg_Object_FCFOBJECTCONTEXTDATA;
6777 
6778 typedef struct _dwg_object_DETAILVIEWSTYLE
6779 {
6780   struct _dwg_object_object *parent;
6781   // AcDbModelDocViewStyle
6782   BITCODE_BS mdoc_class_version; /*!< DXF 70 0 */
6783   BITCODE_T desc;
6784   BITCODE_B is_modified_for_recompute;
6785   BITCODE_T display_name;
6786   BITCODE_BL viewstyle_flags; /* DXF 90. 1: cannot_rename */
6787   // AcDbDetailViewStyle
6788   BITCODE_BS class_version; /*!< DXF 70 0 */
6789   BITCODE_BL flags;
6790   BITCODE_H identifier_style;
6791   BITCODE_CMC identifier_color;
6792   BITCODE_BD identifier_height;
6793   BITCODE_T identifier_exclude_characters;
6794   BITCODE_BD identifier_offset;
6795   BITCODE_RC identifier_placement;
6796   BITCODE_H arrow_symbol;
6797   BITCODE_CMC arrow_symbol_color;
6798   BITCODE_BD arrow_symbol_size;
6799   BITCODE_H boundary_ltype;
6800   BITCODE_BLd boundary_linewt;
6801   BITCODE_CMC boundary_line_color;
6802   BITCODE_H viewlabel_text_style;
6803   BITCODE_CMC viewlabel_text_color;
6804   BITCODE_BD viewlabel_text_height;
6805   BITCODE_BL viewlabel_attachment;
6806   BITCODE_BD viewlabel_offset;
6807   BITCODE_BL viewlabel_alignment;
6808   BITCODE_T viewlabel_pattern;
6809   BITCODE_H connection_ltype;
6810   BITCODE_BLd connection_linewt;
6811   BITCODE_CMC connection_line_color;
6812   BITCODE_H borderline_ltype;
6813   BITCODE_BLd borderline_linewt;
6814   BITCODE_CMC borderline_color;
6815   BITCODE_RC model_edge;
6816 } Dwg_Object_DETAILVIEWSTYLE;
6817 
6818 typedef struct _dwg_object_SECTIONVIEWSTYLE
6819 {
6820   struct _dwg_object_object *parent;
6821 
6822   // AcDbModelDocViewStyle
6823   BITCODE_BS mdoc_class_version; /*!< DXF 70 0 */
6824   BITCODE_T desc;
6825   BITCODE_B is_modified_for_recompute;
6826   BITCODE_T display_name;
6827   BITCODE_BL viewstyle_flags; /* DXF 90. 1: cannot_rename */
6828   // AcDbSectionViewStyle
6829   BITCODE_BS class_version; /*!< DXF 70 0 */
6830   BITCODE_BL flags; /* DXF 90. 1: cont_labeling, 2: show_arrowheads, 4: show_viewlabel,
6831                        8: show_allplanelines, 0x10: show_allbendids, 0x20 show_end+bendlines
6832                        0x40: show_hatch ... */
6833   BITCODE_H identifier_style;
6834   BITCODE_CMC identifier_color;
6835   BITCODE_BD identifier_height;
6836   BITCODE_H arrow_start_symbol;
6837   BITCODE_H arrow_end_symbol;
6838   BITCODE_CMC arrow_symbol_color;
6839   BITCODE_BD arrow_symbol_size;
6840   BITCODE_T identifier_exclude_characters;
6841   BITCODE_BLd identifier_position;
6842   BITCODE_BD identifier_offset;
6843   BITCODE_BLd arrow_position;
6844   BITCODE_BD arrow_symbol_extension_length;
6845   BITCODE_H plane_ltype;
6846   BITCODE_BLd plane_linewt;
6847   BITCODE_CMC plane_line_color;
6848   BITCODE_H bend_ltype;
6849   BITCODE_BLd bend_linewt;
6850   BITCODE_CMC bend_line_color;
6851   BITCODE_BD bend_line_length;
6852   BITCODE_BD end_line_overshoot;
6853   BITCODE_BD end_line_length;
6854   BITCODE_H viewlabel_text_style;
6855   BITCODE_CMC viewlabel_text_color;
6856   BITCODE_BD viewlabel_text_height;
6857   BITCODE_BL viewlabel_attachment;
6858   BITCODE_BD viewlabel_offset;
6859   BITCODE_BL viewlabel_alignment;
6860   BITCODE_T viewlabel_pattern;
6861   BITCODE_CMC hatch_color;
6862   BITCODE_CMC hatch_bg_color;
6863   BITCODE_T hatch_pattern;
6864   BITCODE_BD hatch_scale;
6865   BITCODE_BLd hatch_transparency;
6866   // see flags:
6867   //BITCODE_B is_continuous_labeling;
6868   //BITCODE_B show_arrowheads;
6869   //BITCODE_B show_viewlabel;
6870   //BITCODE_B show_end_and_bend_lines;
6871   //BITCODE_B show_hatching;
6872   BITCODE_B unknown_b1;
6873   BITCODE_B unknown_b2;
6874   BITCODE_BL num_hatch_angles;
6875   BITCODE_BD *hatch_angles;
6876 } Dwg_Object_SECTIONVIEWSTYLE;
6877 
6878 typedef struct _dwg_object_SECTION_MANAGER
6879 {
6880   struct _dwg_object_object *parent;
6881   BITCODE_B is_live; 		/*!< DXF 70 */
6882   BITCODE_BS num_sections; 	/*!< DXF 90 */
6883   BITCODE_H *sections; 		/*!< DXF 330 */
6884 } Dwg_Object_SECTION_MANAGER;
6885 
6886 typedef struct _dwg_SECTION_geometrysettings
6887 {
6888   struct _dwg_SECTION_typesettings *parent;
6889   BITCODE_BL num_geoms;         /* DXF 90 */
6890   BITCODE_BL hexindex;          /* DXF 91 */
6891   BITCODE_BL flags; 		/* DXF 92. 2: hatchvisible, 4: is_hiddenline, 8: has_division_lines */
6892   BITCODE_CMC color;		/* DXF 62 */
6893   BITCODE_T layer;		/* DXF 8 Default: 0 */
6894   BITCODE_T ltype;		/* DXF 6 Default: Continuous */
6895   BITCODE_BD ltype_scale;	/* DXF 40 */
6896   BITCODE_T plotstyle;          /* DXF 1 Default: ByColor */
6897   BITCODE_BLd linewt;		/* DXF 370 */
6898   BITCODE_BS face_transparency;	/* DXF 70 */
6899   BITCODE_BS edge_transparency;	/* DXF 71 */
6900   BITCODE_BS hatch_type;	/* DXF 72 */
6901   BITCODE_T hatch_pattern;	/* DXF 2 */
6902   BITCODE_BD hatch_angle;	/* DXF 41 */
6903   BITCODE_BD hatch_spacing;	/* DXF 42 */
6904   BITCODE_BD hatch_scale;	/* DXF 43 */
6905 } Dwg_SECTION_geometrysettings;
6906 
6907 typedef struct _dwg_SECTION_typesettings
6908 {
6909   struct _dwg_object_SECTION_SETTINGS *parent;
6910   BITCODE_BS type;      	/*!< DXF 90: type: live=1, 2d=2, 3d=4 */
6911   BITCODE_BS generation;  	/*!< DXF 91: source and destination flags.
6912                                      sourceall=1, sourceselected=2.
6913                                      destnewblock=16, destreplaceblock=32, destfile=64
6914                                  */
6915   /* or geometry: intersectionboundary=1, intersectionfill=2, fg_geom=4, bg_geom=8
6916                   curvetangencylines=16 */
6917   BITCODE_BL num_sources;
6918   BITCODE_H *sources;
6919   BITCODE_H destblock;
6920   BITCODE_T destfile;
6921   BITCODE_BL num_geom;
6922   Dwg_SECTION_geometrysettings *geom;
6923 } Dwg_SECTION_typesettings;
6924 
6925 // Unstable
6926 typedef struct _dwg_object_SECTION_SETTINGS
6927 {
6928   struct _dwg_object_object *parent;
6929   BITCODE_BS curr_type;       /* DXF 90 */
6930   BITCODE_BL num_types;       /* DXF 91 */
6931   Dwg_SECTION_typesettings *types;
6932 } Dwg_Object_SECTION_SETTINGS;
6933 
6934 typedef struct _dwg_object_LAYERFILTER
6935 {
6936   struct _dwg_object_object *parent;
6937   BITCODE_BL num_names;
6938   BITCODE_T *names;
6939 } Dwg_Object_LAYERFILTER;
6940 
6941 typedef struct _dwg_entity_ARCALIGNEDTEXT
6942 {
6943   struct _dwg_object_entity *parent;
6944   BITCODE_D2T text_size;	/*!< DXF 42 */
6945   BITCODE_D2T xscale;		/*!< DXF 41 */
6946   BITCODE_D2T char_spacing;	/*!< DXF 43 */
6947   BITCODE_T style;		/*!< DXF 7 */
6948   BITCODE_T t2;			/*!< DXF 2 */
6949   BITCODE_T t3;			/*!< DXF 3 */
6950   BITCODE_T text_value;		/*!< DXF 1 */
6951   BITCODE_D2T offset_from_arc;	/*!< DXF 44 */
6952   BITCODE_D2T right_offset;	/*!< DXF 45 */
6953   BITCODE_D2T left_offset;	/*!< DXF 46 */
6954   BITCODE_3BD center;		/*!< DXF 10 */
6955   BITCODE_BD radius;		/*!< DXF 40 */
6956   BITCODE_BD start_angle;	/*!< DXF 50 */
6957   BITCODE_BD end_angle;		/*!< DXF 51 */
6958   BITCODE_3BD extrusion;        /*!< DXF 210 */
6959   BITCODE_BL color;             /*!< DXF 90 */
6960   BITCODE_BS is_reverse;	/*!< DXF 70 */
6961   BITCODE_BS text_direction;	/*!< DXF 71 */
6962   BITCODE_BS alignment;		/*!< DXF 72 */
6963   BITCODE_BS text_position;	/*!< DXF 73 */
6964   BITCODE_BS font_19;		/*!< DXF 74 */
6965   BITCODE_BS bs2;		/*!< DXF 75 */
6966   BITCODE_BS is_underlined;	/*!< DXF 76 */
6967   BITCODE_BS bs1;		/*!< DXF 77 */
6968   BITCODE_BS font;		/*!< DXF 78 */
6969   BITCODE_BS is_shx;		/*!< DXF 79 */
6970   BITCODE_BS wizard_flag;	/*!< DXF 280 */
6971   BITCODE_H arc_handle;		/*!< DXF 330 */
6972 } Dwg_Entity_ARCALIGNEDTEXT;
6973 
6974 // Remote Text with external src or Diesel expr
6975 typedef struct _dwg_entity_RTEXT
6976 {
6977   struct _dwg_object_entity *parent;
6978   BITCODE_3BD pt;	/*!< DXF 10 */
6979   BITCODE_BE extrusion;	/*!< DXF 210 */
6980   BITCODE_BD rotation;	/*!< DXF 50 */
6981   BITCODE_BD height;	/*!< DXF 50 */
6982   BITCODE_BS flags;	/*!< DXF 70 */
6983   BITCODE_T text_value;	/*!< DXF 1 */
6984   BITCODE_H style;	/*!< DXF 7 */
6985 } Dwg_Entity_RTEXT;
6986 
6987 typedef struct _dwg_object_LAYOUTPRINTCONFIG
6988 {
6989   struct _dwg_object_object *parent;
6990   BITCODE_BS class_version; /* 2 */
6991   // ...
6992   BITCODE_BS flag; /*!< DXF 93 0 */
6993 } Dwg_Object_LAYOUTPRINTCONFIG;
6994 
6995 typedef struct _dwg_object_ACMECOMMANDHISTORY
6996 {
6997   struct _dwg_object_object *parent;
6998   BITCODE_BS class_version;
6999   //?
7000 } Dwg_Object_ACMECOMMANDHISTORY;
7001 
7002 typedef struct _dwg_object_ACMESCOPE
7003 {
7004   struct _dwg_object_object *parent;
7005   BITCODE_BS class_version;
7006   //?
7007 } Dwg_Object_ACMESCOPE;
7008 
7009 typedef struct _dwg_object_ACMESTATEMGR
7010 {
7011   struct _dwg_object_object *parent;
7012   BITCODE_BS class_version;
7013   //?
7014 } Dwg_Object_ACMESTATEMGR;
7015 
7016 typedef struct _dwg_object_CSACDOCUMENTOPTIONS
7017 {
7018   struct _dwg_object_object *parent;
7019   BITCODE_BS class_version;
7020   //?
7021 } Dwg_Object_CSACDOCUMENTOPTIONS;
7022 
7023 
7024 // dynamic blocks:
7025 
7026 #define BLOCKELEMENT_fields                     \
7027   Dwg_EvalExpr evalexpr;                        \
7028   BITCODE_T name;                               \
7029   BITCODE_BL be_major;                          \
7030   BITCODE_BL be_minor;                          \
7031   BITCODE_BL eed1071
7032 
7033 #define BLOCKPARAMETER_fields               \
7034   BLOCKELEMENT_fields;                      \
7035   BITCODE_B show_properties; /* DXF 280 */  \
7036   BITCODE_B chain_actions    /* DXF 281 */
7037 
7038 #define BLOCKACTION_fields                      \
7039   BLOCKELEMENT_fields;                          \
7040   BITCODE_3BD display_location;                 \
7041   BITCODE_BL num_actions;                       \
7042   BITCODE_BL *actions;                          \
7043   BITCODE_BL num_deps;                          \
7044   BITCODE_H *deps
7045 
7046 // XY action params
7047 #define BLOCKACTION_doubles_fields              \
7048   BITCODE_BD action_offset_x;                   \
7049   BITCODE_BD action_offset_y;                   \
7050   BITCODE_BD angle_offset
7051 
7052 #define BLOCKGRIP_fields                        \
7053   BLOCKELEMENT_fields;                          \
7054   BITCODE_BL bg_bl91;                           \
7055   BITCODE_BL bg_bl92;                           \
7056   BITCODE_3BD bg_location;                      \
7057   BITCODE_B bg_insert_cycling;                  \
7058   BITCODE_BLd bg_insert_cycling_weight
7059 
7060 // same as BLOCKACTION_connectionpts
7061 typedef struct _dwg_BLOCKPARAMETER_connection {
7062   BITCODE_BL code;
7063   BITCODE_T name;
7064 } Dwg_BLOCKPARAMETER_connection;
7065 
7066 typedef  struct _dwg_BLOCKPARAMETER_PropInfo {
7067   BITCODE_BL num_connections;
7068   Dwg_BLOCKPARAMETER_connection *connections;
7069 } Dwg_BLOCKPARAMETER_PropInfo;
7070 
7071 typedef  struct _dwg_BLOCKPARAMVALUESET {
7072   BITCODE_T desc;
7073   BITCODE_BL flags;
7074   BITCODE_BD minimum;
7075   BITCODE_BD maximum;
7076   BITCODE_BD increment;
7077   BITCODE_BS num_valuelist;
7078   BITCODE_BD *valuelist;
7079 } Dwg_BLOCKPARAMVALUESET;
7080 
7081 #define BLOCK1PTPARAMETER_fields                  \
7082   BLOCKPARAMETER_fields;                          \
7083   BITCODE_3BD def_pt;                             \
7084   BITCODE_BL num_propinfos; /* 2 */               \
7085   Dwg_BLOCKPARAMETER_PropInfo prop1;              \
7086   Dwg_BLOCKPARAMETER_PropInfo prop2
7087 
7088 #define BLOCK2PTPARAMETER_fields                  \
7089   BLOCKPARAMETER_fields;                          \
7090   BITCODE_3BD def_basept;                         \
7091   BITCODE_3BD def_endpt;                          \
7092   Dwg_BLOCKPARAMETER_PropInfo prop1;              \
7093   Dwg_BLOCKPARAMETER_PropInfo prop2;              \
7094   Dwg_BLOCKPARAMETER_PropInfo prop3;              \
7095   Dwg_BLOCKPARAMETER_PropInfo prop4;              \
7096   BITCODE_BL *prop_states;                        \
7097   BITCODE_BS parameter_base_location;             \
7098   BITCODE_3BD upd_basept;                         \
7099   BITCODE_3BD basept;                             \
7100   BITCODE_3BD upd_endpt;                          \
7101   BITCODE_3BD endpt
7102 
7103 typedef  struct _dwg_BLOCKACTION_connectionpts
7104 {
7105   BITCODE_BL code;
7106   BITCODE_T name;
7107 } Dwg_BLOCKACTION_connectionpts;
7108 
7109 #define BLOCKACTION_WITHBASEPT_fields(n)        \
7110   BLOCKACTION_fields;                           \
7111   BITCODE_3BD offset;                           \
7112   Dwg_BLOCKACTION_connectionpts conn_pts[n];    \
7113   BITCODE_B dependent;                          \
7114   BITCODE_3BD base_pt
7115   /* BITCODE_3BD stretch_pt */
7116 
7117 #define BLOCKPARAMVALUESET_fields               \
7118   Dwg_BLOCKPARAMVALUESET value_set
7119 
7120 #define BLOCKCONSTRAINTPARAMETER_fields         \
7121   BLOCK2PTPARAMETER_fields;                     \
7122   BITCODE_H dependency
7123 
7124 #define BLOCKLINEARCONSTRAINTPARAMETER_fields    \
7125   BLOCKCONSTRAINTPARAMETER_fields;               \
7126   BITCODE_T expr_name;                           \
7127   BITCODE_T expr_description;                    \
7128   BITCODE_BD value;                              \
7129   BLOCKPARAMVALUESET_fields
7130 
7131 typedef struct _dwg_BLOCKVISIBILITYPARAMETER_state
7132 {
7133   struct _dwg_object_BLOCKVISIBILITYPARAMETER *parent;
7134   BITCODE_T name;            /* DXF 301 */
7135   BITCODE_BL num_blocks;     /* DXF 94 */
7136   BITCODE_H *blocks;         /* DXF 332 */
7137   BITCODE_BL num_params;     /* DXF 95 */
7138   BITCODE_H *params;         /* DXF 333 BLOCKVISIBILITYPARAMETER objects */
7139 } Dwg_BLOCKVISIBILITYPARAMETER_state;
7140 
7141 typedef struct _dwg_object_BLOCKVISIBILITYPARAMETER
7142 {
7143   struct _dwg_object_object *parent;
7144   BLOCK1PTPARAMETER_fields;
7145   BITCODE_B is_initialized;	// DXF 281
7146   BITCODE_B unknown_bool; 	// DXF 91, history_compression, history_required or is_visible?
7147   BITCODE_T blockvisi_name;   	// DXF 301
7148   BITCODE_T blockvisi_desc;	// DXF 302
7149   BITCODE_BL num_blocks;	// DXF 93
7150   BITCODE_H *blocks;		// DXF 331
7151   BITCODE_BL num_states;	// DXF 92
7152   Dwg_BLOCKVISIBILITYPARAMETER_state *states;
7153   //BITCODE_T cur_state_name;
7154   //BITCODE_BL cur_state;
7155 } Dwg_Object_BLOCKVISIBILITYPARAMETER;
7156 
7157 typedef struct _dwg_object_BLOCKVISIBILITYGRIP
7158 {
7159   struct _dwg_object_object *parent;
7160   BLOCKGRIP_fields;
7161   // AcDbBlockVisibilityGrip
7162 } Dwg_Object_BLOCKVISIBILITYGRIP;
7163 
7164 typedef struct _dwg_object_BLOCKGRIPLOCATIONCOMPONENT
7165 {
7166   struct _dwg_object_object *parent;
7167   Dwg_EvalExpr evalexpr;
7168   // AcDbBlockGripExpr
7169   BITCODE_BL grip_type;
7170   BITCODE_T grip_expr;  // one of: X Y UpdatedX UpdatedY DisplacementX DisplacementY
7171 } Dwg_Object_BLOCKGRIPLOCATIONCOMPONENT;
7172 
7173 typedef struct _dwg_entity_VISIBILITYGRIPENTITY
7174 {
7175   struct _dwg_object_entity *parent;
7176   // ??
7177 } Dwg_Entity_VISIBILITYGRIPENTITY;
7178 
7179 typedef struct _dwg_entity_POLARGRIPENTITY
7180 {
7181   struct _dwg_object_entity *parent;
7182   // ??
7183 } Dwg_Entity_POLARGRIPENTITY;
7184 
7185 typedef struct _dwg_entity_ALIGNMENTPARAMETERENTITY
7186 {
7187   struct _dwg_object_entity *parent;
7188   // ??
7189 } Dwg_Entity_ALIGNMENTPARAMETERENTITY;
7190 
7191 typedef struct _dwg_entity_BASEPOINTPARAMETERENTITY
7192 {
7193   struct _dwg_object_entity *parent;
7194   // ??
7195 } Dwg_Entity_BASEPOINTPARAMETERENTITY;
7196 
7197 typedef struct _dwg_entity_FLIPPARAMETERENTITY
7198 {
7199   struct _dwg_object_entity *parent;
7200   // ??
7201 } Dwg_Entity_FLIPPARAMETERENTITY;
7202 
7203 typedef struct _dwg_entity_LINEARPARAMETERENTITY
7204 {
7205   struct _dwg_object_entity *parent;
7206   // ??
7207 } Dwg_Entity_LINEARPARAMETERENTITY;
7208 
7209 typedef struct _dwg_entity_POINTPARAMETERENTITY
7210 {
7211   struct _dwg_object_entity *parent;
7212   // ??
7213 } Dwg_Entity_POINTPARAMETERENTITY;
7214 
7215 typedef struct _dwg_entity_ROTATIONPARAMETERENTITY
7216 {
7217   struct _dwg_object_entity *parent;
7218   // ??
7219 } Dwg_Entity_ROTATIONPARAMETERENTITY;
7220 
7221 typedef struct _dwg_entity_VISIBILITYPARAMETERENTITY
7222 {
7223   struct _dwg_object_entity *parent;
7224   // ??
7225 } Dwg_Entity_VISIBILITYPARAMETERENTITY;
7226 
7227 typedef struct _dwg_entity_XYPARAMETERENTITY
7228 {
7229   struct _dwg_object_entity *parent;
7230   // ??
7231 } Dwg_Entity_XYPARAMETERENTITY;
7232 
7233 typedef struct _dwg_object_BLOCKALIGNMENTGRIP
7234 {
7235   struct _dwg_object_object *parent;
7236   BLOCKGRIP_fields;
7237   BITCODE_3BD orientation;
7238 } Dwg_Object_BLOCKALIGNMENTGRIP;
7239 
7240 typedef struct _dwg_object_BLOCKALIGNMENTPARAMETER
7241 {
7242   struct _dwg_object_object *parent;
7243   BLOCK2PTPARAMETER_fields;
7244   BITCODE_B align_perpendicular;	/* DXF 280 */
7245 } Dwg_Object_BLOCKALIGNMENTPARAMETER;
7246 
7247 typedef struct _dwg_object_BLOCKANGULARCONSTRAINTPARAMETER
7248 {
7249   struct _dwg_object_object *parent;
7250   BLOCKCONSTRAINTPARAMETER_fields;
7251   BITCODE_3BD center_pt;	/* DXF 1011 */
7252   BITCODE_3BD end_pt;	/* DXF 1012 */
7253   BITCODE_T expr_name;	/* DXF 305 */
7254   BITCODE_T expr_description;	/* DXF 306 */
7255   BITCODE_BD angle;	/* DXF 140, offset is the result */
7256   BITCODE_B orientation_on_both_grips;	/* DXF 280 */
7257   BLOCKPARAMVALUESET_fields;
7258 } Dwg_Object_BLOCKANGULARCONSTRAINTPARAMETER;
7259 
7260 typedef struct _dwg_object_BLOCKDIAMETRICCONSTRAINTPARAMETER
7261 {
7262   struct _dwg_object_object *parent;
7263   BLOCKCONSTRAINTPARAMETER_fields;
7264   BITCODE_T expr_name;  /* DXF 305, a copy of the EvalExpr name */
7265   BITCODE_T expr_description; /* DXF 306 */
7266   BITCODE_BD distance;  /* DXF 140 */
7267   BITCODE_B orientation_on_both_grips;	/* DXF 280 */
7268   BLOCKPARAMVALUESET_fields;
7269 } Dwg_Object_BLOCKDIAMETRICCONSTRAINTPARAMETER;
7270 
7271 typedef struct _dwg_object_BLOCKRADIALCONSTRAINTPARAMETER
7272 {
7273   struct _dwg_object_object *parent;
7274   BLOCKCONSTRAINTPARAMETER_fields;
7275   BITCODE_T expr_name;  /* DXF 305, a copy of the EvalExpr name */
7276   BITCODE_T expr_description; /* DXF 306 */
7277   BITCODE_BD distance;  /* DXF 140 */
7278   BLOCKPARAMVALUESET_fields;
7279 } Dwg_Object_BLOCKRADIALCONSTRAINTPARAMETER;
7280 
7281 typedef struct _dwg_object_BLOCKARRAYACTION
7282 {
7283   struct _dwg_object_object *parent;
7284   BLOCKACTION_fields;
7285   Dwg_BLOCKACTION_connectionpts conn_pts[4]; /*!< DXF 92-95, 301-304 */
7286   BITCODE_BD column_offset; /*!< DXF 140 */
7287   BITCODE_BD row_offset;    /*!< DXF 141 */
7288 } Dwg_Object_BLOCKARRAYACTION;
7289 
7290 typedef struct _dwg_object_BLOCKBASEPOINTPARAMETER
7291 {
7292   struct _dwg_object_object *parent;
7293   BLOCK1PTPARAMETER_fields;
7294   BITCODE_3BD pt;	/* DXF 1011 */
7295   BITCODE_3BD base_pt;	/* DXF 1012 */
7296 } Dwg_Object_BLOCKBASEPOINTPARAMETER;
7297 
7298 typedef struct _dwg_object_BLOCKFLIPACTION
7299 {
7300   struct _dwg_object_object *parent;
7301   BLOCKACTION_fields;
7302   Dwg_BLOCKACTION_connectionpts conn_pts[4]; /*!< DXF 92-95, 301-304 */
7303   BLOCKACTION_doubles_fields;
7304 } Dwg_Object_BLOCKFLIPACTION;
7305 
7306 typedef struct _dwg_object_BLOCKFLIPGRIP
7307 {
7308   struct _dwg_object_object *parent;
7309   BLOCKGRIP_fields;
7310   BITCODE_BL combined_state;
7311   BITCODE_3BD orientation;
7312   BITCODE_BS upd_state;
7313   BITCODE_BS state;
7314 } Dwg_Object_BLOCKFLIPGRIP;
7315 
7316 typedef struct _dwg_object_BLOCKFLIPPARAMETER
7317 {
7318   struct _dwg_object_object *parent;
7319   BLOCK2PTPARAMETER_fields;
7320   BITCODE_T flip_label;		/*!< DXF 305 */
7321   BITCODE_T flip_label_desc;	/*!< DXF 306 */
7322   BITCODE_T base_state_label;	/*!< DXF 307 */
7323   BITCODE_T flipped_state_label;/*!< DXF 308 */
7324   BITCODE_3BD def_label_pt;	/*!< DXF 1012 */
7325   BITCODE_BL bl96;		/*!< DXF 96 */
7326   BITCODE_T tooltip;		/*!< DXF 309 */
7327 } Dwg_Object_BLOCKFLIPPARAMETER;
7328 
7329 typedef struct _dwg_object_BLOCKALIGNEDCONSTRAINTPARAMETER
7330 {
7331   struct _dwg_object_object *parent;
7332   BLOCKLINEARCONSTRAINTPARAMETER_fields;
7333 } Dwg_Object_BLOCKALIGNEDCONSTRAINTPARAMETER;
7334 
7335 typedef struct _dwg_object_BLOCKLINEARCONSTRAINTPARAMETER
7336 {
7337   struct _dwg_object_object *parent;
7338   BLOCKLINEARCONSTRAINTPARAMETER_fields;
7339 } Dwg_Object_BLOCKLINEARCONSTRAINTPARAMETER;
7340 
7341 typedef struct _dwg_object_BLOCKHORIZONTALCONSTRAINTPARAMETER
7342 {
7343   struct _dwg_object_object *parent;
7344   BLOCKLINEARCONSTRAINTPARAMETER_fields;
7345 } Dwg_Object_BLOCKHORIZONTALCONSTRAINTPARAMETER;
7346 
7347 typedef struct _dwg_object_BLOCKVERTICALCONSTRAINTPARAMETER
7348 {
7349   struct _dwg_object_object *parent;
7350   BLOCKLINEARCONSTRAINTPARAMETER_fields;
7351 } Dwg_Object_BLOCKVERTICALCONSTRAINTPARAMETER;
7352 
7353 typedef struct _dwg_object_BLOCKLINEARGRIP
7354 {
7355   struct _dwg_object_object *parent;
7356   BLOCKGRIP_fields;
7357   BITCODE_3BD orientation; /* DXF 140,141,142 */
7358 } Dwg_Object_BLOCKLINEARGRIP;
7359 
7360 typedef struct _dwg_object_BLOCKLINEARPARAMETER
7361 {
7362   struct _dwg_object_object *parent;
7363   BLOCK2PTPARAMETER_fields;
7364   BITCODE_T distance_name;	/*!< DXF 305 */
7365   BITCODE_T distance_desc;	/*!< DXF 306 */
7366   BITCODE_BD distance;		/*!< DXF 306 */
7367   BLOCKPARAMVALUESET_fields;
7368 } Dwg_Object_BLOCKLINEARPARAMETER;
7369 
7370 typedef struct _dwg_BLOCKLOOKUPACTION_lut
7371 {
7372   struct _dwg_object_BLOCKLOOKUPACTION *parent;
7373   Dwg_BLOCKACTION_connectionpts conn_pts[3]; /*!< DXF 94-96, 303-305*/
7374   BITCODE_B b282;
7375   BITCODE_B b281;
7376 } Dwg_BLOCKLOOKUPACTION_lut;
7377 
7378 typedef struct _dwg_object_BLOCKLOOKUPACTION
7379 {
7380   struct _dwg_object_object *parent;
7381   BLOCKACTION_fields;
7382   BITCODE_BL numelems; /* computed */
7383   BITCODE_BL numrows; /* DXF 92 */
7384   BITCODE_BL numcols; /* DXF 93 */
7385   Dwg_BLOCKLOOKUPACTION_lut *lut;
7386   BITCODE_T *exprs;
7387   BITCODE_B b280;
7388 } Dwg_Object_BLOCKLOOKUPACTION;
7389 
7390 typedef struct _dwg_object_BLOCKLOOKUPGRIP
7391 {
7392   struct _dwg_object_object *parent;
7393   BLOCKGRIP_fields;
7394 } Dwg_Object_BLOCKLOOKUPGRIP;
7395 
7396 typedef struct _dwg_object_BLOCKLOOKUPPARAMETER
7397 {
7398   struct _dwg_object_object *parent;
7399   BLOCK1PTPARAMETER_fields;
7400   BITCODE_T lookup_name;	/*!< DXF 303 */
7401   BITCODE_T lookup_desc;	/*!< DXF 304 */
7402   BITCODE_BL index;		/*!< DXF 94 ?? */
7403   BITCODE_T unknown_t;
7404 } Dwg_Object_BLOCKLOOKUPPARAMETER;
7405 
7406 typedef struct _dwg_object_BLOCKMOVEACTION
7407 {
7408   struct _dwg_object_object *parent;
7409   BLOCKACTION_fields;
7410   Dwg_BLOCKACTION_connectionpts conn_pts[2]; /*!< DXF 92-93, 301-302 */
7411   BLOCKACTION_doubles_fields;
7412 } Dwg_Object_BLOCKMOVEACTION;
7413 
7414 typedef struct _dwg_object_BLOCKPOINTPARAMETER
7415 {
7416   struct _dwg_object_object *parent;
7417   BLOCK1PTPARAMETER_fields;
7418   BITCODE_T position_name;  /* DXF 303 */
7419   BITCODE_T position_desc;  /* DXF 304 */
7420   BITCODE_3BD def_label_pt; /* DXF 1011 */
7421 } Dwg_Object_BLOCKPOINTPARAMETER;
7422 
7423 typedef struct _dwg_object_BLOCKPOLARGRIP
7424 {
7425   struct _dwg_object_object *parent;
7426   BLOCKGRIP_fields;
7427 } Dwg_Object_BLOCKPOLARGRIP;
7428 
7429 typedef struct _dwg_object_BLOCKPOLARPARAMETER
7430 {
7431   struct _dwg_object_object *parent;
7432   BLOCK2PTPARAMETER_fields;
7433   BITCODE_T  angle_name;	/*!< DXF 305 */
7434   BITCODE_T  angle_desc;	/*!< DXF 306 */
7435   BITCODE_T  distance_name;	/*!< DXF 305 */
7436   BITCODE_T  distance_desc;	/*!< DXF 306 */
7437   BITCODE_BD  offset;		/*!< DXF 140 */
7438   Dwg_BLOCKPARAMVALUESET angle_value_set;
7439   Dwg_BLOCKPARAMVALUESET distance_value_set;
7440   //BITCODE_3BD base_angle_pt;
7441 } Dwg_Object_BLOCKPOLARPARAMETER;
7442 
7443 typedef struct _dwg_object_BLOCKPOLARSTRETCHACTION
7444 {
7445   struct _dwg_object_object *parent;
7446   BLOCKACTION_fields;
7447   Dwg_BLOCKACTION_connectionpts conn_pts[6]; /*!< DXF 92-97, 301-306 */
7448   BITCODE_BL num_pts;   // 72
7449   BITCODE_2RD *pts;     // 10
7450   BITCODE_BL num_hdls;  // 72
7451   BITCODE_H *hdls;      // 331
7452   BITCODE_BS *shorts;   // 74
7453   BITCODE_BL num_codes; // 75
7454   BITCODE_BL *codes;    // 76
7455   // ??
7456 } Dwg_Object_BLOCKPOLARSTRETCHACTION;
7457 
7458 typedef struct _dwg_object_BLOCKPROPERTIESTABLE
7459 {
7460   struct _dwg_object_object *parent;
7461   // ??
7462 } Dwg_Object_BLOCKPROPERTIESTABLE;
7463 
7464 typedef struct _dwg_object_BLOCKPROPERTIESTABLEGRIP
7465 {
7466   struct _dwg_object_object *parent;
7467   BLOCKGRIP_fields;
7468 } Dwg_Object_BLOCKPROPERTIESTABLEGRIP;
7469 
7470 typedef struct _dwg_object_BLOCKREPRESENTATION
7471 {
7472   struct _dwg_object_object *parent;
7473   BITCODE_BS flag;
7474   BITCODE_H block;
7475 } Dwg_Object_BLOCKREPRESENTATION;
7476 
7477 typedef struct _dwg_object_BLOCKROTATEACTION
7478 {
7479   struct _dwg_object_object *parent;
7480   BLOCKACTION_WITHBASEPT_fields(3);
7481 } Dwg_Object_BLOCKROTATEACTION;
7482 
7483 typedef struct _dwg_object_BLOCKROTATIONGRIP
7484 {
7485   struct _dwg_object_object *parent;
7486   BLOCKGRIP_fields;
7487 } Dwg_Object_BLOCKROTATIONGRIP;
7488 
7489 typedef struct _dwg_object_BLOCKROTATIONPARAMETER
7490 {
7491   struct _dwg_object_object *parent;
7492   BLOCK2PTPARAMETER_fields;
7493   BITCODE_3BD def_base_angle_pt;
7494   BITCODE_T angle_name;	/*!< DXF 305 */
7495   BITCODE_T angle_desc;	/*!< DXF 306 */
7496   BITCODE_BD angle;		/*!< DXF 306 */
7497   Dwg_BLOCKPARAMVALUESET angle_value_set;
7498   //BITCODE_3BD base_angle_pt;
7499 } Dwg_Object_BLOCKROTATIONPARAMETER;
7500 
7501 typedef struct _dwg_object_BLOCKSCALEACTION
7502 {
7503   struct _dwg_object_object *parent;
7504   BLOCKACTION_WITHBASEPT_fields(5);
7505 } Dwg_Object_BLOCKSCALEACTION;
7506 
7507 typedef struct _dwg_object_BLOCKSTRETCHACTION
7508 {
7509   struct _dwg_object_object *parent;
7510   BLOCKACTION_fields;
7511   Dwg_BLOCKACTION_connectionpts conn_pts[2]; /*!< DXF 92-93, 301-302 */
7512   BITCODE_BL num_pts;   // 72
7513   BITCODE_2RD *pts;     // 10
7514   BITCODE_BL num_hdls;  // 72
7515   BITCODE_H *hdls;      // 331
7516   BITCODE_BS *shorts;   // 74
7517   BITCODE_BL num_codes; // 75
7518   BITCODE_BL *codes;    // 76
7519   // ??
7520   BLOCKACTION_doubles_fields;
7521 } Dwg_Object_BLOCKSTRETCHACTION;
7522 
7523 typedef struct _dwg_object_BLOCKUSERPARAMETER
7524 {
7525   struct _dwg_object_object *parent;
7526   BLOCK1PTPARAMETER_fields;
7527   BITCODE_BS flag;		/*!< DXF 90 */
7528   BITCODE_H assocvariable;	/*!< DXF 305 */
7529   BITCODE_T expr;		/*!< DXF 301 */
7530   Dwg_EvalVariant value;
7531   BITCODE_BS type;		/*!< DXF 170 (already value.code)? */
7532 } Dwg_Object_BLOCKUSERPARAMETER;
7533 
7534 typedef struct _dwg_object_BLOCKXYGRIP
7535 {
7536   struct _dwg_object_object *parent;
7537   BLOCKGRIP_fields;
7538 } Dwg_Object_BLOCKXYGRIP;
7539 
7540 typedef struct _dwg_object_BLOCKXYPARAMETER
7541 {
7542   struct _dwg_object_object *parent;
7543   BLOCK2PTPARAMETER_fields;
7544   BITCODE_T x_label;		// DXF 305
7545   BITCODE_T x_label_desc;	// DXF 306
7546   BITCODE_T y_label;		// DXF 307
7547   BITCODE_T y_label_desc;	// DXF 308
7548   BITCODE_BD x_value;		// DXF 141
7549   BITCODE_BD y_value;		// DXF 142
7550   Dwg_BLOCKPARAMVALUESET x_value_set;
7551   Dwg_BLOCKPARAMVALUESET y_value_set;
7552 } Dwg_Object_BLOCKXYPARAMETER;
7553 
7554 typedef struct _dwg_object_DYNAMICBLOCKPROXYNODE
7555 {
7556   struct _dwg_object_object *parent;
7557   Dwg_EvalExpr evalexpr;
7558   // ??
7559 } Dwg_Object_DYNAMICBLOCKPROXYNODE;
7560 
7561 typedef struct _dwg_POINTCLOUD_IntensityStyle
7562 {
7563   struct _dwg_entity_POINTCLOUD *parent;
7564   BITCODE_BD min_intensity;		/* DXF 40 */
7565   BITCODE_BD max_intensity;		/* DXF 41 */
7566   BITCODE_BD intensity_low_treshold;	/* DXF 42 */
7567   BITCODE_BD intensity_high_treshold;	/* DXF 43 */
7568 } Dwg_POINTCLOUD_IntensityStyle;
7569 
7570 typedef struct _dwg_POINTCLOUD_Clippings
7571 {
7572   struct _dwg_entity_POINTCLOUD *parent;
7573   BITCODE_B is_inverted;
7574   BITCODE_BS type;
7575   BITCODE_BL num_vertices;
7576   BITCODE_2RD *vertices;
7577   BITCODE_BD z_min;
7578   BITCODE_BD z_max;
7579 } Dwg_POINTCLOUD_Clippings;
7580 
7581 typedef struct _dwg_POINTCLOUDEX_Croppings
7582 {
7583   struct _dwg_entity_POINTCLOUDEX *parent;
7584   BITCODE_BS type;
7585   BITCODE_B is_inside;
7586   BITCODE_B is_inverted;
7587   BITCODE_3BD crop_plane;
7588   BITCODE_3BD crop_x_dir;
7589   BITCODE_3BD crop_y_dir;
7590   BITCODE_BL num_pts;
7591   BITCODE_3BD *pts;
7592 } Dwg_POINTCLOUDEX_Croppings;
7593 
7594 typedef struct _dwg_entity_POINTCLOUD
7595 {
7596   struct _dwg_object_entity *parent;
7597   BITCODE_BS class_version; 	// 1 or 2 r2013+, DXF 70
7598   BITCODE_3BD origin;		/*!< DXF 10 */
7599   BITCODE_T saved_filename; 	/* DXF 1 */
7600   BITCODE_BL num_source_files;  /* DXF 90 */
7601   BITCODE_T *source_files;	/*!< DXF 2 */
7602   BITCODE_3BD extents_min;	/*!< DXF 11 */
7603   BITCODE_3BD extents_max;	/*!< DXF 12 */
7604   BITCODE_RLL numpoints;	/*!< DXF 92 */
7605   BITCODE_T  ucs_name;		/*!< DXF 3 */
7606   BITCODE_3BD ucs_origin;	/*!< DXF 13 */
7607   BITCODE_3BD ucs_x_dir;	/*!< DXF 210 */
7608   BITCODE_3BD ucs_y_dir;	/*!< DXF 211 */
7609   BITCODE_3BD ucs_z_dir;	/*!< DXF 212 */
7610   // r2013+:
7611   BITCODE_H pointclouddef;	/*!< DXF 330 */
7612   BITCODE_H reactor;		/*!< DXF 360 */
7613   BITCODE_B show_intensity;	/*!< DXF ? */
7614   BITCODE_BS intensity_scheme;	/*!< DXF 71 */
7615   Dwg_POINTCLOUD_IntensityStyle intensity_style;
7616   BITCODE_B show_clipping;	/*!< DXF ? */
7617   BITCODE_BL num_clippings;	/*!< DXF ? */
7618   Dwg_POINTCLOUD_Clippings *clippings;
7619 } Dwg_Entity_POINTCLOUD;
7620 
7621 typedef struct _dwg_entity_POINTCLOUDEX
7622 {
7623   struct _dwg_object_entity *parent;
7624   BITCODE_BS class_version; 	// 1, DXF 70
7625   BITCODE_3BD extents_min;	/*!< DXF 10 */
7626   BITCODE_3BD extents_max;	/*!< DXF 11 */
7627   BITCODE_3BD ucs_origin;	/*!< DXF 13 */
7628   BITCODE_3BD ucs_x_dir;	/*!< DXF 210 */
7629   BITCODE_3BD ucs_y_dir;	/*!< DXF 211 */
7630   BITCODE_3BD ucs_z_dir;	/*!< DXF 212 */
7631   BITCODE_B is_locked;		/*!< DXF 290 */
7632   BITCODE_H pointclouddefex;	/*!< DXF 330 */
7633   BITCODE_H reactor;		/*!< DXF 360 */
7634   BITCODE_T name; 		/* DXF 1 */
7635   BITCODE_B show_intensity;	/*!< DXF 291 */
7636 
7637   BITCODE_BS stylization_type;	/*!< DXF 71 */
7638   BITCODE_T intensity_colorscheme;	/*!< ? DXF 1 */
7639   BITCODE_T cur_colorscheme;	/*!< DXF 1 */
7640   BITCODE_T classification_colorscheme;	/*!< ? DXF 1 */
7641   BITCODE_BD elevation_min;	/* DXF 40 */
7642   BITCODE_BD elevation_max;	/* DXF 41 */
7643   BITCODE_BL intensity_min;	/* DXF 90 */
7644   BITCODE_BL intensity_max;	/* DXF 91 */
7645   BITCODE_BS intensity_out_of_range_behavior;	/* DXF 70 */
7646   BITCODE_BS elevation_out_of_range_behavior;	/* DXF 71 */
7647   BITCODE_B elevation_apply_to_fixed_range;	/* DXF 292 */
7648   BITCODE_B intensity_as_gradient;	/* DXF 293 */
7649   BITCODE_B elevation_as_gradient;	/* DXF 294 */
7650   BITCODE_B show_cropping;	/*!< DXF 295 */
7651   BITCODE_BL unknown_bl0;	/*!< ? DXF 93 */
7652   BITCODE_BL unknown_bl1;	/*!< ? DXF 93 */
7653   BITCODE_BL num_croppings;	/*!< DXF 92 */
7654   Dwg_POINTCLOUDEX_Croppings *croppings;
7655 } Dwg_Entity_POINTCLOUDEX;
7656 
7657 typedef struct _dwg_object_POINTCLOUDDEF
7658 {
7659   struct _dwg_object_object *parent;
7660   BITCODE_BL class_version; 	// 1 or 2 r2013+, DXF 90
7661   BITCODE_T source_filename; 	/* DXF 1 */
7662   BITCODE_B is_loaded;		/* DXF 280 */
7663   BITCODE_RLL numpoints;	/*!< DXF 91 (hi) + 92 (lo) / 160 */
7664   BITCODE_3BD extents_min;	/*!< DXF 10 */
7665   BITCODE_3BD extents_max;	/*!< DXF 11 */
7666 } Dwg_Object_POINTCLOUDDEF;
7667 
7668 typedef struct _dwg_object_POINTCLOUDDEFEX
7669 {
7670   struct _dwg_object_object *parent;
7671   BITCODE_BL class_version; 	// 1 or 2 r2013+, DXF 90
7672   BITCODE_T source_filename; 	/* DXF 1 */
7673   BITCODE_B is_loaded;		/* DXF 280 */
7674   BITCODE_RLL numpoints;	/*!< DXF 169 */
7675   BITCODE_3BD extents_min;	/*!< DXF 10 */
7676   BITCODE_3BD extents_max;	/*!< DXF 11 */
7677 } Dwg_Object_POINTCLOUDDEFEX;
7678 
7679 typedef struct _dwg_object_POINTCLOUDDEF_REACTOR
7680 {
7681   struct _dwg_object_object *parent;
7682   BITCODE_BL class_version; // 1
7683 } Dwg_Object_POINTCLOUDDEF_REACTOR;
7684 
7685 typedef struct _dwg_object_POINTCLOUDDEF_REACTOR_EX
7686 {
7687   struct _dwg_object_object *parent;
7688   BITCODE_BL class_version; // 1
7689 } Dwg_Object_POINTCLOUDDEF_REACTOR_EX;
7690 
7691 typedef struct _dwg_ColorRamp
7692 {
7693   struct _dwg_POINTCLOUDCOLORMAP_Ramp *parent;
7694   // FIXME either
7695   BITCODE_T colorscheme;	// DXF 1
7696   /// or
7697   BITCODE_BL unknown_bl;	// DXF 91
7698   BITCODE_B unknown_b;		// DXF 290
7699 } Dwg_ColorRamp;
7700 
7701 typedef struct _dwg_POINTCLOUDCOLORMAP_Ramp
7702 {
7703   struct _dwg_object_POINTCLOUDCOLORMAP *parent;
7704   BITCODE_BS class_version;	// DXF 70: 1
7705   BITCODE_BL num_ramps;		// DXF 90
7706   Dwg_ColorRamp *ramps;
7707 } Dwg_POINTCLOUDCOLORMAP_Ramp;
7708 
7709 typedef struct _dwg_object_POINTCLOUDCOLORMAP
7710 {
7711   struct _dwg_object_object *parent;
7712   BITCODE_BS class_version;
7713   BITCODE_T def_intensity_colorscheme;	/*!< DXF 1 */
7714   BITCODE_T def_elevation_colorscheme;	/*!< DXF 1 */
7715   BITCODE_T def_classification_colorscheme;	/*!< DXF 1 */
7716   BITCODE_BL num_colorramps;
7717   Dwg_POINTCLOUDCOLORMAP_Ramp *colorramps;
7718   BITCODE_BL num_classification_colorramps;
7719   Dwg_POINTCLOUDCOLORMAP_Ramp *classification_colorramps;
7720 } Dwg_Object_POINTCLOUDCOLORMAP;
7721 
7722 // unhandled. some subclass
7723 typedef struct _dwg_COMPOUNDOBJECTID
7724 {
7725   struct _dwg_object_object *parent;
7726   BITCODE_B has_object;
7727   BITCODE_T name;
7728   BITCODE_H object;
7729 } Dwg_COMPOUNDOBJECTID;
7730 
7731 // ODA Arx
7732 //typedef Dwg_Object_LAYERFILTER Dwg_Object_PARTIAL_VIEWING_FILTER;
7733 
7734 typedef struct _dwg_PARTIAL_VIEWING_INDEX_Entry
7735 {
7736   struct _dwg_object_PARTIAL_VIEWING_INDEX *parent;
7737   BITCODE_3BD extents_min;
7738   BITCODE_3BD extents_max;
7739   BITCODE_H object;
7740 } Dwg_PARTIAL_VIEWING_INDEX_Entry;
7741 
7742 typedef struct _dwg_object_PARTIAL_VIEWING_INDEX
7743 {
7744   struct _dwg_object_object *parent;
7745   BITCODE_BL num_entries;
7746   BITCODE_B has_entries;
7747   Dwg_PARTIAL_VIEWING_INDEX_Entry *entries;
7748 } Dwg_Object_PARTIAL_VIEWING_INDEX;
7749 
7750 
7751 /**
7752  -----------------------------------
7753  */
7754 
7755 /**
7756  Unknown Class entity, a blob
7757  */
7758 typedef struct _dwg_entity_UNKNOWN_ENT
7759 {
7760   struct _dwg_object_entity *parent;
7761 } Dwg_Entity_UNKNOWN_ENT;
7762 
7763 /**
7764  Unknown Class object, a blob
7765  */
7766 typedef struct _dwg_object_UNKNOWN_OBJ
7767 {
7768   struct _dwg_object_object *parent;
7769 } Dwg_Object_UNKNOWN_OBJ;
7770 
7771 /* OBJECTS - END ************************************************************/
7772 
7773 /**
7774  Extended entity data: dxf group - value pairs, similar to xdata
7775  */
7776 #pragma pack(1)
7777 typedef struct _dwg_entity_eed_data
7778 {
7779   BITCODE_RC code;
7780   union eed_data_t {
7781     struct { /* 0 (1000) string */
7782       BITCODE_RS length;          /* RC */
7783       unsigned short codepage:15; /* RS_LE */
7784       unsigned short is_tu:1;
7785       char string[1];      /* inlined */
7786     } eed_0;
7787     struct { /* R2007+ 0 (1000) string */
7788       BITCODE_RS length;
7789       unsigned short _padding:15;
7790       unsigned short is_tu:1;
7791       DWGCHAR string[1]; /* inlined */
7792     } eed_0_r2007;
7793     struct { /* 1 (1001) handle, not in data */
7794       char invalid[1]; // set the eed[0].handle to the used APPID instead
7795     } eed_1;
7796     struct { /* 2 (1002) "{" => 0 open, or "}" => 1 close */
7797       BITCODE_RC close;
7798     } eed_2;
7799     struct { /* 3 (1003) layer (8-byte handle value) */
7800       BITCODE_RLL layer;
7801     } eed_3;
7802     struct { /* 4 (1004) binary */
7803       BITCODE_RC length;
7804       unsigned char data[1]; // inlined
7805     } eed_4;
7806     struct { /* 5 (1005) entity */
7807       unsigned long entity;
7808     } eed_5;
7809     struct { /* 10-13 point */
7810       BITCODE_3RD point;
7811     } eed_10;
7812     struct { /* 40-42 real */
7813       BITCODE_RD real;
7814     } eed_40;
7815     struct { /* 70 short int */
7816       BITCODE_RS rs;
7817     } eed_70;
7818     struct { /* 71 long int */
7819       BITCODE_RL rl;
7820     } eed_71;
7821   } u;
7822 } Dwg_Eed_Data;
7823 #pragma pack()
7824 
7825 /**
7826  Extended entity data
7827  */
7828 typedef struct _dwg_entity_eed
7829 {
7830   BITCODE_BS size;
7831   Dwg_Handle handle;
7832   Dwg_Eed_Data *data;
7833   BITCODE_TF raw; /* a binary copy of the data */
7834 } Dwg_Eed;
7835 
7836 /**
7837  Common entity attributes
7838  */
7839 typedef struct _dwg_object_entity
7840 {
7841   BITCODE_BL objid; /*!< link to the parent */
7842   union
7843   {
7844     Dwg_Entity_UNUSED *UNUSED;
7845     Dwg_DIMENSION_common *DIMENSION_common;
7846     /* Start auto-generated entity-union. Do not touch. */
7847     Dwg_Entity__3DFACE *_3DFACE;
7848     Dwg_Entity__3DSOLID *_3DSOLID;
7849     Dwg_Entity_ARC *ARC;
7850     Dwg_Entity_ATTDEF *ATTDEF;
7851     Dwg_Entity_ATTRIB *ATTRIB;
7852     Dwg_Entity_BLOCK *BLOCK;
7853     Dwg_Entity_BODY *BODY;
7854     Dwg_Entity_CIRCLE *CIRCLE;
7855     Dwg_Entity_DIMENSION_ALIGNED *DIMENSION_ALIGNED;
7856     Dwg_Entity_DIMENSION_ANG2LN *DIMENSION_ANG2LN;
7857     Dwg_Entity_DIMENSION_ANG3PT *DIMENSION_ANG3PT;
7858     Dwg_Entity_DIMENSION_DIAMETER *DIMENSION_DIAMETER;
7859     Dwg_Entity_DIMENSION_LINEAR *DIMENSION_LINEAR;
7860     Dwg_Entity_DIMENSION_ORDINATE *DIMENSION_ORDINATE;
7861     Dwg_Entity_DIMENSION_RADIUS *DIMENSION_RADIUS;
7862     Dwg_Entity_ELLIPSE *ELLIPSE;
7863     Dwg_Entity_ENDBLK *ENDBLK;
7864     Dwg_Entity_INSERT *INSERT;
7865     Dwg_Entity_LEADER *LEADER;
7866     Dwg_Entity_LINE *LINE;
7867     Dwg_Entity_MINSERT *MINSERT;
7868     Dwg_Entity_MLINE *MLINE;
7869     Dwg_Entity_MTEXT *MTEXT;
7870     Dwg_Entity_OLEFRAME *OLEFRAME;
7871     Dwg_Entity_POINT *POINT;
7872     Dwg_Entity_POLYLINE_2D *POLYLINE_2D;
7873     Dwg_Entity_POLYLINE_3D *POLYLINE_3D;
7874     Dwg_Entity_POLYLINE_MESH *POLYLINE_MESH;
7875     Dwg_Entity_POLYLINE_PFACE *POLYLINE_PFACE;
7876     Dwg_Entity_PROXY_ENTITY *PROXY_ENTITY;
7877     Dwg_Entity_RAY *RAY;
7878     Dwg_Entity_REGION *REGION;
7879     Dwg_Entity_SEQEND *SEQEND;
7880     Dwg_Entity_SHAPE *SHAPE;
7881     Dwg_Entity_SOLID *SOLID;
7882     Dwg_Entity_SPLINE *SPLINE;
7883     Dwg_Entity_TEXT *TEXT;
7884     Dwg_Entity_TOLERANCE *TOLERANCE;
7885     Dwg_Entity_TRACE *TRACE;
7886     Dwg_Entity_UNKNOWN_ENT *UNKNOWN_ENT;
7887     Dwg_Entity_VERTEX_2D *VERTEX_2D;
7888     Dwg_Entity_VERTEX_3D *VERTEX_3D;
7889     Dwg_Entity_VERTEX_MESH *VERTEX_MESH;
7890     Dwg_Entity_VERTEX_PFACE *VERTEX_PFACE;
7891     Dwg_Entity_VERTEX_PFACE_FACE *VERTEX_PFACE_FACE;
7892     Dwg_Entity_VIEWPORT *VIEWPORT;
7893     Dwg_Entity_XLINE *XLINE;
7894     /* untyped > 500 */
7895     Dwg_Entity_CAMERA *CAMERA;
7896     Dwg_Entity_DGNUNDERLAY *DGNUNDERLAY;
7897     Dwg_Entity_DWFUNDERLAY *DWFUNDERLAY;
7898     Dwg_Entity_HATCH *HATCH;
7899     Dwg_Entity_IMAGE *IMAGE;
7900     Dwg_Entity_LIGHT *LIGHT;
7901     Dwg_Entity_LWPOLYLINE *LWPOLYLINE;
7902     Dwg_Entity_MESH *MESH;
7903     Dwg_Entity_MULTILEADER *MULTILEADER;
7904     Dwg_Entity_OLE2FRAME *OLE2FRAME;
7905     Dwg_Entity_PDFUNDERLAY *PDFUNDERLAY;
7906     Dwg_Entity_SECTIONOBJECT *SECTIONOBJECT;
7907     /* unstable */
7908     Dwg_Entity_ARC_DIMENSION *ARC_DIMENSION;
7909     Dwg_Entity_HELIX *HELIX;
7910     Dwg_Entity_LARGE_RADIAL_DIMENSION *LARGE_RADIAL_DIMENSION;
7911     Dwg_Entity_PLANESURFACE *PLANESURFACE;
7912     Dwg_Entity_POINTCLOUD *POINTCLOUD;
7913     Dwg_Entity_POINTCLOUDEX *POINTCLOUDEX;
7914     Dwg_Entity_WIPEOUT *WIPEOUT;
7915     /* debugging */
7916     Dwg_Entity_ALIGNMENTPARAMETERENTITY *ALIGNMENTPARAMETERENTITY;
7917     Dwg_Entity_ARCALIGNEDTEXT *ARCALIGNEDTEXT;
7918     Dwg_Entity_BASEPOINTPARAMETERENTITY *BASEPOINTPARAMETERENTITY;
7919     Dwg_Entity_EXTRUDEDSURFACE *EXTRUDEDSURFACE;
7920     Dwg_Entity_FLIPPARAMETERENTITY *FLIPPARAMETERENTITY;
7921     Dwg_Entity_GEOPOSITIONMARKER *GEOPOSITIONMARKER;
7922     Dwg_Entity_LINEARPARAMETERENTITY *LINEARPARAMETERENTITY;
7923     Dwg_Entity_LOFTEDSURFACE *LOFTEDSURFACE;
7924     Dwg_Entity_MPOLYGON *MPOLYGON;
7925     Dwg_Entity_NAVISWORKSMODEL *NAVISWORKSMODEL;
7926     Dwg_Entity_NURBSURFACE *NURBSURFACE;
7927     Dwg_Entity_POINTPARAMETERENTITY *POINTPARAMETERENTITY;
7928     Dwg_Entity_POLARGRIPENTITY *POLARGRIPENTITY;
7929     Dwg_Entity_REVOLVEDSURFACE *REVOLVEDSURFACE;
7930     Dwg_Entity_ROTATIONPARAMETERENTITY *ROTATIONPARAMETERENTITY;
7931     Dwg_Entity_RTEXT *RTEXT;
7932     Dwg_Entity_SWEPTSURFACE *SWEPTSURFACE;
7933     Dwg_Entity_TABLE *TABLE;
7934     Dwg_Entity_VISIBILITYGRIPENTITY *VISIBILITYGRIPENTITY;
7935     Dwg_Entity_VISIBILITYPARAMETERENTITY *VISIBILITYPARAMETERENTITY;
7936     Dwg_Entity_XYPARAMETERENTITY *XYPARAMETERENTITY;
7937     /* End auto-generated entity-union */
7938   } tio;
7939 
7940   struct _dwg_struct *dwg;
7941   BITCODE_BL num_eed;
7942   Dwg_Eed *eed; /* see also Dwg_Resbuf* xdata */
7943 
7944   /* Common Entity Data */
7945   BITCODE_B   preview_exists;
7946   BITCODE_B   preview_is_proxy; /* calculated */
7947   BITCODE_BLL preview_size;     /*!< DXF 160 for bitmaps, DXF 92 for PROXY vector data.
7948                                   e.g. INSERT, MULTILEADER */
7949   BITCODE_TF preview;           /*!< DXF 310 */
7950   BITCODE_BB entmode;           /*!< has no owner handle:
7951                                   0 has no ownerhandle, 1 is PSPACE, 2 is MSPACE
7952                                   3 has ownerhandle. */
7953   BITCODE_BL num_reactors;
7954   BITCODE_B is_xdic_missing;  /*!< r2004+ */
7955   BITCODE_B isbylayerlt;        /*!< r13-r14 */
7956   BITCODE_B nolinks;            /*!< r13-r2000 */
7957   BITCODE_B has_ds_data;        /*!< r2013+ AcDs datastore */
7958   BITCODE_CMC color;
7959   BITCODE_BD ltype_scale;
7960   BITCODE_BB ltype_flags;       /*!< r2000+ */
7961   BITCODE_BB plotstyle_flags;   /*!< r2000+ */
7962   BITCODE_BB material_flags;    /*!< r2007+ */
7963   BITCODE_RC shadow_flags;      /*!< r2007+: 0 both, 1 casts, 2, receives,
7964                                   3 has handle. DXF 284 */
7965   BITCODE_B has_full_visualstyle; /*!< r2010+ */
7966   BITCODE_B has_face_visualstyle; /*!< r2010+ */
7967   BITCODE_B has_edge_visualstyle; /*!< r2010+ */
7968   BITCODE_BS invisible;
7969   BITCODE_RC linewt;              /*!< r2000+, see dxf_cvt_lweight() */
7970 
7971   /* preR13 entity fields. TODO a union */
7972   BITCODE_RC flag_r11;
7973   BITCODE_RS kind_r11;
7974   BITCODE_RS opts_r11;
7975   BITCODE_RC extra_r11;
7976   BITCODE_RS layer_r11;
7977   BITCODE_RC color_r11;
7978   BITCODE_RS ltype_r11;
7979   BITCODE_RD elevation_r11;
7980   BITCODE_RD thickness_r11;
7981   BITCODE_RS paper_r11;
7982   /* preR13 in the obj: eed, elevation/pt.z, thickness, paper */
7983 
7984   /* Common Entity Handle Data */
7985   BITCODE_BL __iterator;
7986   BITCODE_H ownerhandle;   /*!< code 5, DXF 330 mspace, pspace or owner of subentity */
7987   BITCODE_H* reactors;     /*!< r13+ code 4, DXF 102 {ACAD_XDICTIONARY, 330 */
7988   BITCODE_H xdicobjhandle; /*!< r13+ code 3, DXF 102 {ACAD_REACTORS, 360 */
7989   BITCODE_H prev_entity;  /*!< r13-r2000 code 4 */
7990   BITCODE_H next_entity;  /*!< r13-r2000 code 4 */
7991   BITCODE_H layer;        /*!< code 5, DXF 8 */
7992   BITCODE_H ltype;        /*!< code 5, DXF 6 */
7993   BITCODE_H material;     /*!< r2007+ code 5, DXF 347 */
7994   BITCODE_H shadow;       /*!< r2007+ code 5 no DXF */
7995   BITCODE_H plotstyle;    /*!< r2000+ code 5, DXF 390 */
7996   BITCODE_H full_visualstyle; /*!< r2010+ code 5, DXF 348 */
7997   BITCODE_H face_visualstyle;
7998   BITCODE_H edge_visualstyle;
7999 } Dwg_Object_Entity;
8000 
8001 /**
8002  Ordinary object attributes
8003  */
8004 typedef struct _dwg_object_object
8005 {
8006   BITCODE_BL objid; /*!< link to the parent */
8007   union
8008   {
8009     /* Start auto-generated object-union. Do not touch. */
8010     Dwg_Object_APPID *APPID;
8011     Dwg_Object_APPID_CONTROL *APPID_CONTROL;
8012     Dwg_Object_BLOCK_CONTROL *BLOCK_CONTROL;
8013     Dwg_Object_BLOCK_HEADER *BLOCK_HEADER;
8014     Dwg_Object_DICTIONARY *DICTIONARY;
8015     Dwg_Object_DIMSTYLE *DIMSTYLE;
8016     Dwg_Object_DIMSTYLE_CONTROL *DIMSTYLE_CONTROL;
8017     Dwg_Object_DUMMY *DUMMY;
8018     Dwg_Object_LAYER *LAYER;
8019     Dwg_Object_LAYER_CONTROL *LAYER_CONTROL;
8020     Dwg_Object_LONG_TRANSACTION *LONG_TRANSACTION;
8021     Dwg_Object_LTYPE *LTYPE;
8022     Dwg_Object_LTYPE_CONTROL *LTYPE_CONTROL;
8023     Dwg_Object_MLINESTYLE *MLINESTYLE;
8024     Dwg_Object_STYLE *STYLE;
8025     Dwg_Object_STYLE_CONTROL *STYLE_CONTROL;
8026     Dwg_Object_UCS *UCS;
8027     Dwg_Object_UCS_CONTROL *UCS_CONTROL;
8028     Dwg_Object_UNKNOWN_OBJ *UNKNOWN_OBJ;
8029     Dwg_Object_VIEW *VIEW;
8030     Dwg_Object_VIEW_CONTROL *VIEW_CONTROL;
8031     Dwg_Object_VPORT *VPORT;
8032     Dwg_Object_VPORT_CONTROL *VPORT_CONTROL;
8033     Dwg_Object_VX_CONTROL *VX_CONTROL;
8034     Dwg_Object_VX_TABLE_RECORD *VX_TABLE_RECORD;
8035     /* untyped > 500 */
8036     Dwg_Object_ACSH_BOOLEAN_CLASS *ACSH_BOOLEAN_CLASS;
8037     Dwg_Object_ACSH_BOX_CLASS *ACSH_BOX_CLASS;
8038     Dwg_Object_ACSH_CONE_CLASS *ACSH_CONE_CLASS;
8039     Dwg_Object_ACSH_CYLINDER_CLASS *ACSH_CYLINDER_CLASS;
8040     Dwg_Object_ACSH_FILLET_CLASS *ACSH_FILLET_CLASS;
8041     Dwg_Object_ACSH_HISTORY_CLASS *ACSH_HISTORY_CLASS;
8042     Dwg_Object_ACSH_SPHERE_CLASS *ACSH_SPHERE_CLASS;
8043     Dwg_Object_ACSH_TORUS_CLASS *ACSH_TORUS_CLASS;
8044     Dwg_Object_ACSH_WEDGE_CLASS *ACSH_WEDGE_CLASS;
8045     Dwg_Object_BLOCKALIGNMENTGRIP *BLOCKALIGNMENTGRIP;
8046     Dwg_Object_BLOCKALIGNMENTPARAMETER *BLOCKALIGNMENTPARAMETER;
8047     Dwg_Object_BLOCKBASEPOINTPARAMETER *BLOCKBASEPOINTPARAMETER;
8048     Dwg_Object_BLOCKFLIPACTION *BLOCKFLIPACTION;
8049     Dwg_Object_BLOCKFLIPGRIP *BLOCKFLIPGRIP;
8050     Dwg_Object_BLOCKFLIPPARAMETER *BLOCKFLIPPARAMETER;
8051     Dwg_Object_BLOCKGRIPLOCATIONCOMPONENT *BLOCKGRIPLOCATIONCOMPONENT;
8052     Dwg_Object_BLOCKLINEARGRIP *BLOCKLINEARGRIP;
8053     Dwg_Object_BLOCKLOOKUPGRIP *BLOCKLOOKUPGRIP;
8054     Dwg_Object_BLOCKMOVEACTION *BLOCKMOVEACTION;
8055     Dwg_Object_BLOCKROTATEACTION *BLOCKROTATEACTION;
8056     Dwg_Object_BLOCKROTATIONGRIP *BLOCKROTATIONGRIP;
8057     Dwg_Object_BLOCKSCALEACTION *BLOCKSCALEACTION;
8058     Dwg_Object_BLOCKVISIBILITYGRIP *BLOCKVISIBILITYGRIP;
8059     Dwg_Object_CELLSTYLEMAP *CELLSTYLEMAP;
8060     Dwg_Object_DETAILVIEWSTYLE *DETAILVIEWSTYLE;
8061     Dwg_Object_DICTIONARYVAR *DICTIONARYVAR;
8062     Dwg_Object_DICTIONARYWDFLT *DICTIONARYWDFLT;
8063     Dwg_Object_DYNAMICBLOCKPURGEPREVENTER *DYNAMICBLOCKPURGEPREVENTER;
8064     Dwg_Object_FIELD *FIELD;
8065     Dwg_Object_FIELDLIST *FIELDLIST;
8066     Dwg_Object_GEODATA *GEODATA;
8067     Dwg_Object_GROUP *GROUP;
8068     Dwg_Object_IDBUFFER *IDBUFFER;
8069     Dwg_Object_IMAGEDEF *IMAGEDEF;
8070     Dwg_Object_IMAGEDEF_REACTOR *IMAGEDEF_REACTOR;
8071     Dwg_Object_INDEX *INDEX;
8072     Dwg_Object_LAYERFILTER *LAYERFILTER;
8073     Dwg_Object_LAYER_INDEX *LAYER_INDEX;
8074     Dwg_Object_LAYOUT *LAYOUT;
8075     Dwg_Object_MLEADERSTYLE *MLEADERSTYLE;
8076     Dwg_Object_PLACEHOLDER *PLACEHOLDER;
8077     Dwg_Object_PLOTSETTINGS *PLOTSETTINGS;
8078     Dwg_Object_RASTERVARIABLES *RASTERVARIABLES;
8079     Dwg_Object_SCALE *SCALE;
8080     Dwg_Object_SECTIONVIEWSTYLE *SECTIONVIEWSTYLE;
8081     Dwg_Object_SECTION_MANAGER *SECTION_MANAGER;
8082     Dwg_Object_SORTENTSTABLE *SORTENTSTABLE;
8083     Dwg_Object_SPATIAL_FILTER *SPATIAL_FILTER;
8084     Dwg_Object_TABLEGEOMETRY *TABLEGEOMETRY;
8085     Dwg_Object_VBA_PROJECT *VBA_PROJECT;
8086     Dwg_Object_VISUALSTYLE *VISUALSTYLE;
8087     Dwg_Object_WIPEOUTVARIABLES *WIPEOUTVARIABLES;
8088     Dwg_Object_XRECORD *XRECORD;
8089     Dwg_Object_PDFDEFINITION *PDFDEFINITION;
8090     Dwg_Object_DGNDEFINITION *DGNDEFINITION;
8091     Dwg_Object_DWFDEFINITION *DWFDEFINITION;
8092     /* unstable */
8093     Dwg_Object_ACSH_BREP_CLASS *ACSH_BREP_CLASS;
8094     Dwg_Object_ACSH_CHAMFER_CLASS *ACSH_CHAMFER_CLASS;
8095     Dwg_Object_ACSH_PYRAMID_CLASS *ACSH_PYRAMID_CLASS;
8096     Dwg_Object_ALDIMOBJECTCONTEXTDATA *ALDIMOBJECTCONTEXTDATA;
8097     Dwg_Object_ASSOC2DCONSTRAINTGROUP *ASSOC2DCONSTRAINTGROUP;
8098     Dwg_Object_ASSOCACTION *ASSOCACTION;
8099     Dwg_Object_ASSOCACTIONPARAM *ASSOCACTIONPARAM;
8100     Dwg_Object_ASSOCARRAYACTIONBODY *ASSOCARRAYACTIONBODY;
8101     Dwg_Object_ASSOCASMBODYACTIONPARAM *ASSOCASMBODYACTIONPARAM;
8102     Dwg_Object_ASSOCBLENDSURFACEACTIONBODY *ASSOCBLENDSURFACEACTIONBODY;
8103     Dwg_Object_ASSOCCOMPOUNDACTIONPARAM *ASSOCCOMPOUNDACTIONPARAM;
8104     Dwg_Object_ASSOCDEPENDENCY *ASSOCDEPENDENCY;
8105     Dwg_Object_ASSOCDIMDEPENDENCYBODY *ASSOCDIMDEPENDENCYBODY;
8106     Dwg_Object_ASSOCEXTENDSURFACEACTIONBODY *ASSOCEXTENDSURFACEACTIONBODY;
8107     Dwg_Object_ASSOCEXTRUDEDSURFACEACTIONBODY *ASSOCEXTRUDEDSURFACEACTIONBODY;
8108     Dwg_Object_ASSOCFACEACTIONPARAM *ASSOCFACEACTIONPARAM;
8109     Dwg_Object_ASSOCFILLETSURFACEACTIONBODY *ASSOCFILLETSURFACEACTIONBODY;
8110     Dwg_Object_ASSOCGEOMDEPENDENCY *ASSOCGEOMDEPENDENCY;
8111     Dwg_Object_ASSOCLOFTEDSURFACEACTIONBODY *ASSOCLOFTEDSURFACEACTIONBODY;
8112     Dwg_Object_ASSOCNETWORK *ASSOCNETWORK;
8113     Dwg_Object_ASSOCNETWORKSURFACEACTIONBODY *ASSOCNETWORKSURFACEACTIONBODY;
8114     Dwg_Object_ASSOCOBJECTACTIONPARAM *ASSOCOBJECTACTIONPARAM;
8115     Dwg_Object_ASSOCOFFSETSURFACEACTIONBODY *ASSOCOFFSETSURFACEACTIONBODY;
8116     Dwg_Object_ASSOCOSNAPPOINTREFACTIONPARAM *ASSOCOSNAPPOINTREFACTIONPARAM;
8117     Dwg_Object_ASSOCPATCHSURFACEACTIONBODY *ASSOCPATCHSURFACEACTIONBODY;
8118     Dwg_Object_ASSOCPATHACTIONPARAM *ASSOCPATHACTIONPARAM;
8119     Dwg_Object_ASSOCPLANESURFACEACTIONBODY *ASSOCPLANESURFACEACTIONBODY;
8120     Dwg_Object_ASSOCPOINTREFACTIONPARAM *ASSOCPOINTREFACTIONPARAM;
8121     Dwg_Object_ASSOCREVOLVEDSURFACEACTIONBODY *ASSOCREVOLVEDSURFACEACTIONBODY;
8122     Dwg_Object_ASSOCTRIMSURFACEACTIONBODY *ASSOCTRIMSURFACEACTIONBODY;
8123     Dwg_Object_ASSOCVALUEDEPENDENCY *ASSOCVALUEDEPENDENCY;
8124     Dwg_Object_ASSOCVARIABLE *ASSOCVARIABLE;
8125     Dwg_Object_ASSOCVERTEXACTIONPARAM *ASSOCVERTEXACTIONPARAM;
8126     Dwg_Object_BLKREFOBJECTCONTEXTDATA *BLKREFOBJECTCONTEXTDATA;
8127     Dwg_Object_BLOCKALIGNEDCONSTRAINTPARAMETER *BLOCKALIGNEDCONSTRAINTPARAMETER;
8128     Dwg_Object_BLOCKANGULARCONSTRAINTPARAMETER *BLOCKANGULARCONSTRAINTPARAMETER;
8129     Dwg_Object_BLOCKARRAYACTION *BLOCKARRAYACTION;
8130     Dwg_Object_BLOCKDIAMETRICCONSTRAINTPARAMETER *BLOCKDIAMETRICCONSTRAINTPARAMETER;
8131     Dwg_Object_BLOCKHORIZONTALCONSTRAINTPARAMETER *BLOCKHORIZONTALCONSTRAINTPARAMETER;
8132     Dwg_Object_BLOCKLINEARCONSTRAINTPARAMETER *BLOCKLINEARCONSTRAINTPARAMETER;
8133     Dwg_Object_BLOCKLINEARPARAMETER *BLOCKLINEARPARAMETER;
8134     Dwg_Object_BLOCKLOOKUPACTION *BLOCKLOOKUPACTION;
8135     Dwg_Object_BLOCKLOOKUPPARAMETER *BLOCKLOOKUPPARAMETER;
8136     Dwg_Object_BLOCKPARAMDEPENDENCYBODY *BLOCKPARAMDEPENDENCYBODY;
8137     Dwg_Object_BLOCKPOINTPARAMETER *BLOCKPOINTPARAMETER;
8138     Dwg_Object_BLOCKPOLARGRIP *BLOCKPOLARGRIP;
8139     Dwg_Object_BLOCKPOLARPARAMETER *BLOCKPOLARPARAMETER;
8140     Dwg_Object_BLOCKPOLARSTRETCHACTION *BLOCKPOLARSTRETCHACTION;
8141     Dwg_Object_BLOCKRADIALCONSTRAINTPARAMETER *BLOCKRADIALCONSTRAINTPARAMETER;
8142     Dwg_Object_BLOCKREPRESENTATION *BLOCKREPRESENTATION;
8143     Dwg_Object_BLOCKROTATIONPARAMETER *BLOCKROTATIONPARAMETER;
8144     Dwg_Object_BLOCKSTRETCHACTION *BLOCKSTRETCHACTION;
8145     Dwg_Object_BLOCKUSERPARAMETER *BLOCKUSERPARAMETER;
8146     Dwg_Object_BLOCKVERTICALCONSTRAINTPARAMETER *BLOCKVERTICALCONSTRAINTPARAMETER;
8147     Dwg_Object_BLOCKVISIBILITYPARAMETER *BLOCKVISIBILITYPARAMETER;
8148     Dwg_Object_BLOCKXYGRIP *BLOCKXYGRIP;
8149     Dwg_Object_BLOCKXYPARAMETER *BLOCKXYPARAMETER;
8150     Dwg_Object_DATALINK *DATALINK;
8151     Dwg_Object_DBCOLOR *DBCOLOR;
8152     Dwg_Object_EVALUATION_GRAPH *EVALUATION_GRAPH;
8153     Dwg_Object_FCFOBJECTCONTEXTDATA *FCFOBJECTCONTEXTDATA;
8154     Dwg_Object_GRADIENT_BACKGROUND *GRADIENT_BACKGROUND;
8155     Dwg_Object_GROUND_PLANE_BACKGROUND *GROUND_PLANE_BACKGROUND;
8156     Dwg_Object_IBL_BACKGROUND *IBL_BACKGROUND;
8157     Dwg_Object_IMAGE_BACKGROUND *IMAGE_BACKGROUND;
8158     Dwg_Object_LEADEROBJECTCONTEXTDATA *LEADEROBJECTCONTEXTDATA;
8159     Dwg_Object_LIGHTLIST *LIGHTLIST;
8160     Dwg_Object_MATERIAL *MATERIAL;
8161     Dwg_Object_MENTALRAYRENDERSETTINGS *MENTALRAYRENDERSETTINGS;
8162     Dwg_Object_MTEXTOBJECTCONTEXTDATA *MTEXTOBJECTCONTEXTDATA;
8163     Dwg_Object_OBJECT_PTR *OBJECT_PTR;
8164     Dwg_Object_PARTIAL_VIEWING_INDEX *PARTIAL_VIEWING_INDEX;
8165     Dwg_Object_POINTCLOUDCOLORMAP *POINTCLOUDCOLORMAP;
8166     Dwg_Object_POINTCLOUDDEF *POINTCLOUDDEF;
8167     Dwg_Object_POINTCLOUDDEFEX *POINTCLOUDDEFEX;
8168     Dwg_Object_POINTCLOUDDEF_REACTOR *POINTCLOUDDEF_REACTOR;
8169     Dwg_Object_POINTCLOUDDEF_REACTOR_EX *POINTCLOUDDEF_REACTOR_EX;
8170     Dwg_Object_PROXY_OBJECT *PROXY_OBJECT;
8171     Dwg_Object_RAPIDRTRENDERSETTINGS *RAPIDRTRENDERSETTINGS;
8172     Dwg_Object_RENDERENTRY *RENDERENTRY;
8173     Dwg_Object_RENDERENVIRONMENT *RENDERENVIRONMENT;
8174     Dwg_Object_RENDERGLOBAL *RENDERGLOBAL;
8175     Dwg_Object_RENDERSETTINGS *RENDERSETTINGS;
8176     Dwg_Object_SECTION_SETTINGS *SECTION_SETTINGS;
8177     Dwg_Object_SKYLIGHT_BACKGROUND *SKYLIGHT_BACKGROUND;
8178     Dwg_Object_SOLID_BACKGROUND *SOLID_BACKGROUND;
8179     Dwg_Object_SPATIAL_INDEX *SPATIAL_INDEX;
8180     Dwg_Object_SUN *SUN;
8181     Dwg_Object_TABLESTYLE *TABLESTYLE;
8182     Dwg_Object_TEXTOBJECTCONTEXTDATA *TEXTOBJECTCONTEXTDATA;
8183     Dwg_Object_ASSOCARRAYMODIFYPARAMETERS *ASSOCARRAYMODIFYPARAMETERS;
8184     Dwg_Object_ASSOCARRAYPATHPARAMETERS *ASSOCARRAYPATHPARAMETERS;
8185     Dwg_Object_ASSOCARRAYPOLARPARAMETERS *ASSOCARRAYPOLARPARAMETERS;
8186     Dwg_Object_ASSOCARRAYRECTANGULARPARAMETERS *ASSOCARRAYRECTANGULARPARAMETERS;
8187     /* debugging */
8188     Dwg_Object_ACMECOMMANDHISTORY *ACMECOMMANDHISTORY;
8189     Dwg_Object_ACMESCOPE *ACMESCOPE;
8190     Dwg_Object_ACMESTATEMGR *ACMESTATEMGR;
8191     Dwg_Object_ACSH_EXTRUSION_CLASS *ACSH_EXTRUSION_CLASS;
8192     Dwg_Object_ACSH_LOFT_CLASS *ACSH_LOFT_CLASS;
8193     Dwg_Object_ACSH_REVOLVE_CLASS *ACSH_REVOLVE_CLASS;
8194     Dwg_Object_ACSH_SWEEP_CLASS *ACSH_SWEEP_CLASS;
8195     Dwg_Object_ANGDIMOBJECTCONTEXTDATA *ANGDIMOBJECTCONTEXTDATA;
8196     Dwg_Object_ANNOTSCALEOBJECTCONTEXTDATA *ANNOTSCALEOBJECTCONTEXTDATA;
8197     Dwg_Object_ASSOC3POINTANGULARDIMACTIONBODY *ASSOC3POINTANGULARDIMACTIONBODY;
8198     Dwg_Object_ASSOCALIGNEDDIMACTIONBODY *ASSOCALIGNEDDIMACTIONBODY;
8199     Dwg_Object_ASSOCARRAYMODIFYACTIONBODY *ASSOCARRAYMODIFYACTIONBODY;
8200     Dwg_Object_ASSOCEDGEACTIONPARAM *ASSOCEDGEACTIONPARAM;
8201     Dwg_Object_ASSOCEDGECHAMFERACTIONBODY *ASSOCEDGECHAMFERACTIONBODY;
8202     Dwg_Object_ASSOCEDGEFILLETACTIONBODY *ASSOCEDGEFILLETACTIONBODY;
8203     Dwg_Object_ASSOCMLEADERACTIONBODY *ASSOCMLEADERACTIONBODY;
8204     Dwg_Object_ASSOCORDINATEDIMACTIONBODY *ASSOCORDINATEDIMACTIONBODY;
8205     Dwg_Object_ASSOCPERSSUBENTMANAGER *ASSOCPERSSUBENTMANAGER;
8206     Dwg_Object_ASSOCRESTOREENTITYSTATEACTIONBODY *ASSOCRESTOREENTITYSTATEACTIONBODY;
8207     Dwg_Object_ASSOCROTATEDDIMACTIONBODY *ASSOCROTATEDDIMACTIONBODY;
8208     Dwg_Object_ASSOCSWEPTSURFACEACTIONBODY *ASSOCSWEPTSURFACEACTIONBODY;
8209     Dwg_Object_BLOCKPROPERTIESTABLE *BLOCKPROPERTIESTABLE;
8210     Dwg_Object_BLOCKPROPERTIESTABLEGRIP *BLOCKPROPERTIESTABLEGRIP;
8211     Dwg_Object_CONTEXTDATAMANAGER *CONTEXTDATAMANAGER;
8212     Dwg_Object_CSACDOCUMENTOPTIONS *CSACDOCUMENTOPTIONS;
8213     Dwg_Object_CURVEPATH *CURVEPATH;
8214     Dwg_Object_DATATABLE *DATATABLE;
8215     Dwg_Object_DIMASSOC *DIMASSOC;
8216     Dwg_Object_DMDIMOBJECTCONTEXTDATA *DMDIMOBJECTCONTEXTDATA;
8217     Dwg_Object_DYNAMICBLOCKPROXYNODE *DYNAMICBLOCKPROXYNODE;
8218     Dwg_Object_GEOMAPIMAGE *GEOMAPIMAGE;
8219     Dwg_Object_LAYOUTPRINTCONFIG *LAYOUTPRINTCONFIG;
8220     Dwg_Object_MLEADEROBJECTCONTEXTDATA *MLEADEROBJECTCONTEXTDATA;
8221     Dwg_Object_MOTIONPATH *MOTIONPATH;
8222     Dwg_Object_MTEXTATTRIBUTEOBJECTCONTEXTDATA *MTEXTATTRIBUTEOBJECTCONTEXTDATA;
8223     Dwg_Object_NAVISWORKSMODELDEF *NAVISWORKSMODELDEF;
8224     Dwg_Object_ORDDIMOBJECTCONTEXTDATA *ORDDIMOBJECTCONTEXTDATA;
8225     Dwg_Object_PERSUBENTMGR *PERSUBENTMGR;
8226     Dwg_Object_POINTPATH *POINTPATH;
8227     Dwg_Object_RADIMLGOBJECTCONTEXTDATA *RADIMLGOBJECTCONTEXTDATA;
8228     Dwg_Object_RADIMOBJECTCONTEXTDATA *RADIMOBJECTCONTEXTDATA;
8229     Dwg_Object_SUNSTUDY *SUNSTUDY;
8230     Dwg_Object_TABLECONTENT *TABLECONTENT;
8231     Dwg_Object_TVDEVICEPROPERTIES *TVDEVICEPROPERTIES;
8232 //    Dwg_Object_ACDSRECORD *ACDSRECORD;
8233 //    Dwg_Object_ACDSSCHEMA *ACDSSCHEMA;
8234 //    Dwg_Object_NPOCOLLECTION *NPOCOLLECTION;
8235 //    Dwg_Object_RAPIDRTRENDERENVIRONMENT *RAPIDRTRENDERENVIRONMENT;
8236 //    Dwg_Object_XREFPANELOBJECT *XREFPANELOBJECT;
8237     /* End auto-generated object-union */
8238   } tio;
8239 
8240   struct _dwg_struct *dwg;
8241   BITCODE_BL num_eed;
8242   Dwg_Eed *eed;
8243 
8244   /* Common Object Data */
8245   BITCODE_H ownerhandle;        /*!< code 5, DXF 330 */
8246   BITCODE_BL num_reactors;
8247   BITCODE_H* reactors;          /*!< r13+ code 4, DXF 102 {ACAD_XDICTIONARY, 330 */
8248   BITCODE_H xdicobjhandle;      /*!< r13+ code 3, DXF 102 {ACAD_REACTORS, 360 */
8249   BITCODE_B is_xdic_missing;    /*!< r2004+ */
8250   BITCODE_B has_ds_data;        /*!< r2013+  AcDs datastore */
8251 
8252   /*unsigned int num_handles;*/
8253   Dwg_Handle *handleref; //??
8254 } Dwg_Object_Object;
8255 
8256 /**
8257  Classes
8258  */
8259 typedef struct _dwg_class
8260 {
8261   BITCODE_BS number; /*!< starting with 500 */
8262   /* see http://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf */
8263   BITCODE_BS proxyflag; /*!<
8264       erase allowed = 1,
8265       transform allowed = 2,
8266       color change allowed = 4,
8267       layer change allowed = 8,
8268       LTYPE change allowed = 16,
8269       LTYPE.scale change allowed = 32,
8270       visibility change allowed = 64,
8271       cloning allowed = 128,
8272       Lineweight change allowed = 256,
8273       PLOTSTYLE Name change allowed = 512,
8274       Disables proxy warning dialog = 1024,
8275       is R13 format proxy = 32768 */
8276   char *appname;
8277   char *cppname;
8278   char *dxfname; /*!< ASCII or UTF-8 */
8279   BITCODE_TU dxfname_u; /*!< r2007+, always transformed to dxfname as UTF-8 */
8280   BITCODE_B  is_zombie; /*!< i.e. was_proxy, not loaded class */
8281   BITCODE_BS item_class_id; /*!< really is_entity. 1f2 for entities, 1f3 for objects */
8282   BITCODE_BL num_instances; /*!< 91 instance count for a custom class */
8283   BITCODE_BL dwg_version;
8284   BITCODE_BL maint_version;
8285   BITCODE_BL unknown_1; /*!< def: 0L */
8286   BITCODE_BL unknown_2; /*!< def: 0L */
8287 } Dwg_Class;
8288 
8289 /**
8290  General DWG object with link to either entity or object, and as parent the DWG
8291  */
8292 typedef struct _dwg_object
8293 {
8294   BITCODE_RL size;       /*!< in bytes */
8295   unsigned long address; /*!< byte offset in the file */
8296   unsigned int type;     /*!< fixed or variable (class - 500) */
8297   BITCODE_RL index;      /*!< into dwg->object[] */
8298   enum DWG_OBJECT_TYPE fixedtype; /*!< into a global list */
8299   char *name;            /*!< our public entity/object name */
8300   char *dxfname;         /*!< the internal dxf classname, often with a ACDB prefix */
8301 
8302   Dwg_Object_Supertype supertype;
8303   union
8304   {
8305     Dwg_Object_Entity *entity;
8306     Dwg_Object_Object *object;
8307   } tio;
8308 
8309   Dwg_Handle handle;
8310   struct _dwg_struct *parent;
8311   Dwg_Class *klass;          /* the optional class of a variable object */
8312 
8313   BITCODE_RL bitsize;        /* common + object fields, but no handles */
8314   unsigned long bitsize_pos; /* bitsize offset in bits: r13-2007 */
8315   unsigned long hdlpos;      /* relative offset, in bits */
8316   BITCODE_B  was_bitsize_set;    /* internally for encode only */
8317   BITCODE_B  has_strings;        /*!< r2007+ */
8318   BITCODE_RL stringstream_size;  /*!< r2007+ in bits, unused */
8319   BITCODE_UMC handlestream_size; /*!< r2010+ in bits */
8320   unsigned long common_size; /* relative offset from type ... end common_entity_data */
8321 
8322   BITCODE_RL num_unknown_bits;
8323   BITCODE_TF unknown_bits;
8324 
8325 } Dwg_Object;
8326 
8327 /**
8328  Dwg_Chain similar to Bit_Chain in "bits.h". Used only for the Thumbnail thumbnail
8329  */
8330 typedef struct _dwg_chain
8331 {
8332   unsigned char *chain;
8333   long unsigned int size;
8334   long unsigned int byte;
8335   unsigned char bit;
8336   /* NOT:
8337   unsigned char opts;
8338   Dwg_Version_Type version;
8339   Dwg_Version_Type from_version;
8340   FILE *fh;
8341   */
8342 } Dwg_Chain;
8343 
8344 typedef enum DWG_SECTION_TYPE /* since r2004+ */
8345 {
8346   SECTION_UNKNOWN = 0,                  /* The very first 160 byte? */
8347   SECTION_HEADER = 1,                   /* AcDb:Header */
8348   SECTION_AUXHEADER = 2,                /* AcDb:AuxHeader */
8349   SECTION_CLASSES = 3,                  /* AcDb:Classes */
8350   SECTION_HANDLES = 4,                  /* AcDb:Handles */
8351   SECTION_TEMPLATE = 5,                 /* AcDb:Template */
8352   SECTION_OBJFREESPACE = 6,             /* AcDb:ObjFreeSpace */
8353   SECTION_OBJECTS = 7,                  /* AcDb:AcDbObjects */
8354   SECTION_REVHISTORY = 8,               /* AcDb:RevHistory */
8355   SECTION_SUMMARYINFO = 9,              /* AcDb:SummaryInfo */
8356   SECTION_PREVIEW = 10,                 /* AcDb:Preview */
8357   SECTION_APPINFO = 11,                 /* AcDb:AppInfo */
8358   SECTION_APPINFOHISTORY = 12,          /* AcDb:AppInfoHistory */
8359   SECTION_FILEDEPLIST = 13,             /* AcDb:FileDepList */
8360   SECTION_SECURITY,                     /* AcDb:Security, if stored with a password */
8361   SECTION_VBAPROJECT,                   /* AcDb:VBAProject */
8362   SECTION_SIGNATURE,                    /* AcDb:Signature */
8363   SECTION_ACDS,                         /* AcDb:AcDsPrototype_1b = 12 (ACIS datastorage) */
8364   SECTION_INFO,                         /* also called Data Section, or Section Page Map (ODA) */
8365   SECTION_SYSTEM_MAP,
8366 } Dwg_Section_Type;
8367 
8368 typedef enum DWG_SECTION_TYPE_R13
8369 {
8370   SECTION_HEADER_R13 = 0,
8371   SECTION_CLASSES_R13 = 1,
8372   SECTION_HANDLES_R13 = 2,
8373   SECTION_2NDHEADER_R13 = 3,
8374   SECTION_MEASUREMENT_R13 = 4,
8375   SECTION_AUXHEADER_R2000 = 5,
8376 } Dwg_Section_Type_R13;
8377 
8378 typedef enum DWG_SECTION_TYPE_R11 /* tables */
8379 {
8380   SECTION_HEADER_R11 = 0,
8381   SECTION_BLOCK = 1,
8382   SECTION_LAYER = 2,
8383   SECTION_STYLE = 3,
8384   SECTION_LTYPE = 5,
8385   SECTION_VIEW  = 6,
8386   SECTION_UCS   = 7,
8387   SECTION_VPORT = 8,
8388   SECTION_APPID = 9,
8389   SECTION_DIMSTYLE = 10,
8390   SECTION_VX = 11,
8391 } Dwg_Section_Type_r11;
8392 
8393 typedef struct _dwg_section
8394 {
8395   int32_t    number; /* preR13: count of entries, r2007: id */
8396   BITCODE_RL size;   /* now unsigned */
8397   uint64_t   address;
8398   BITCODE_RL parent;
8399   BITCODE_RL left;
8400   BITCODE_RL right;
8401   BITCODE_RL x00;
8402   Dwg_Section_Type type; /* to be casted to Dwg_Section_Type_r11 preR13 */
8403   /* => section_info? */
8404   char name[64];
8405   /*!< r2004 section fields: */
8406   BITCODE_RL section_type;
8407   BITCODE_RL decomp_data_size;
8408   BITCODE_RL comp_data_size;
8409   BITCODE_RL compression_type;
8410   BITCODE_RL checksum;
8411 } Dwg_Section;
8412 
8413 /* Dwg_R2007_Section:
8414   int64_t  data_size;    // max size of page
8415   int64_t  max_size;
8416   int64_t  encrypted;
8417   int64_t  hashcode;
8418   int64_t  name_length;  // 0x22
8419   int64_t  unknown;      // 0x00
8420   int64_t  encoded;
8421   int64_t  num_pages;
8422   DWGCHAR *name;
8423   r2007_section_page **pages;
8424   struct _r2007_section *nextsec;
8425  */
8426 
8427 // ODA 4.5
8428 typedef struct
8429 {
8430   BITCODE_RL num_desc;
8431   BITCODE_RL compressed; /* Compressed (1 = no, 2 = yes, normally 2) */
8432   BITCODE_RL max_size;
8433   BITCODE_RL encrypted; /* (0 = no, 1 = yes, 2 = unknown) */
8434   BITCODE_RL num_desc2;
8435 } Dwg_Section_InfoHdr;
8436 
8437 typedef struct
8438 {
8439   int64_t    size;
8440   BITCODE_RL num_sections;
8441   BITCODE_RL max_decomp_size;
8442   BITCODE_RL unknown;
8443   BITCODE_RL compressed; /* Compressed (1 = no, 2 = yes, normally 2) */
8444   BITCODE_RL type;       /* The dynamic index as read/written */
8445   BITCODE_RL encrypted;  /* (0 = no, 1 = yes, 2 = unknown) */
8446   char name[64];
8447   Dwg_Section_Type fixedtype;  /* to search for */
8448   Dwg_Section **sections;
8449 } Dwg_Section_Info;
8450 
8451 
8452 typedef struct _dwg_SummaryInfo_Property
8453 {
8454   BITCODE_TU tag;   // CUSTOMPROPERTYTAG
8455   BITCODE_TU value; // CUSTOMPROPERTY
8456 } Dwg_SummaryInfo_Property;
8457 
8458 typedef struct _dwg_FileDepList_Files
8459 {
8460   BITCODE_T32 filename;
8461   BITCODE_T32 filepath;
8462   BITCODE_T32 fingerprint;
8463   BITCODE_T32 version;
8464   BITCODE_RL feature_index;
8465   BITCODE_RL timestamp;
8466   BITCODE_RL filesize;
8467   BITCODE_RS affects_graphics;
8468   BITCODE_RL refcount;
8469 } Dwg_FileDepList_Files;
8470 
8471 typedef struct _dwg_AcDs_SegmentIndex
8472 {
8473   BITCODE_RLL offset;
8474   BITCODE_RL size;
8475 } Dwg_AcDs_SegmentIndex;
8476 
8477 typedef struct _dwg_AcDs_DataIndex_Entry
8478 {
8479   BITCODE_RL segidx;
8480   BITCODE_RL offset;
8481   BITCODE_RL schidx;
8482 } Dwg_AcDs_DataIndex_Entry;
8483 
8484 typedef struct _dwg_AcDs_DataIndex
8485 {
8486   BITCODE_RL num_entries;
8487   BITCODE_RL di_unknown; // always 0, probably RLL above
8488   Dwg_AcDs_DataIndex_Entry *entries;
8489 } Dwg_AcDs_DataIndex;
8490 
8491 typedef struct _dwg_AcDs_Data_RecordHdr
8492 {
8493   BITCODE_RL entry_size;
8494   BITCODE_RL unknown; // mostly 1
8495   BITCODE_RLL handle;
8496   BITCODE_RL offset;
8497 } Dwg_AcDs_Data_RecordHdr;
8498 
8499 typedef struct _dwg_AcDs_Data_Record
8500 {
8501   BITCODE_RL data_size;
8502   BITCODE_RC *blob;
8503 } Dwg_AcDs_Data_Record;
8504 
8505 typedef struct _dwg_AcDs_Data
8506 {
8507   Dwg_AcDs_Data_RecordHdr *record_hdrs;
8508   Dwg_AcDs_Data_Record *records;
8509 } Dwg_AcDs_Data;
8510 
8511 typedef struct _dwg_AcDs_DataBlobRef_Page
8512 {
8513   BITCODE_RL segidx;
8514   BITCODE_RL size;
8515 } Dwg_AcDs_DataBlobRef_Page;
8516 
8517 typedef struct _dwg_AcDs_DataBlobRef
8518 {
8519   BITCODE_RLL total_data_size;
8520   BITCODE_RL num_pages;
8521   BITCODE_RL record_size;
8522   BITCODE_RL page_size;
8523   BITCODE_RL unknown_1; // ODA writes 1
8524   BITCODE_RL unknown_2; // ODA writes 0
8525   Dwg_AcDs_DataBlobRef_Page *pages;
8526 } Dwg_AcDs_DataBlobRef;
8527 
8528 typedef struct _dwg_AcDs_DataBlob
8529 {
8530   BITCODE_RLL data_size;
8531   BITCODE_RL page_count;
8532   BITCODE_RL record_size;
8533   BITCODE_RL page_size;
8534   BITCODE_RL unknown_1; // ODA writes 1
8535   BITCODE_RL unknown_2; // ODA writes 0
8536   Dwg_AcDs_DataBlobRef *ref; // only one, optional
8537 } Dwg_AcDs_DataBlob;
8538 
8539 typedef struct _dwg_AcDs_DataBlob01
8540 {
8541   BITCODE_RLL total_data_size;
8542   BITCODE_RLL page_start_offset;
8543   int32_t page_index;
8544   int32_t page_count;
8545   BITCODE_RLL page_data_size;
8546   BITCODE_RC *page_data;
8547 } Dwg_AcDs_DataBlob01;
8548 
8549 // 24.2.2.5
8550 typedef struct _dwg_AcDs_SchemaIndex_Prop
8551 {
8552   BITCODE_RL index;
8553   BITCODE_RL segidx;
8554   BITCODE_RL offset;
8555 } Dwg_AcDs_SchemaIndex_Prop;
8556 
8557 // 24.2.2.5
8558 typedef struct _dwg_AcDs_SchemaIndex
8559 {
8560   BITCODE_RL num_props; // or uint64
8561   BITCODE_RL si_unknown_1;
8562   Dwg_AcDs_SchemaIndex_Prop *props;
8563   BITCODE_RLL si_tag; /* 0x0af10c */
8564   BITCODE_RL num_prop_entries;
8565   BITCODE_RL si_unknown_2; /* 0 */
8566   Dwg_AcDs_SchemaIndex_Prop *prop_entries;
8567 } Dwg_AcDs_SchemaIndex;
8568 
8569 // 24.2.2.6.1.1
8570 typedef struct _dwg_AcDs_Schema_Prop
8571 {
8572   BITCODE_RL flags;  /*<! DXF 91 */
8573   BITCODE_RL namidx; /*<! DXF 2 */
8574   BITCODE_RL type;   /*<! DXF 280, 0-15 */
8575   BITCODE_RL type_size;
8576   BITCODE_RL unknown_1;
8577   BITCODE_RL unknown_2;
8578   BITCODE_RS num_values;
8579   BITCODE_RC *values;
8580 } Dwg_AcDs_Schema_Prop;
8581 
8582 // 24.2.2.6.1
8583 typedef struct _dwg_AcDs_Schema
8584 {
8585   BITCODE_RS num_index;
8586   BITCODE_RLL *index;
8587   BITCODE_RS num_props;
8588   Dwg_AcDs_Schema_Prop *props;
8589 } Dwg_AcDs_Schema;
8590 
8591 // 24.2.2.6
8592 typedef struct _dwg_AcDs_SchemaData_UProp
8593 {
8594   BITCODE_RL size;
8595   BITCODE_RL flags;
8596 } Dwg_AcDs_SchemaData_UProp;
8597 
8598 typedef struct _dwg_AcDs_SchemaData
8599 {
8600   BITCODE_RL num_uprops; // computed, see schidx
8601   Dwg_AcDs_SchemaData_UProp *uprops;
8602   BITCODE_RL num_schemas; // computed, see schidx
8603   Dwg_AcDs_Schema *schemas;
8604   BITCODE_RL num_propnames;
8605   BITCODE_TV *propnames;
8606 } Dwg_AcDs_SchemaData;
8607 
8608 typedef struct _dwg_AcDs_Search_IdIdx
8609 {
8610   BITCODE_RLL handle;
8611   BITCODE_RL num_ididx;
8612   BITCODE_RLL *ididx;
8613 } Dwg_AcDs_Search_IdIdx;
8614 
8615 typedef struct _dwg_AcDs_Search_IdIdxs
8616 {
8617   BITCODE_RL num_ididx;
8618   Dwg_AcDs_Search_IdIdx *ididx;
8619 } Dwg_AcDs_Search_IdIdxs;
8620 
8621 // 24.2.2.7.1
8622 typedef struct _dwg_AcDs_Search_Data
8623 {
8624   BITCODE_RL schema_namidx;
8625   BITCODE_RL num_sortedidx;
8626   BITCODE_RLL *sortedidx;
8627   BITCODE_RL num_ididxs;
8628   BITCODE_RL unknown;
8629   Dwg_AcDs_Search_IdIdxs *ididxs;
8630 } Dwg_AcDs_Search_Data;
8631 
8632 typedef struct _dwg_AcDs_Search
8633 {
8634   BITCODE_RL num_search;
8635   Dwg_AcDs_Search_Data *search;
8636 } Dwg_AcDs_Search;
8637 
8638 typedef struct _dwg_AcDs_Segment
8639 {
8640   BITCODE_RL signature; /* always 0xd5ac */
8641   BITCODE_RC name[7]; /* segidx, datidx, _data_, schidx, schdat, search, blob01 */
8642   BITCODE_RCd type; /* computed 0-6 or -1 */
8643   BITCODE_RL segment_idx;
8644   BITCODE_RL is_blob01;
8645   BITCODE_RL segsize;
8646   BITCODE_RL unknown_2;
8647   BITCODE_RL ds_version; // datastorage revision
8648   BITCODE_RL unknown_3;
8649   BITCODE_RL data_algn_offset;
8650   BITCODE_RL objdata_algn_offset;
8651   BITCODE_RC padding[9]; // always 8x 0x55
8652 } Dwg_AcDs_Segment;
8653 
8654 typedef struct _dwg_AcDs
8655 {
8656   // header
8657   BITCODE_RL file_signature;
8658   BITCODE_RL file_header_size;
8659   BITCODE_RL unknown_1;  /* acis version? always 2 */
8660   BITCODE_RL version;    /* always 2 */
8661   BITCODE_RL unknown_2;  /* always 0 */
8662   BITCODE_RL ds_version; /* datastorage revision */
8663   BITCODE_RL segidx_offset;
8664   BITCODE_RL segidx_unknown;
8665   BITCODE_RL num_segidx;
8666   BITCODE_RL schidx_segidx;
8667   BITCODE_RL datidx_segidx;
8668   BITCODE_RL search_segidx;
8669   BITCODE_RL prvsav_segidx;
8670   BITCODE_RL file_size;
8671   BITCODE_BL total_segments; // computed
8672   Dwg_AcDs_SegmentIndex *segidx;
8673   Dwg_AcDs_DataIndex datidx;
8674   Dwg_AcDs_Data *data;
8675   Dwg_AcDs_DataBlob blob01;
8676   Dwg_AcDs_SchemaIndex schidx;
8677   Dwg_AcDs_SchemaData schdat;
8678   Dwg_AcDs_Search search;
8679   Dwg_AcDs_Segment *segments;
8680 } Dwg_AcDs;
8681 
8682 typedef struct _dwg_header
8683 {
8684   Dwg_Version_Type version;      /* calculated from the header magic */
8685   Dwg_Version_Type from_version; /* option. set by --as (convert from) */
8686   BITCODE_RC zero_5[5];
8687   BITCODE_RC is_maint;
8688   BITCODE_RC zero_one_or_three;
8689   BITCODE_RS unknown_s[3];      /* <R13 */
8690   BITCODE_RL thumbnail_address; /* THUMBNAIL or AdDb:Preview */
8691   BITCODE_RC dwg_version;
8692   BITCODE_RC maint_version;
8693   BITCODE_RS codepage;
8694   BITCODE_RC unknown_0;           /* R2004+ */
8695   BITCODE_RC app_dwg_version;     /* R2004+ */
8696   BITCODE_RC app_maint_version;   /* R2004+ */
8697   BITCODE_RL security_type;       /* R2004+ */
8698   BITCODE_RL rl_1c_address;       /* R2004+ mostly 0 */
8699   BITCODE_RL summaryinfo_address; /* R2004+ */
8700   BITCODE_RL vbaproj_address;     /* R2004+ */
8701   BITCODE_RL r2004_header_address; /* R2004+ */
8702   BITCODE_RL num_sections;
8703   Dwg_Section *section;
8704   Dwg_Section_InfoHdr section_infohdr; /* R2004+ */
8705   Dwg_Section_Info *section_info;
8706 } Dwg_Header;
8707 
8708 #pragma pack(1)
8709 typedef struct _dwg_R2004_Header /* encrypted */
8710 {
8711   BITCODE_RC file_ID_string[12];
8712   BITCODE_RLx header_address;
8713   BITCODE_RL header_size;
8714   BITCODE_RL x04;
8715   BITCODE_RLd root_tree_node_gap;
8716   BITCODE_RLd lowermost_left_tree_node_gap;
8717   BITCODE_RLd lowermost_right_tree_node_gap;
8718   BITCODE_RL unknown_long;
8719   BITCODE_RL last_section_id;
8720   BITCODE_RLL last_section_address;
8721   BITCODE_RLL second_header_address;
8722   BITCODE_RL numgaps;
8723   BITCODE_RL numsections;
8724   BITCODE_RL x20;
8725   BITCODE_RL x80;
8726   BITCODE_RL x40;
8727   BITCODE_RL section_map_id;
8728   BITCODE_RLL section_map_address;
8729   BITCODE_RLd  section_info_id;
8730   BITCODE_RL section_array_size;
8731   BITCODE_RL gap_array_size;
8732   BITCODE_RLx crc32; /* p 2.14.2 32bit CRC 2004+ */
8733   BITCODE_RC padding[12];
8734   /* System Section: Section Page Map */
8735   BITCODE_RL section_type; /* 0x4163043b */
8736   BITCODE_RL decomp_data_size;
8737   BITCODE_RL comp_data_size;
8738   BITCODE_RL compression_type;
8739   BITCODE_RLx checksum;
8740 } Dwg_R2004_Header;
8741 #pragma pack()
8742 
8743 typedef struct _dwg_auxheader
8744 {
8745   BITCODE_RC aux_intro[3]; /* ff 77 01 */
8746   BITCODE_RS dwg_version;
8747   BITCODE_RL maint_version;
8748   BITCODE_RL numsaves;
8749   BITCODE_RL minus_1;
8750   BITCODE_RS numsaves_1;
8751   BITCODE_RS numsaves_2;
8752   BITCODE_RL zero;
8753   BITCODE_RS dwg_version_1;
8754   BITCODE_RL maint_version_1;
8755   BITCODE_RS dwg_version_2;
8756   BITCODE_RL maint_version_2;
8757   BITCODE_RS unknown_6rs[6];
8758   BITCODE_RL unknown_5rl[5];
8759   BITCODE_RD TDCREATE; /* ?? format TD */
8760   BITCODE_RD TDUPDATE;
8761   BITCODE_RL HANDSEED;
8762   BITCODE_RL plot_stamp;
8763   BITCODE_RS zero_1;
8764   BITCODE_RS numsaves_3;
8765   BITCODE_RL zero_2;
8766   BITCODE_RL zero_3;
8767   BITCODE_RL zero_4;
8768   BITCODE_RL numsaves_4;
8769   BITCODE_RL zero_5;
8770   BITCODE_RL zero_6;
8771   BITCODE_RL zero_7;
8772   BITCODE_RL zero_8;     /* ?? */
8773   BITCODE_RS zero_18[3]; /* R2018+ */
8774 } Dwg_AuxHeader;
8775 
8776 typedef struct _dwg_summaryinfo
8777 {
8778   BITCODE_TU TITLE;
8779   BITCODE_TU SUBJECT;
8780   BITCODE_TU AUTHOR;
8781   BITCODE_TU KEYWORDS;
8782   BITCODE_TU COMMENTS;
8783   BITCODE_TU LASTSAVEDBY;
8784   BITCODE_TU REVISIONNUMBER;
8785   BITCODE_TU HYPERLINKBASE;
8786   BITCODE_TIMERLL TDINDWG; /* days + ms, fixed size! */
8787   BITCODE_TIMERLL TDCREATE;
8788   BITCODE_TIMERLL TDUPDATE;
8789   BITCODE_RS num_props;
8790   Dwg_SummaryInfo_Property *props;
8791   BITCODE_RL unknown1;
8792   BITCODE_RL unknown2;
8793 } Dwg_SummaryInfo;
8794 
8795 /* Contains information about the application that wrote
8796    the .dwg file (encrypted = 2). */
8797 typedef struct _dwg_appinfo
8798 {
8799   BITCODE_RL class_version; // 3
8800   BITCODE_RL num_strings;   // 2-3
8801   BITCODE_TU appinfo_name;  // AppInfoDataList
8802   BITCODE_RC version_checksum[16];
8803   BITCODE_RC comment_checksum[16];
8804   BITCODE_RC product_checksum[16];
8805   BITCODE_TU version;      // "19.0.55.0.0", "Teigha(R) 4.3.2.0"
8806   BITCODE_TU comment;      // "Autodesk DWG.  This file is a Trusted DWG "...
8807   BITCODE_TU product_info; // XML ProductInformation
8808 } Dwg_AppInfo;
8809 
8810 /* File Dependencies, IMAGE files, fonts, xrefs, plotconfigs */
8811 typedef struct _dwg_filedeplist
8812 {
8813   BITCODE_RL num_features;
8814   BITCODE_TU32 *features; // Acad:XRef, Acad:Image, Acad:PlotConfig, Acad:Text
8815   BITCODE_RL num_files;
8816   Dwg_FileDepList_Files *files;
8817 } Dwg_FileDepList;
8818 
8819 /* password info */
8820 typedef struct _dwg_security
8821 {
8822   BITCODE_RL unknown_1;   // 0xc
8823   BITCODE_RL unknown_2;   // 0
8824   BITCODE_RL unknown_3;   // 0xabcdabcd
8825   BITCODE_RL crypto_id;   //
8826   BITCODE_TV crypto_name; // "Microsoft Base DSS and Diffie-Hellman
8827                           // Cryptographic Provider"
8828   BITCODE_RL algo_id;     // RC4
8829   BITCODE_RL key_len;     // 40
8830   BITCODE_RL encr_size;   //
8831   BITCODE_TF encr_buffer;
8832 } Dwg_Security;
8833 
8834 typedef struct _dwg_vbaproject
8835 {
8836   int size;
8837   BITCODE_TF unknown_bits;
8838 } Dwg_VBAProject;
8839 
8840 typedef struct _dwg_appinfohistory
8841 {
8842   int size;
8843   BITCODE_TF unknown_bits;
8844 } Dwg_AppInfoHistory;
8845 
8846 typedef struct _dwg_revhistory
8847 {
8848   BITCODE_RL class_version;
8849   BITCODE_RL class_minor;
8850   BITCODE_RL num_histories;
8851   BITCODE_RL *histories;
8852 } Dwg_RevHistory;
8853 
8854 typedef struct _dwg_objfreespace
8855 {
8856   BITCODE_RLL zero;
8857   BITCODE_RLL num_handles;
8858   BITCODE_TIMERLL TDUPDATE;
8859   BITCODE_RL objects_address;
8860   BITCODE_RC num_nums; // RLL (uint64_t) or uint128_t
8861   BITCODE_RLL max32;   // 0x32
8862   BITCODE_RLL max64;   // 0x64
8863   BITCODE_RLL maxtbl;  // 0x200
8864   BITCODE_RLL maxrl;
8865   BITCODE_RLL max32_hi;
8866   BITCODE_RLL max64_hi;
8867   BITCODE_RLL maxtbl_hi;
8868   BITCODE_RLL maxrl_hi;
8869 } Dwg_ObjFreeSpace;
8870 
8871 typedef struct _dwg_template
8872 {
8873   BITCODE_T16 description;
8874   BITCODE_RS MEASUREMENT;
8875 } Dwg_Template;
8876 
8877 typedef struct _dwg_second_header
8878 {
8879   BITCODE_RL size;
8880   BITCODE_RL address;
8881   BITCODE_RC version[12];
8882   BITCODE_B null_b[4];
8883   BITCODE_RC unknown_10;
8884   BITCODE_RC unknown_rc4[4];
8885   BITCODE_RC num_sections;
8886   struct _sections
8887   {
8888     BITCODE_RC nr;
8889     BITCODE_BL address;
8890     BITCODE_BL size;
8891   } section[6];
8892   BITCODE_BS num_handlers;
8893   struct _handler
8894   {
8895     BITCODE_RC size;
8896     BITCODE_RC nr;
8897     BITCODE_RC *data;
8898   } handlers[16];
8899   BITCODE_RL junk_r14_1; /*!< r14 only */
8900   BITCODE_RL junk_r14_2; /*!< r14 only */
8901 } Dwg_Second_Header;
8902 
8903 /**
8904  Main DWG struct
8905  */
8906 
8907 typedef struct _dwg_struct
8908 {
8909   Dwg_Header header;
8910 
8911   BITCODE_BS num_classes;        /*!< number of classes */
8912   Dwg_Class * dwg_class;         /*!< array of classes */
8913   BITCODE_BL num_objects;        /*!< number of objects */
8914   Dwg_Object * object;           /*!< list of all objects and entities */
8915   BITCODE_BL num_entities;       /*!< number of entities in object */
8916   BITCODE_BL num_object_refs;    /*!< number of object_ref's (resolved handles) */
8917   Dwg_Object_Ref **object_ref;   /*!< array of most handles */
8918   struct _inthash *object_map;   /*!< map of all handles */
8919   int dirty_refs;                /* 1 if we added an entity, and invalidated all
8920                                     the internal ref->obj's */
8921   unsigned int opts;             /* See DWG_OPTS_* below */
8922 
8923   Dwg_Header_Variables header_vars;
8924   Dwg_Chain thumbnail;
8925 
8926   Dwg_R2004_Header r2004_header; /* encrypted, packed */
8927 
8928   /* Should only be initialized after the read/write is complete. */
8929   Dwg_Object *mspace_block;
8930   Dwg_Object *pspace_block;
8931   /* This TABLE might be empty with num_entries=0 */
8932   Dwg_Object_BLOCK_CONTROL      block_control;
8933 
8934   /* #define DWG_AUXHEADER_SIZE 123 */
8935   Dwg_AuxHeader auxheader;
8936   Dwg_SummaryInfo summaryinfo;
8937   /* Contains information about the application that wrote
8938      the .dwg file (encrypted = 2). */
8939   Dwg_AppInfo appinfo;
8940   /* File Dependencies, IMAGE files, fonts, xrefs, plotconfigs */
8941   Dwg_FileDepList filedeplist;
8942   Dwg_Security security; /* password info */
8943   Dwg_VBAProject vbaproject;
8944   Dwg_AppInfoHistory appinfohistory;
8945   Dwg_RevHistory revhistory;
8946   Dwg_ObjFreeSpace objfreespace;
8947   Dwg_Template Template;
8948   Dwg_AcDs acds;
8949   Dwg_Second_Header second_header;
8950 
8951   unsigned int layout_type;
8952   unsigned int num_acis_sab_hdl;  // temporary, until we can parse acds for SAB data, r2013+
8953   BITCODE_H *acis_sab_hdl;
8954   unsigned long next_hdl; // for add_document handle holes
8955 } Dwg_Data;
8956 
8957 #define DWG_OPTS_LOGLEVEL 0xf
8958 #define DWG_OPTS_MINIMAL  0x10
8959 #define DWG_OPTS_DXFB     0x20
8960 /* can be safely shared */
8961 #define DWG_OPTS_JSONFIRST 0x20
8962 #define DWG_OPTS_INDXF    0x40
8963 #define DWG_OPTS_INJSON   0x80
8964 #define DWG_OPTS_IN       (DWG_OPTS_INDXF | DWG_OPTS_INJSON)
8965 
8966 typedef enum RESBUF_VALUE_TYPE
8967 {
8968   DWG_VT_INVALID = 0,
8969   DWG_VT_STRING = 1,
8970   DWG_VT_POINT3D = 2,
8971   DWG_VT_REAL = 3,
8972   DWG_VT_INT16 = 4,
8973   DWG_VT_INT32 = 5,
8974   DWG_VT_INT8 = 6,
8975   DWG_VT_BINARY = 7,
8976   DWG_VT_HANDLE = 8,
8977   DWG_VT_OBJECTID = 9,
8978   DWG_VT_BOOL = 10,    // VT_BOOL clashes with /usr/x86_64-w64-mingw32/sys-root/mingw/include/wtypes.h
8979   DWG_VT_INT64 = 11,   // RLL
8980 } Dwg_Resbuf_Value_Type;
8981 
8982 /*--------------------------------------------------
8983  * Exported Functions
8984  */
8985 
8986 EXPORT int dwg_read_file (const char *restrict filename,
8987                           Dwg_Data *restrict dwg);
8988 EXPORT int dxf_read_file (const char *restrict filename,
8989                           Dwg_Data *restrict dwg);
8990 // You might need to probe for that.
8991 EXPORT int dwg_write_file (const char *restrict filename,
8992                            const Dwg_Data *restrict dwg);
8993 
8994 EXPORT unsigned char *dwg_bmp (const Dwg_Data *restrict, BITCODE_RL *restrict);
8995 
8996 /** Converts the internal enum RC into 100th mm lineweight, with
8997  *  -1 BYLAYER, -2 BYBLOCK, -3 BYLWDEFAULT.
8998  */
8999 EXPORT int dxf_cvt_lweight (const BITCODE_BSd value);
9000 
9001 /** Converts the 100th mm lineweight, with -1 BYLAYER, -2 BYBLOCK, -3 BYLWDEFAULT,
9002     into the internal enum RC.
9003  */
9004 EXPORT BITCODE_BSd dxf_revcvt_lweight (const int lw);
9005 
9006 /* Return the matching _CONTROL table, or NULL
9007  */
9008 EXPORT BITCODE_H
9009 dwg_ctrl_table (Dwg_Data *restrict dwg, const char *restrict table);
9010 
9011 /* Search for the name in the associated table, and return its handle. Search
9012  * is case-insensitive.
9013  * Both name and table are ascii.
9014  */
9015 EXPORT BITCODE_H dwg_find_tablehandle (Dwg_Data *restrict dwg,
9016                                        const char *restrict name,
9017                                        const char *restrict table);
9018 
9019 
9020 /* Search for handle in associated table, and return its name (as UTF-8) */
9021 EXPORT char *
9022 dwg_handle_name (Dwg_Data *restrict dwg, const char *restrict table,
9023                  const BITCODE_H restrict handle);
9024 
9025 /** Not checking the header_vars entry, only searching the objects
9026  *  Returning a hardowner or hardpointer (DICTIONARY) ref (code 3 or 5)
9027  *  to it, as stored in header_vars. table must contain the "_CONTROL" suffix.
9028  *  table is ascii.
9029  */
9030 EXPORT BITCODE_H dwg_find_table_control (Dwg_Data *restrict dwg,
9031                                          const char *restrict table);
9032 
9033 /** Search for a dictionary ref.
9034  *  Returning a hardpointer ref (5) to it, as stored in header_vars.
9035  *  Name is ascii.
9036  */
9037 EXPORT BITCODE_H dwg_find_dictionary (Dwg_Data *restrict dwg,
9038                                       const char *restrict name);
9039 /** Search for a named dictionary entry in the given dict.
9040  *  Search is case-sensitive. name is ASCII. */
9041 EXPORT BITCODE_H dwg_find_dicthandle (Dwg_Data *restrict dwg, BITCODE_H dict,
9042                                       const char *restrict name);
9043 /** Search all dictionary entries in the given dict.
9044  *  Check for the matching name of the handle object. (Control lists).
9045  *  Search is case-insensitive */
9046 EXPORT BITCODE_H dwg_find_dicthandle_objname (Dwg_Data *restrict dwg, BITCODE_H dict,
9047                                               const char *restrict name);
9048 /* Search for a table EXTNAME */
9049 EXPORT char *dwg_find_table_extname (Dwg_Data *restrict dwg,
9050                                      Dwg_Object *restrict obj);
9051 /* Returns the string value of the member of the AcDbVariableDictionary.
9052    The name is ascii. E.g. LIGHTINGUNITS => "0" */
9053 EXPORT char *dwg_variable_dict (Dwg_Data *restrict dwg,
9054                                 const char *restrict name);
9055 
9056 EXPORT double dwg_model_x_min (const Dwg_Data *restrict);
9057 EXPORT double dwg_model_x_max (const Dwg_Data *restrict);
9058 EXPORT double dwg_model_y_min (const Dwg_Data *restrict);
9059 EXPORT double dwg_model_y_max (const Dwg_Data *restrict);
9060 EXPORT double dwg_model_z_min (const Dwg_Data *restrict);
9061 EXPORT double dwg_model_z_max (const Dwg_Data *restrict);
9062 EXPORT double dwg_page_x_min (const Dwg_Data *restrict);
9063 EXPORT double dwg_page_x_max (const Dwg_Data *restrict);
9064 EXPORT double dwg_page_y_min (const Dwg_Data *restrict);
9065 EXPORT double dwg_page_y_max (const Dwg_Data *restrict);
9066 
9067 EXPORT Dwg_Object_BLOCK_CONTROL * dwg_block_control (Dwg_Data *restrict dwg);
9068 
9069 EXPORT Dwg_Object_Ref * dwg_model_space_ref (Dwg_Data *restrict dwg);
9070 EXPORT Dwg_Object_Ref * dwg_paper_space_ref (Dwg_Data *restrict dwg);
9071 EXPORT Dwg_Object * dwg_model_space_object (Dwg_Data *restrict dwg);
9072 EXPORT Dwg_Object * dwg_paper_space_object (Dwg_Data *restrict dwg);
9073 
9074 EXPORT unsigned int dwg_get_layer_count (const Dwg_Data *restrict dwg);
9075 
9076 EXPORT Dwg_Object_LAYER ** dwg_get_layers (const Dwg_Data *restrict dwg);
9077 
9078 EXPORT BITCODE_BL dwg_get_num_objects (const Dwg_Data *restrict dwg);
9079 
9080 EXPORT BITCODE_BL dwg_get_object_num_objects (const Dwg_Data *restrict dwg);
9081 
9082 EXPORT int dwg_class_is_entity (const Dwg_Class *restrict klass);
9083 
9084 EXPORT int dwg_obj_is_control (const Dwg_Object *restrict obj);
9085 EXPORT int dwg_obj_is_table (const Dwg_Object *restrict obj);
9086 EXPORT int dwg_obj_is_subentity (const Dwg_Object *restrict obj);
9087 EXPORT int dwg_obj_has_subentity (const Dwg_Object *restrict obj);
9088 EXPORT int dwg_obj_is_3dsolid (const Dwg_Object *restrict obj);
9089 EXPORT int dwg_obj_is_acsh (const Dwg_Object *restrict obj);
9090 
9091 EXPORT BITCODE_BL dwg_get_num_entities (const Dwg_Data *restrict);
9092 
9093 EXPORT Dwg_Object_Entity **dwg_get_entities (const Dwg_Data *restrict);
9094 
9095 EXPORT Dwg_Object_LAYER *
9096 dwg_get_entity_layer (const Dwg_Object_Entity *restrict);
9097 
9098 EXPORT Dwg_Object *dwg_next_object (const Dwg_Object *obj);
9099 EXPORT Dwg_Object *dwg_next_entity (const Dwg_Object *obj);
9100 EXPORT unsigned long dwg_next_handle (const Dwg_Data *dwg);
9101 
9102 EXPORT Dwg_Object *dwg_ref_object (const Dwg_Data *restrict dwg,
9103                                    Dwg_Object_Ref *restrict ref);
9104 
9105 EXPORT Dwg_Object *dwg_ref_object_relative (const Dwg_Data *restrict dwg,
9106                                             Dwg_Object_Ref *restrict ref,
9107                                             const Dwg_Object *restrict obj);
9108 EXPORT Dwg_Object *dwg_ref_object_silent (const Dwg_Data *restrict dwg,
9109                                           Dwg_Object_Ref *restrict ref);
9110 
9111 EXPORT Dwg_Object *get_first_owned_entity (const Dwg_Object *restrict hdr);
9112 EXPORT Dwg_Object *get_next_owned_entity (const Dwg_Object *restrict hdr,
9113                                           const Dwg_Object *restrict current);
9114 EXPORT Dwg_Object *get_first_owned_subentity (const Dwg_Object *restrict owner);
9115 EXPORT Dwg_Object *
9116 get_next_owned_subentity (const Dwg_Object *restrict owner,
9117                           const Dwg_Object *restrict current);
9118 EXPORT Dwg_Object *get_first_owned_block (const Dwg_Object *hdr);
9119 EXPORT Dwg_Object *get_last_owned_block (const Dwg_Object *hdr);
9120 EXPORT Dwg_Object *get_next_owned_block (const Dwg_Object *restrict hdr,
9121                                          const Dwg_Object *restrict current);
9122 EXPORT Dwg_Object *get_next_owned_block_entity (const Dwg_Object *restrict hdr,
9123                                                 const Dwg_Object *restrict current);
9124 EXPORT Dwg_Object *dwg_get_first_object (const Dwg_Data *dwg,
9125                                          const Dwg_Object_Type type);
9126 
9127 EXPORT Dwg_Object *dwg_resolve_handle (const Dwg_Data *restrict dwg,
9128                                        const unsigned long absref);
9129 EXPORT Dwg_Object *dwg_resolve_handle_silent (const Dwg_Data *restrict dwg,
9130                                               const BITCODE_BL absref);
9131 EXPORT int dwg_resolve_handleref (Dwg_Object_Ref *restrict ref,
9132                                   const Dwg_Object *restrict obj);
9133 
9134 EXPORT Dwg_Section_Type dwg_section_type (const char *restrict name);
9135 EXPORT Dwg_Section_Type dwg_section_wtype (const DWGCHAR *restrict wname);
9136 EXPORT const char *dwg_section_name (const Dwg_Data *dwg, const unsigned int sec_id);
9137 
9138 EXPORT enum RESBUF_VALUE_TYPE dwg_resbuf_value_type (short gc);
9139 
9140 /** Free the whole DWG. all tables, sections, objects, ...
9141 */
9142 EXPORT void dwg_free (Dwg_Data *restrict dwg);
9143 
9144 /** Free the object (all three structs and its fields)
9145 */
9146 EXPORT void dwg_free_object (Dwg_Object *restrict obj);
9147 
9148 /** Add the empty ref to the DWG (freshly malloc'ed), or NULL.
9149 */
9150 EXPORT Dwg_Object_Ref * dwg_new_ref (Dwg_Data *restrict dwg);
9151 
9152 /** For encode:
9153  *  May need obj to shorten the code to a relative offset, but not in header_vars.
9154  *  There obj is NULL.
9155  */
9156 EXPORT int dwg_add_handle (Dwg_Handle *restrict hdl, const BITCODE_RC code,
9157                            const unsigned long value,
9158                            const Dwg_Object *restrict obj);
9159 
9160 /** Returns an existing ref with the same ownership (hard/soft, owner/pointer)
9161     or creates it. With obj non-NULL it may return a relative offset, otherwise
9162     always absolute.
9163 */
9164 EXPORT Dwg_Object_Ref *dwg_add_handleref (Dwg_Data *restrict dwg,
9165                                           const BITCODE_RC code,
9166                                           const unsigned long value,
9167                                           const Dwg_Object *restrict obj);
9168 /** Return a link to the global ref or a new one. Or a NULLHDL. */
9169 EXPORT Dwg_Object_Ref *
9170 dwg_dup_handleref (Dwg_Data *restrict dwg, const Dwg_Object_Ref *restrict ref);
9171 
9172 /** Creates a non-global, free'able handle ref. Never relative */
9173 EXPORT Dwg_Object_Ref *
9174 dwg_add_handleref_free (const BITCODE_RC code, const unsigned long absref);
9175 
9176 EXPORT const char *dwg_version_type (const Dwg_Version_Type version);
9177 EXPORT Dwg_Version_Type dwg_version_as (const char *version);
9178 EXPORT void dwg_errstrings (int error);
9179 
9180 EXPORT char *dwg_encrypt_SAT1 (BITCODE_BL blocksize,
9181                                BITCODE_RC *restrict acis_data,
9182                                int *restrict acis_data_offset);
9183 /* Converts v2 SAB acis_data in-place to SAT v1 encr_sat_data[].
9184    Sets _obj->_dxf_sab_converted to 1, denoting that encr_sat_data is NOT the
9185    encrypted acis_data anymore, rather the converted from SAB for DXF */
9186 EXPORT int dwg_convert_SAB_to_SAT1 (Dwg_Entity_3DSOLID *restrict _obj);
9187 
9188 
9189 /* The old color.index 0-256 */
9190 typedef struct rgbpalette {
9191   unsigned char r,g,b;
9192 } Dwg_RGB_Palette;
9193 EXPORT const Dwg_RGB_Palette *dwg_rgb_palette (void);
9194 /* Returns the RGB value for the palette index.
9195  */
9196 EXPORT BITCODE_BL dwg_rgb_palette_index (BITCODE_BS index);
9197 /* find a matching color index (0-255) for a truecolor rgb value.
9198    returns 256 if not found, i.e. the default ByLayer.
9199  */
9200 EXPORT BITCODE_BS dwg_find_color_index (BITCODE_BL rgb);
9201 
9202 /** Add the empty object to the DWG.
9203     Returns DWG_ERR_OUTOFMEM, -1 for realloced or 0 if not.
9204     objects are allocated in bulk, and all old obj pointers may become invalid.
9205     The new object is at &dwg->object[dwg->num_objects - 1].
9206 */
9207 EXPORT int dwg_add_object (Dwg_Data *restrict dwg);
9208 
9209 /* Find if an object name (our internal name, not anything used elsewhere)
9210    is defined, and return our fixed type, the public dxfname and if it's an entity. */
9211 EXPORT int dwg_object_name (const char *const restrict name, // in
9212                             const char **restrict dxfnamep,  // out, maybe NULL
9213                             Dwg_Object_Type *restrict typep, // out, maybe NULL
9214                             int *restrict is_entp,           // out, maybe NULL
9215                             Dwg_Class_Stability *restrict stabilityp); // out, maybe NULL
9216 
9217 /** Initialize the empty entity or object with its three structs.
9218     All fields are zero'd, some are initialized with default values, as
9219     defined in dwg.spec. obj->fixedtype is set, obj->type only for static types.
9220     Use dwg_encode_get_class for the variable types.
9221     Returns 0 or DWG_ERR_OUTOFMEM.
9222 */
9223 /* Start auto-generated content. Do not touch. */
9224 EXPORT int dwg_setup__3DFACE (Dwg_Object *obj);
9225 EXPORT int dwg_setup__3DSOLID (Dwg_Object *obj);
9226 EXPORT int dwg_setup_ARC (Dwg_Object *obj);
9227 EXPORT int dwg_setup_ATTDEF (Dwg_Object *obj);
9228 EXPORT int dwg_setup_ATTRIB (Dwg_Object *obj);
9229 EXPORT int dwg_setup_BLOCK (Dwg_Object *obj);
9230 EXPORT int dwg_setup_BODY (Dwg_Object *obj);
9231 EXPORT int dwg_setup_CIRCLE (Dwg_Object *obj);
9232 EXPORT int dwg_setup_DIMENSION_ALIGNED (Dwg_Object *obj);
9233 EXPORT int dwg_setup_DIMENSION_ANG2LN (Dwg_Object *obj);
9234 EXPORT int dwg_setup_DIMENSION_ANG3PT (Dwg_Object *obj);
9235 EXPORT int dwg_setup_DIMENSION_DIAMETER (Dwg_Object *obj);
9236 EXPORT int dwg_setup_DIMENSION_LINEAR (Dwg_Object *obj);
9237 EXPORT int dwg_setup_DIMENSION_ORDINATE (Dwg_Object *obj);
9238 EXPORT int dwg_setup_DIMENSION_RADIUS (Dwg_Object *obj);
9239 EXPORT int dwg_setup_ELLIPSE (Dwg_Object *obj);
9240 EXPORT int dwg_setup_ENDBLK (Dwg_Object *obj);
9241 EXPORT int dwg_setup_INSERT (Dwg_Object *obj);
9242 EXPORT int dwg_setup_LEADER (Dwg_Object *obj);
9243 EXPORT int dwg_setup_LINE (Dwg_Object *obj);
9244 EXPORT int dwg_setup_MINSERT (Dwg_Object *obj);
9245 EXPORT int dwg_setup_MLINE (Dwg_Object *obj);
9246 EXPORT int dwg_setup_MTEXT (Dwg_Object *obj);
9247 EXPORT int dwg_setup_OLEFRAME (Dwg_Object *obj);
9248 EXPORT int dwg_setup_POINT (Dwg_Object *obj);
9249 EXPORT int dwg_setup_POLYLINE_2D (Dwg_Object *obj);
9250 EXPORT int dwg_setup_POLYLINE_3D (Dwg_Object *obj);
9251 EXPORT int dwg_setup_POLYLINE_MESH (Dwg_Object *obj);
9252 EXPORT int dwg_setup_POLYLINE_PFACE (Dwg_Object *obj);
9253 EXPORT int dwg_setup_PROXY_ENTITY (Dwg_Object *obj);
9254 EXPORT int dwg_setup_RAY (Dwg_Object *obj);
9255 EXPORT int dwg_setup_REGION (Dwg_Object *obj);
9256 EXPORT int dwg_setup_SEQEND (Dwg_Object *obj);
9257 EXPORT int dwg_setup_SHAPE (Dwg_Object *obj);
9258 EXPORT int dwg_setup_SOLID (Dwg_Object *obj);
9259 EXPORT int dwg_setup_SPLINE (Dwg_Object *obj);
9260 EXPORT int dwg_setup_TEXT (Dwg_Object *obj);
9261 EXPORT int dwg_setup_TOLERANCE (Dwg_Object *obj);
9262 EXPORT int dwg_setup_TRACE (Dwg_Object *obj);
9263 EXPORT int dwg_setup_UNKNOWN_ENT (Dwg_Object *obj);
9264 EXPORT int dwg_setup_VERTEX_2D (Dwg_Object *obj);
9265 EXPORT int dwg_setup_VERTEX_3D (Dwg_Object *obj);
9266 EXPORT int dwg_setup_VERTEX_MESH (Dwg_Object *obj);
9267 EXPORT int dwg_setup_VERTEX_PFACE (Dwg_Object *obj);
9268 EXPORT int dwg_setup_VERTEX_PFACE_FACE (Dwg_Object *obj);
9269 EXPORT int dwg_setup_VIEWPORT (Dwg_Object *obj);
9270 EXPORT int dwg_setup_XLINE (Dwg_Object *obj);
9271 EXPORT int dwg_setup_APPID (Dwg_Object *obj);
9272 EXPORT int dwg_setup_APPID_CONTROL (Dwg_Object *obj);
9273 EXPORT int dwg_setup_BLOCK_CONTROL (Dwg_Object *obj);
9274 EXPORT int dwg_setup_BLOCK_HEADER (Dwg_Object *obj);
9275 EXPORT int dwg_setup_DICTIONARY (Dwg_Object *obj);
9276 EXPORT int dwg_setup_DIMSTYLE (Dwg_Object *obj);
9277 EXPORT int dwg_setup_DIMSTYLE_CONTROL (Dwg_Object *obj);
9278 EXPORT int dwg_setup_DUMMY (Dwg_Object *obj);
9279 EXPORT int dwg_setup_LAYER (Dwg_Object *obj);
9280 EXPORT int dwg_setup_LAYER_CONTROL (Dwg_Object *obj);
9281 EXPORT int dwg_setup_LONG_TRANSACTION (Dwg_Object *obj);
9282 EXPORT int dwg_setup_LTYPE (Dwg_Object *obj);
9283 EXPORT int dwg_setup_LTYPE_CONTROL (Dwg_Object *obj);
9284 EXPORT int dwg_setup_MLINESTYLE (Dwg_Object *obj);
9285 EXPORT int dwg_setup_STYLE (Dwg_Object *obj);
9286 EXPORT int dwg_setup_STYLE_CONTROL (Dwg_Object *obj);
9287 EXPORT int dwg_setup_UCS (Dwg_Object *obj);
9288 EXPORT int dwg_setup_UCS_CONTROL (Dwg_Object *obj);
9289 EXPORT int dwg_setup_UNKNOWN_OBJ (Dwg_Object *obj);
9290 EXPORT int dwg_setup_VIEW (Dwg_Object *obj);
9291 EXPORT int dwg_setup_VIEW_CONTROL (Dwg_Object *obj);
9292 EXPORT int dwg_setup_VPORT (Dwg_Object *obj);
9293 EXPORT int dwg_setup_VPORT_CONTROL (Dwg_Object *obj);
9294 EXPORT int dwg_setup_VX_CONTROL (Dwg_Object *obj);
9295 EXPORT int dwg_setup_VX_TABLE_RECORD (Dwg_Object *obj);
9296 /* untyped > 500 */
9297 EXPORT int dwg_setup_CAMERA (Dwg_Object *obj);
9298 EXPORT int dwg_setup_DGNUNDERLAY (Dwg_Object *obj);
9299 EXPORT int dwg_setup_DWFUNDERLAY (Dwg_Object *obj);
9300 EXPORT int dwg_setup_HATCH (Dwg_Object *obj);
9301 EXPORT int dwg_setup_IMAGE (Dwg_Object *obj);
9302 EXPORT int dwg_setup_LIGHT (Dwg_Object *obj);
9303 EXPORT int dwg_setup_LWPOLYLINE (Dwg_Object *obj);
9304 EXPORT int dwg_setup_MESH (Dwg_Object *obj);
9305 EXPORT int dwg_setup_MULTILEADER (Dwg_Object *obj);
9306 EXPORT int dwg_setup_OLE2FRAME (Dwg_Object *obj);
9307 EXPORT int dwg_setup_PDFUNDERLAY (Dwg_Object *obj);
9308 EXPORT int dwg_setup_SECTIONOBJECT (Dwg_Object *obj);
9309 EXPORT int dwg_setup_ACSH_BOOLEAN_CLASS (Dwg_Object *obj);
9310 EXPORT int dwg_setup_ACSH_BOX_CLASS (Dwg_Object *obj);
9311 EXPORT int dwg_setup_ACSH_CONE_CLASS (Dwg_Object *obj);
9312 EXPORT int dwg_setup_ACSH_CYLINDER_CLASS (Dwg_Object *obj);
9313 EXPORT int dwg_setup_ACSH_FILLET_CLASS (Dwg_Object *obj);
9314 EXPORT int dwg_setup_ACSH_HISTORY_CLASS (Dwg_Object *obj);
9315 EXPORT int dwg_setup_ACSH_SPHERE_CLASS (Dwg_Object *obj);
9316 EXPORT int dwg_setup_ACSH_TORUS_CLASS (Dwg_Object *obj);
9317 EXPORT int dwg_setup_ACSH_WEDGE_CLASS (Dwg_Object *obj);
9318 EXPORT int dwg_setup_BLOCKALIGNMENTGRIP (Dwg_Object *obj);
9319 EXPORT int dwg_setup_BLOCKALIGNMENTPARAMETER (Dwg_Object *obj);
9320 EXPORT int dwg_setup_BLOCKBASEPOINTPARAMETER (Dwg_Object *obj);
9321 EXPORT int dwg_setup_BLOCKFLIPACTION (Dwg_Object *obj);
9322 EXPORT int dwg_setup_BLOCKFLIPGRIP (Dwg_Object *obj);
9323 EXPORT int dwg_setup_BLOCKFLIPPARAMETER (Dwg_Object *obj);
9324 EXPORT int dwg_setup_BLOCKGRIPLOCATIONCOMPONENT (Dwg_Object *obj);
9325 EXPORT int dwg_setup_BLOCKLINEARGRIP (Dwg_Object *obj);
9326 EXPORT int dwg_setup_BLOCKLOOKUPGRIP (Dwg_Object *obj);
9327 EXPORT int dwg_setup_BLOCKMOVEACTION (Dwg_Object *obj);
9328 EXPORT int dwg_setup_BLOCKROTATEACTION (Dwg_Object *obj);
9329 EXPORT int dwg_setup_BLOCKROTATIONGRIP (Dwg_Object *obj);
9330 EXPORT int dwg_setup_BLOCKSCALEACTION (Dwg_Object *obj);
9331 EXPORT int dwg_setup_BLOCKVISIBILITYGRIP (Dwg_Object *obj);
9332 EXPORT int dwg_setup_CELLSTYLEMAP (Dwg_Object *obj);
9333 EXPORT int dwg_setup_DETAILVIEWSTYLE (Dwg_Object *obj);
9334 EXPORT int dwg_setup_DICTIONARYVAR (Dwg_Object *obj);
9335 EXPORT int dwg_setup_DICTIONARYWDFLT (Dwg_Object *obj);
9336 EXPORT int dwg_setup_DYNAMICBLOCKPURGEPREVENTER (Dwg_Object *obj);
9337 EXPORT int dwg_setup_FIELD (Dwg_Object *obj);
9338 EXPORT int dwg_setup_FIELDLIST (Dwg_Object *obj);
9339 EXPORT int dwg_setup_GEODATA (Dwg_Object *obj);
9340 EXPORT int dwg_setup_GROUP (Dwg_Object *obj);
9341 EXPORT int dwg_setup_IDBUFFER (Dwg_Object *obj);
9342 EXPORT int dwg_setup_IMAGEDEF (Dwg_Object *obj);
9343 EXPORT int dwg_setup_IMAGEDEF_REACTOR (Dwg_Object *obj);
9344 EXPORT int dwg_setup_INDEX (Dwg_Object *obj);
9345 EXPORT int dwg_setup_LAYERFILTER (Dwg_Object *obj);
9346 EXPORT int dwg_setup_LAYER_INDEX (Dwg_Object *obj);
9347 EXPORT int dwg_setup_LAYOUT (Dwg_Object *obj);
9348 EXPORT int dwg_setup_MLEADERSTYLE (Dwg_Object *obj);
9349 EXPORT int dwg_setup_PLACEHOLDER (Dwg_Object *obj);
9350 EXPORT int dwg_setup_PLOTSETTINGS (Dwg_Object *obj);
9351 EXPORT int dwg_setup_RASTERVARIABLES (Dwg_Object *obj);
9352 EXPORT int dwg_setup_SCALE (Dwg_Object *obj);
9353 EXPORT int dwg_setup_SECTIONVIEWSTYLE (Dwg_Object *obj);
9354 EXPORT int dwg_setup_SECTION_MANAGER (Dwg_Object *obj);
9355 EXPORT int dwg_setup_SORTENTSTABLE (Dwg_Object *obj);
9356 EXPORT int dwg_setup_SPATIAL_FILTER (Dwg_Object *obj);
9357 EXPORT int dwg_setup_TABLEGEOMETRY (Dwg_Object *obj);
9358 EXPORT int dwg_setup_VBA_PROJECT (Dwg_Object *obj);
9359 EXPORT int dwg_setup_VISUALSTYLE (Dwg_Object *obj);
9360 EXPORT int dwg_setup_WIPEOUTVARIABLES (Dwg_Object *obj);
9361 EXPORT int dwg_setup_XRECORD (Dwg_Object *obj);
9362 EXPORT int dwg_setup_PDFDEFINITION (Dwg_Object *obj);
9363 EXPORT int dwg_setup_DGNDEFINITION (Dwg_Object *obj);
9364 EXPORT int dwg_setup_DWFDEFINITION (Dwg_Object *obj);
9365 /* unstable */
9366 EXPORT int dwg_setup_ARC_DIMENSION (Dwg_Object *obj);
9367 EXPORT int dwg_setup_HELIX (Dwg_Object *obj);
9368 EXPORT int dwg_setup_LARGE_RADIAL_DIMENSION (Dwg_Object *obj);
9369 EXPORT int dwg_setup_PLANESURFACE (Dwg_Object *obj);
9370 EXPORT int dwg_setup_POINTCLOUD (Dwg_Object *obj);
9371 EXPORT int dwg_setup_POINTCLOUDEX (Dwg_Object *obj);
9372 EXPORT int dwg_setup_WIPEOUT (Dwg_Object *obj);
9373 EXPORT int dwg_setup_ACSH_BREP_CLASS (Dwg_Object *obj);
9374 EXPORT int dwg_setup_ACSH_CHAMFER_CLASS (Dwg_Object *obj);
9375 EXPORT int dwg_setup_ACSH_PYRAMID_CLASS (Dwg_Object *obj);
9376 EXPORT int dwg_setup_ALDIMOBJECTCONTEXTDATA (Dwg_Object *obj);
9377 EXPORT int dwg_setup_ASSOC2DCONSTRAINTGROUP (Dwg_Object *obj);
9378 EXPORT int dwg_setup_ASSOCACTION (Dwg_Object *obj);
9379 EXPORT int dwg_setup_ASSOCACTIONPARAM (Dwg_Object *obj);
9380 EXPORT int dwg_setup_ASSOCARRAYACTIONBODY (Dwg_Object *obj);
9381 EXPORT int dwg_setup_ASSOCASMBODYACTIONPARAM (Dwg_Object *obj);
9382 EXPORT int dwg_setup_ASSOCBLENDSURFACEACTIONBODY (Dwg_Object *obj);
9383 EXPORT int dwg_setup_ASSOCCOMPOUNDACTIONPARAM (Dwg_Object *obj);
9384 EXPORT int dwg_setup_ASSOCDEPENDENCY (Dwg_Object *obj);
9385 EXPORT int dwg_setup_ASSOCDIMDEPENDENCYBODY (Dwg_Object *obj);
9386 EXPORT int dwg_setup_ASSOCEXTENDSURFACEACTIONBODY (Dwg_Object *obj);
9387 EXPORT int dwg_setup_ASSOCEXTRUDEDSURFACEACTIONBODY (Dwg_Object *obj);
9388 EXPORT int dwg_setup_ASSOCFACEACTIONPARAM (Dwg_Object *obj);
9389 EXPORT int dwg_setup_ASSOCFILLETSURFACEACTIONBODY (Dwg_Object *obj);
9390 EXPORT int dwg_setup_ASSOCGEOMDEPENDENCY (Dwg_Object *obj);
9391 EXPORT int dwg_setup_ASSOCLOFTEDSURFACEACTIONBODY (Dwg_Object *obj);
9392 EXPORT int dwg_setup_ASSOCNETWORK (Dwg_Object *obj);
9393 EXPORT int dwg_setup_ASSOCNETWORKSURFACEACTIONBODY (Dwg_Object *obj);
9394 EXPORT int dwg_setup_ASSOCOBJECTACTIONPARAM (Dwg_Object *obj);
9395 EXPORT int dwg_setup_ASSOCOFFSETSURFACEACTIONBODY (Dwg_Object *obj);
9396 EXPORT int dwg_setup_ASSOCOSNAPPOINTREFACTIONPARAM (Dwg_Object *obj);
9397 EXPORT int dwg_setup_ASSOCPATCHSURFACEACTIONBODY (Dwg_Object *obj);
9398 EXPORT int dwg_setup_ASSOCPATHACTIONPARAM (Dwg_Object *obj);
9399 EXPORT int dwg_setup_ASSOCPLANESURFACEACTIONBODY (Dwg_Object *obj);
9400 EXPORT int dwg_setup_ASSOCPOINTREFACTIONPARAM (Dwg_Object *obj);
9401 EXPORT int dwg_setup_ASSOCREVOLVEDSURFACEACTIONBODY (Dwg_Object *obj);
9402 EXPORT int dwg_setup_ASSOCTRIMSURFACEACTIONBODY (Dwg_Object *obj);
9403 EXPORT int dwg_setup_ASSOCVALUEDEPENDENCY (Dwg_Object *obj);
9404 EXPORT int dwg_setup_ASSOCVARIABLE (Dwg_Object *obj);
9405 EXPORT int dwg_setup_ASSOCVERTEXACTIONPARAM (Dwg_Object *obj);
9406 EXPORT int dwg_setup_BLKREFOBJECTCONTEXTDATA (Dwg_Object *obj);
9407 EXPORT int dwg_setup_BLOCKALIGNEDCONSTRAINTPARAMETER (Dwg_Object *obj);
9408 EXPORT int dwg_setup_BLOCKANGULARCONSTRAINTPARAMETER (Dwg_Object *obj);
9409 EXPORT int dwg_setup_BLOCKARRAYACTION (Dwg_Object *obj);
9410 EXPORT int dwg_setup_BLOCKDIAMETRICCONSTRAINTPARAMETER (Dwg_Object *obj);
9411 EXPORT int dwg_setup_BLOCKHORIZONTALCONSTRAINTPARAMETER (Dwg_Object *obj);
9412 EXPORT int dwg_setup_BLOCKLINEARCONSTRAINTPARAMETER (Dwg_Object *obj);
9413 EXPORT int dwg_setup_BLOCKLINEARPARAMETER (Dwg_Object *obj);
9414 EXPORT int dwg_setup_BLOCKLOOKUPACTION (Dwg_Object *obj);
9415 EXPORT int dwg_setup_BLOCKLOOKUPPARAMETER (Dwg_Object *obj);
9416 EXPORT int dwg_setup_BLOCKPARAMDEPENDENCYBODY (Dwg_Object *obj);
9417 EXPORT int dwg_setup_BLOCKPOINTPARAMETER (Dwg_Object *obj);
9418 EXPORT int dwg_setup_BLOCKPOLARGRIP (Dwg_Object *obj);
9419 EXPORT int dwg_setup_BLOCKPOLARPARAMETER (Dwg_Object *obj);
9420 EXPORT int dwg_setup_BLOCKPOLARSTRETCHACTION (Dwg_Object *obj);
9421 EXPORT int dwg_setup_BLOCKRADIALCONSTRAINTPARAMETER (Dwg_Object *obj);
9422 EXPORT int dwg_setup_BLOCKREPRESENTATION (Dwg_Object *obj);
9423 EXPORT int dwg_setup_BLOCKROTATIONPARAMETER (Dwg_Object *obj);
9424 EXPORT int dwg_setup_BLOCKSTRETCHACTION (Dwg_Object *obj);
9425 EXPORT int dwg_setup_BLOCKUSERPARAMETER (Dwg_Object *obj);
9426 EXPORT int dwg_setup_BLOCKVERTICALCONSTRAINTPARAMETER (Dwg_Object *obj);
9427 EXPORT int dwg_setup_BLOCKVISIBILITYPARAMETER (Dwg_Object *obj);
9428 EXPORT int dwg_setup_BLOCKXYGRIP (Dwg_Object *obj);
9429 EXPORT int dwg_setup_BLOCKXYPARAMETER (Dwg_Object *obj);
9430 EXPORT int dwg_setup_DATALINK (Dwg_Object *obj);
9431 EXPORT int dwg_setup_DBCOLOR (Dwg_Object *obj);
9432 EXPORT int dwg_setup_EVALUATION_GRAPH (Dwg_Object *obj);
9433 EXPORT int dwg_setup_FCFOBJECTCONTEXTDATA (Dwg_Object *obj);
9434 EXPORT int dwg_setup_GRADIENT_BACKGROUND (Dwg_Object *obj);
9435 EXPORT int dwg_setup_GROUND_PLANE_BACKGROUND (Dwg_Object *obj);
9436 EXPORT int dwg_setup_IBL_BACKGROUND (Dwg_Object *obj);
9437 EXPORT int dwg_setup_IMAGE_BACKGROUND (Dwg_Object *obj);
9438 EXPORT int dwg_setup_LEADEROBJECTCONTEXTDATA (Dwg_Object *obj);
9439 EXPORT int dwg_setup_LIGHTLIST (Dwg_Object *obj);
9440 EXPORT int dwg_setup_MATERIAL (Dwg_Object *obj);
9441 EXPORT int dwg_setup_MENTALRAYRENDERSETTINGS (Dwg_Object *obj);
9442 EXPORT int dwg_setup_MTEXTOBJECTCONTEXTDATA (Dwg_Object *obj);
9443 EXPORT int dwg_setup_OBJECT_PTR (Dwg_Object *obj);
9444 EXPORT int dwg_setup_PARTIAL_VIEWING_INDEX (Dwg_Object *obj);
9445 EXPORT int dwg_setup_POINTCLOUDCOLORMAP (Dwg_Object *obj);
9446 EXPORT int dwg_setup_POINTCLOUDDEF (Dwg_Object *obj);
9447 EXPORT int dwg_setup_POINTCLOUDDEFEX (Dwg_Object *obj);
9448 EXPORT int dwg_setup_POINTCLOUDDEF_REACTOR (Dwg_Object *obj);
9449 EXPORT int dwg_setup_POINTCLOUDDEF_REACTOR_EX (Dwg_Object *obj);
9450 EXPORT int dwg_setup_PROXY_OBJECT (Dwg_Object *obj);
9451 EXPORT int dwg_setup_RAPIDRTRENDERSETTINGS (Dwg_Object *obj);
9452 EXPORT int dwg_setup_RENDERENTRY (Dwg_Object *obj);
9453 EXPORT int dwg_setup_RENDERENVIRONMENT (Dwg_Object *obj);
9454 EXPORT int dwg_setup_RENDERGLOBAL (Dwg_Object *obj);
9455 EXPORT int dwg_setup_RENDERSETTINGS (Dwg_Object *obj);
9456 EXPORT int dwg_setup_SECTION_SETTINGS (Dwg_Object *obj);
9457 EXPORT int dwg_setup_SKYLIGHT_BACKGROUND (Dwg_Object *obj);
9458 EXPORT int dwg_setup_SOLID_BACKGROUND (Dwg_Object *obj);
9459 EXPORT int dwg_setup_SPATIAL_INDEX (Dwg_Object *obj);
9460 EXPORT int dwg_setup_SUN (Dwg_Object *obj);
9461 EXPORT int dwg_setup_TABLESTYLE (Dwg_Object *obj);
9462 EXPORT int dwg_setup_TEXTOBJECTCONTEXTDATA (Dwg_Object *obj);
9463 EXPORT int dwg_setup_ASSOCARRAYMODIFYPARAMETERS (Dwg_Object *obj);
9464 EXPORT int dwg_setup_ASSOCARRAYPATHPARAMETERS (Dwg_Object *obj);
9465 EXPORT int dwg_setup_ASSOCARRAYPOLARPARAMETERS (Dwg_Object *obj);
9466 EXPORT int dwg_setup_ASSOCARRAYRECTANGULARPARAMETERS (Dwg_Object *obj);
9467 #ifdef DEBUG_CLASSES
9468   EXPORT int dwg_setup_ALIGNMENTPARAMETERENTITY (Dwg_Object *obj);
9469   EXPORT int dwg_setup_ARCALIGNEDTEXT (Dwg_Object *obj);
9470   EXPORT int dwg_setup_BASEPOINTPARAMETERENTITY (Dwg_Object *obj);
9471   EXPORT int dwg_setup_EXTRUDEDSURFACE (Dwg_Object *obj);
9472   EXPORT int dwg_setup_FLIPPARAMETERENTITY (Dwg_Object *obj);
9473   EXPORT int dwg_setup_GEOPOSITIONMARKER (Dwg_Object *obj);
9474   EXPORT int dwg_setup_LINEARPARAMETERENTITY (Dwg_Object *obj);
9475   EXPORT int dwg_setup_LOFTEDSURFACE (Dwg_Object *obj);
9476   EXPORT int dwg_setup_MPOLYGON (Dwg_Object *obj);
9477   EXPORT int dwg_setup_NAVISWORKSMODEL (Dwg_Object *obj);
9478   EXPORT int dwg_setup_NURBSURFACE (Dwg_Object *obj);
9479   EXPORT int dwg_setup_POINTPARAMETERENTITY (Dwg_Object *obj);
9480   EXPORT int dwg_setup_POLARGRIPENTITY (Dwg_Object *obj);
9481   EXPORT int dwg_setup_REVOLVEDSURFACE (Dwg_Object *obj);
9482   EXPORT int dwg_setup_ROTATIONPARAMETERENTITY (Dwg_Object *obj);
9483   EXPORT int dwg_setup_RTEXT (Dwg_Object *obj);
9484   EXPORT int dwg_setup_SWEPTSURFACE (Dwg_Object *obj);
9485   EXPORT int dwg_setup_TABLE (Dwg_Object *obj);
9486   EXPORT int dwg_setup_VISIBILITYGRIPENTITY (Dwg_Object *obj);
9487   EXPORT int dwg_setup_VISIBILITYPARAMETERENTITY (Dwg_Object *obj);
9488   EXPORT int dwg_setup_XYPARAMETERENTITY (Dwg_Object *obj);
9489   EXPORT int dwg_setup_ACMECOMMANDHISTORY (Dwg_Object *obj);
9490   EXPORT int dwg_setup_ACMESCOPE (Dwg_Object *obj);
9491   EXPORT int dwg_setup_ACMESTATEMGR (Dwg_Object *obj);
9492   EXPORT int dwg_setup_ACSH_EXTRUSION_CLASS (Dwg_Object *obj);
9493   EXPORT int dwg_setup_ACSH_LOFT_CLASS (Dwg_Object *obj);
9494   EXPORT int dwg_setup_ACSH_REVOLVE_CLASS (Dwg_Object *obj);
9495   EXPORT int dwg_setup_ACSH_SWEEP_CLASS (Dwg_Object *obj);
9496   EXPORT int dwg_setup_ANGDIMOBJECTCONTEXTDATA (Dwg_Object *obj);
9497   EXPORT int dwg_setup_ANNOTSCALEOBJECTCONTEXTDATA (Dwg_Object *obj);
9498   EXPORT int dwg_setup_ASSOC3POINTANGULARDIMACTIONBODY (Dwg_Object *obj);
9499   EXPORT int dwg_setup_ASSOCALIGNEDDIMACTIONBODY (Dwg_Object *obj);
9500   EXPORT int dwg_setup_ASSOCARRAYMODIFYACTIONBODY (Dwg_Object *obj);
9501   EXPORT int dwg_setup_ASSOCEDGEACTIONPARAM (Dwg_Object *obj);
9502   EXPORT int dwg_setup_ASSOCEDGECHAMFERACTIONBODY (Dwg_Object *obj);
9503   EXPORT int dwg_setup_ASSOCEDGEFILLETACTIONBODY (Dwg_Object *obj);
9504   EXPORT int dwg_setup_ASSOCMLEADERACTIONBODY (Dwg_Object *obj);
9505   EXPORT int dwg_setup_ASSOCORDINATEDIMACTIONBODY (Dwg_Object *obj);
9506   EXPORT int dwg_setup_ASSOCPERSSUBENTMANAGER (Dwg_Object *obj);
9507   EXPORT int dwg_setup_ASSOCRESTOREENTITYSTATEACTIONBODY (Dwg_Object *obj);
9508   EXPORT int dwg_setup_ASSOCROTATEDDIMACTIONBODY (Dwg_Object *obj);
9509   EXPORT int dwg_setup_ASSOCSWEPTSURFACEACTIONBODY (Dwg_Object *obj);
9510   EXPORT int dwg_setup_BLOCKPROPERTIESTABLE (Dwg_Object *obj);
9511   EXPORT int dwg_setup_BLOCKPROPERTIESTABLEGRIP (Dwg_Object *obj);
9512   EXPORT int dwg_setup_CONTEXTDATAMANAGER (Dwg_Object *obj);
9513   EXPORT int dwg_setup_CSACDOCUMENTOPTIONS (Dwg_Object *obj);
9514   EXPORT int dwg_setup_CURVEPATH (Dwg_Object *obj);
9515   EXPORT int dwg_setup_DATATABLE (Dwg_Object *obj);
9516   EXPORT int dwg_setup_DIMASSOC (Dwg_Object *obj);
9517   EXPORT int dwg_setup_DMDIMOBJECTCONTEXTDATA (Dwg_Object *obj);
9518   EXPORT int dwg_setup_DYNAMICBLOCKPROXYNODE (Dwg_Object *obj);
9519   EXPORT int dwg_setup_GEOMAPIMAGE (Dwg_Object *obj);
9520   EXPORT int dwg_setup_LAYOUTPRINTCONFIG (Dwg_Object *obj);
9521   EXPORT int dwg_setup_MLEADEROBJECTCONTEXTDATA (Dwg_Object *obj);
9522   EXPORT int dwg_setup_MOTIONPATH (Dwg_Object *obj);
9523   EXPORT int dwg_setup_MTEXTATTRIBUTEOBJECTCONTEXTDATA (Dwg_Object *obj);
9524   EXPORT int dwg_setup_NAVISWORKSMODELDEF (Dwg_Object *obj);
9525   EXPORT int dwg_setup_ORDDIMOBJECTCONTEXTDATA (Dwg_Object *obj);
9526   EXPORT int dwg_setup_PERSUBENTMGR (Dwg_Object *obj);
9527   EXPORT int dwg_setup_POINTPATH (Dwg_Object *obj);
9528   EXPORT int dwg_setup_RADIMLGOBJECTCONTEXTDATA (Dwg_Object *obj);
9529   EXPORT int dwg_setup_RADIMOBJECTCONTEXTDATA (Dwg_Object *obj);
9530   EXPORT int dwg_setup_SUNSTUDY (Dwg_Object *obj);
9531   EXPORT int dwg_setup_TABLECONTENT (Dwg_Object *obj);
9532   EXPORT int dwg_setup_TVDEVICEPROPERTIES (Dwg_Object *obj);
9533   //EXPORT int dwg_setup_ACDSRECORD (Dwg_Object *obj);
9534   //EXPORT int dwg_setup_ACDSSCHEMA (Dwg_Object *obj);
9535   //EXPORT int dwg_setup_NPOCOLLECTION (Dwg_Object *obj);
9536   //EXPORT int dwg_setup_RAPIDRTRENDERENVIRONMENT (Dwg_Object *obj);
9537   //EXPORT int dwg_setup_XREFPANELOBJECT (Dwg_Object *obj);
9538 #endif
9539 /* End auto-generated content */
9540 
9541 #ifdef __cplusplus
9542 }
9543 #endif
9544 
9545 #endif
9546