1 // unstable
2 #define DWG_TYPE DWG_TYPE_SECTION_SETTINGS
3 #include "common.c"
4 
5 void
api_process(dwg_object * obj)6 api_process (dwg_object *obj)
7 {
8   int error, isnew;
9   BITCODE_BS curr_type;
10   BITCODE_BL i, j, num_types, num_geom;
11   Dwg_SECTION_typesettings *types;
12   Dwg_SECTION_geometrysettings *geom;
13   BITCODE_BS type, generation;
14   BITCODE_BL num_sources;
15   BITCODE_H *sources;
16   BITCODE_H destblock;
17   BITCODE_T destfile;
18   BITCODE_CMC color;
19   BITCODE_T layer;
20   BITCODE_T ltype;
21   BITCODE_BD ltype_scale;
22   BITCODE_T plotstyle;
23   BITCODE_BLd linewt;
24   BITCODE_BS face_transparency;
25   BITCODE_BS edge_transparency;
26   BITCODE_BS hatch_type;
27   BITCODE_T hatch_pattern;
28   BITCODE_BD hatch_angle;
29   BITCODE_BD hatch_spacing;
30   BITCODE_BD hatch_scale;
31 
32   Dwg_Version_Type dwg_version = obj->parent->header.version;
33   dwg_obj_section_settings *_obj = dwg_object_to_SECTION_SETTINGS (obj);
34 
35   CHK_ENTITY_TYPE (_obj, SECTION_SETTINGS, curr_type, BS);
36   CHK_ENTITY_MAX (_obj, SECTION_SETTINGS, curr_type, BS, 8);
37   CHK_ENTITY_TYPE (_obj, SECTION_SETTINGS, num_types, BL);
38   CHK_ENTITY_MAX (_obj, SECTION_SETTINGS, num_types, BL, 8);
39   if (!dwg_dynapi_entity_value (_obj, "SECTION_SETTINGS", "types", &types, NULL))
40     fail ("SECTION_SETTINGS.types");
41   else
42     for (i = 0; i < num_types; i++)
43       {
44         ok ("SECTION_SETTINGS.types[%d]", i);
45         CHK_SUBCLASS_TYPE (types[i], SECTION_typesettings, type, BS);
46         CHK_SUBCLASS_MAX (types[i], SECTION_typesettings, type, BS, 8);
47         CHK_SUBCLASS_TYPE (types[i], SECTION_typesettings, generation, BS);
48         CHK_SUBCLASS_MAX (types[i], SECTION_typesettings, generation, BS, 128);
49         CHK_SUBCLASS_TYPE (types[i], SECTION_typesettings, num_sources, BL);
50         CHK_SUBCLASS_MAX (types[i], SECTION_typesettings, num_sources, BL, 5000);
51         CHK_SUBCLASS_HV (types[i], SECTION_typesettings, sources, types[i].num_sources);
52         CHK_SUBCLASS_H (types[i], SECTION_typesettings, destblock);
53         CHK_SUBCLASS_UTF8TEXT (types[i], SECTION_typesettings, destfile);
54         CHK_SUBCLASS_TYPE (types[i], SECTION_typesettings, num_geom, BL);
55         if (!dwg_dynapi_subclass_value (&types[i], "SECTION_typesettings", "geom", &geom, NULL))
56           fail ("SECTION_SETTINGS.types[%d].geom", i);
57         else
58           for (j = 0; j < types[i].num_geom; j++)
59             {
60               ok ("SECTION_SETTINGS.types[%d].geom[%d]", i, j);
61               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, num_geoms, BL);
62               CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, num_geoms, BL, 8);
63               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, hexindex, BLx);
64               CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, hexindex, BL, 32);
65               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, flags, BL);
66               CHK_SUBCLASS_CMC (geom[j], SECTION_geometrysettings, color);
67               CHK_SUBCLASS_UTF8TEXT (geom[j], SECTION_geometrysettings, layer);
68               CHK_SUBCLASS_UTF8TEXT (geom[j], SECTION_geometrysettings, ltype);
69               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, ltype_scale, BD);
70               CHK_SUBCLASS_UTF8TEXT (geom[j], SECTION_geometrysettings, plotstyle);
71               SINCE (R_2000)
72                 CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, linewt, BLd);
73               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, face_transparency, BS);
74               CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, face_transparency, BS, 100);
75               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, edge_transparency, BS);
76               CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, edge_transparency, BS, 100);
77               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, hatch_type, BS);
78               CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, hatch_type, BS, 8);
79               CHK_SUBCLASS_UTF8TEXT (geom[j], SECTION_geometrysettings, hatch_pattern);
80               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, hatch_angle, BD);
81               CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, hatch_angle, BD, MAX_ANGLE);
82               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, hatch_spacing, BD);
83               CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, hatch_scale, BD);
84             }
85       }
86 }
87