(root)/
libredwg-0.13/
test/
unit-testing/
attrib.c
       1  #define DWG_TYPE DWG_TYPE_ATTRIB
       2  #include "common.c"
       3  
       4  void
       5  api_process (dwg_object *obj)
       6  {
       7    int error = 0, isnew;
       8    double elevation, thickness, rotation, height, oblique_angle, width_factor;
       9    BITCODE_BS generation, vert_alignment, horiz_alignment, annotative_data_size,
      10        annotative_short;
      11    BITCODE_RC dataflags, class_version, type, annotative_data_bytes;
      12    char *text_value;
      13    dwg_point_3d extrusion;
      14    dwg_point_2d ins_pt, alignment_pt;
      15    BITCODE_H style, annotative_app, mtext_style;
      16    BITCODE_B lock_position_flag;
      17  
      18    Dwg_Version_Type version = obj->parent->header.version;
      19    dwg_ent_attrib *attrib = dwg_object_to_ATTRIB (obj);
      20  
      21    CHK_ENTITY_UTF8TEXT (attrib, ATTRIB, text_value);
      22  #ifdef USE_DEPRECATED_API
      23    if (version < R_2007
      24        && (strcmp (dwg_ent_attrib_get_text (attrib, &error), text_value)
      25            || error))
      26      fail ("old API dwg_ent_attrib_get_text");
      27  #endif
      28    CHK_ENTITY_2RD (attrib, ATTRIB, ins_pt);
      29    CHK_ENTITY_2RD (attrib, ATTRIB, alignment_pt);
      30    CHK_ENTITY_3RD_W_OLD (attrib, ATTRIB, extrusion);
      31    CHK_ENTITY_TYPE (attrib, ATTRIB, elevation, BD);
      32    CHK_ENTITY_TYPE (attrib, ATTRIB, dataflags, RC);
      33    CHK_ENTITY_TYPE_W_OLD (attrib, ATTRIB, height, RD);
      34    CHK_ENTITY_TYPE_W_OLD (attrib, ATTRIB, thickness, RD);
      35    CHK_ENTITY_TYPE_W_OLD (attrib, ATTRIB, rotation, RD);
      36    CHK_ENTITY_MAX (attrib, ATTRIB, rotation, RD, MAX_ANGLE);
      37    CHK_ENTITY_TYPE (attrib, ATTRIB, oblique_angle, RD);
      38    CHK_ENTITY_MAX (attrib, ATTRIB, oblique_angle, RD, MAX_ANGLE);
      39    CHK_ENTITY_TYPE (attrib, ATTRIB, width_factor, RD);
      40    CHK_ENTITY_TYPE (attrib, ATTRIB, generation, BS);
      41  
      42    CHK_ENTITY_TYPE_W_OLD (attrib, ATTRIB, vert_alignment, BS);
      43    CHK_ENTITY_TYPE_W_OLD (attrib, ATTRIB, horiz_alignment, BS);
      44    CHK_ENTITY_H (attrib, ATTRIB, style);
      45    if (version >= R_2010)
      46      {
      47        CHK_ENTITY_TYPE (attrib, ATTRIB, class_version, RC);
      48      }
      49    if (version >= R_2018)
      50      {
      51        CHK_ENTITY_TYPE (attrib, ATTRIB, type, RC);
      52        CHK_ENTITY_H (attrib, ATTRIB, mtext_style);
      53        CHK_ENTITY_TYPE (attrib, ATTRIB, annotative_data_size, BS);
      54        CHK_ENTITY_TYPE (attrib, ATTRIB, annotative_data_bytes, RC);
      55        CHK_ENTITY_H (attrib, ATTRIB, annotative_app);
      56        CHK_ENTITY_TYPE (attrib, ATTRIB, annotative_short, BS);
      57      }
      58    if (version >= R_2007)
      59      {
      60        CHK_ENTITY_TYPE (attrib, ATTRIB, lock_position_flag, B);
      61      }
      62  }