(root)/
libredwg-0.13/
test/
unit-testing/
xrecord.c
       1  #define DWG_TYPE DWG_TYPE_XRECORD
       2  #include "common.c"
       3  
       4  void
       5  api_process (dwg_object *obj)
       6  {
       7    int error;
       8    BITCODE_BL xdata_size;
       9    BITCODE_BS cloning;
      10    BITCODE_BL num_xdata;
      11    Dwg_Resbuf *xdata;
      12    BITCODE_H parent;
      13    BITCODE_BL num_objid_handles;
      14    BITCODE_H *objid_handles;
      15  
      16    dwg_obj_xrecord *xrecord = dwg_object_to_XRECORD (obj);
      17  
      18    CHK_ENTITY_TYPE (xrecord, XRECORD, xdata_size,
      19                     BL); // called num_databytes in old API
      20    CHK_ENTITY_TYPE (xrecord, XRECORD, cloning, BS);
      21    CHK_ENTITY_TYPE_W_OBJ (xrecord, XRECORD, num_xdata, BL);
      22    // CHK_ENTITY_TYPE_W_OBJ (xrecord, XRECORD, xdata, TV);
      23    if (!dwg_dynapi_entity_value (xrecord, "XRECORD", "xdata", &xdata, NULL))
      24      fail ("dwg_dynapi_entity_value");
      25  #if 0
      26    else
      27        // TODO: is xdata is still a linked list, not an array
      28        for (BITCODE_BL i=0; i<num_xdata; i++)
      29          {
      30            if (xdata[i] && xrecord->xdata[i] &&
      31                !memcmp(&xdata[i], &xrecord->xdata[i], sizeof (Dwg_Resbuf)))
      32              pass ();
      33            else
      34              fail ("xrecord->xdata[%d]", i);
      35          }
      36  #else
      37    if (xdata == xrecord->xdata)
      38      pass ();
      39    else
      40      fail ("xrecord->xdata[0]");
      41  #endif
      42    CHK_ENTITY_TYPE_W_OBJ (xrecord, XRECORD, num_objid_handles, BL);
      43    CHK_ENTITY_HV (xrecord, XRECORD, objid_handles, num_objid_handles);
      44  }