(root)/
libredwg-0.13/
test/
unit-testing/
section_settings.c
       1  // unstable
       2  #define DWG_TYPE DWG_TYPE_SECTION_SETTINGS
       3  #include "common.c"
       4  
       5  void
       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,
      40                                  NULL))
      41      fail ("SECTION_SETTINGS.types");
      42    else
      43      for (i = 0; i < num_types; i++)
      44        {
      45          ok ("SECTION_SETTINGS.types[%d]", i);
      46          CHK_SUBCLASS_TYPE (types[i], SECTION_typesettings, type, BS);
      47          CHK_SUBCLASS_MAX (types[i], SECTION_typesettings, type, BS, 8);
      48          CHK_SUBCLASS_TYPE (types[i], SECTION_typesettings, generation, BS);
      49          CHK_SUBCLASS_MAX (types[i], SECTION_typesettings, generation, BS, 128);
      50          CHK_SUBCLASS_TYPE (types[i], SECTION_typesettings, num_sources, BL);
      51          CHK_SUBCLASS_MAX (types[i], SECTION_typesettings, num_sources, BL,
      52                            5000);
      53          CHK_SUBCLASS_HV (types[i], SECTION_typesettings, sources,
      54                           types[i].num_sources);
      55          CHK_SUBCLASS_H (types[i], SECTION_typesettings, destblock);
      56          CHK_SUBCLASS_UTF8TEXT (types[i], SECTION_typesettings, destfile);
      57          CHK_SUBCLASS_TYPE (types[i], SECTION_typesettings, num_geom, BL);
      58          if (!dwg_dynapi_subclass_value (&types[i], "SECTION_typesettings",
      59                                          "geom", &geom, NULL))
      60            fail ("SECTION_SETTINGS.types[%d].geom", i);
      61          else
      62            for (j = 0; j < types[i].num_geom; j++)
      63              {
      64                ok ("SECTION_SETTINGS.types[%d].geom[%d]", i, j);
      65                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, num_geoms,
      66                                   BL);
      67                CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, num_geoms,
      68                                  BL, 8);
      69                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, hexindex,
      70                                   BLx);
      71                CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, hexindex,
      72                                  BL, 32);
      73                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, flags, BL);
      74                CHK_SUBCLASS_CMC (geom[j], SECTION_geometrysettings, color);
      75                CHK_SUBCLASS_UTF8TEXT (geom[j], SECTION_geometrysettings, layer);
      76                CHK_SUBCLASS_UTF8TEXT (geom[j], SECTION_geometrysettings, ltype);
      77                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings,
      78                                   ltype_scale, BD);
      79                CHK_SUBCLASS_UTF8TEXT (geom[j], SECTION_geometrysettings,
      80                                       plotstyle);
      81                SINCE (R_2000)
      82                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, linewt,
      83                                   BLd);
      84                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings,
      85                                   face_transparency, BS);
      86                CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings,
      87                                  face_transparency, BS, 100);
      88                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings,
      89                                   edge_transparency, BS);
      90                CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings,
      91                                  edge_transparency, BS, 100);
      92                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings, hatch_type,
      93                                   BS);
      94                CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, hatch_type,
      95                                  BS, 8);
      96                CHK_SUBCLASS_UTF8TEXT (geom[j], SECTION_geometrysettings,
      97                                       hatch_pattern);
      98                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings,
      99                                   hatch_angle, BD);
     100                CHK_SUBCLASS_MAX (geom[j], SECTION_geometrysettings, hatch_angle,
     101                                  BD, MAX_ANGLE);
     102                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings,
     103                                   hatch_spacing, BD);
     104                CHK_SUBCLASS_TYPE (geom[j], SECTION_geometrysettings,
     105                                   hatch_scale, BD);
     106              }
     107        }
     108  }