Skip to content

Commit

Permalink
unknown: add ATTDEF with MTEXT bits
Browse files Browse the repository at this point in the history
  • Loading branch information
rurban committed Oct 9, 2024
1 parent 681f961 commit 45946aa
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 29 deletions.
1 change: 1 addition & 0 deletions examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ alldxf_unknowns = \
alldxf_ACSH_SWEEP_CLASS.inc \
alldxf_ARC_DIMENSION.inc \
alldxf_ASSOCDIMDEPENDENCYBODY.inc \
alldxf_ATTDEF.inc \
alldxf_BLOCKALIGNMENTGRIP.inc \
alldxf_BLOCKARRAYACTION.inc \
alldxf_BLOCKGRIPLOCATIONCOMPONENT.inc \
Expand Down
1 change: 1 addition & 0 deletions examples/alldwg.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13357,3 +13357,4 @@
{ "WIPEOUT", "statika_from_uloz.to_2000.log", 0xF948, "844DE4829D968334124DACCD6C413FFB02003408A7AB3F9CD02A0000000000301C902000000000000F03F000000000000F03F43E646400812099C1800000001C07E000000000001C17ECBCDFFFFFFFFBF7E000000000001C17ECBCDFFFFFFFFBF7E000000000001C07F9C1800000001C07E000000000001C07F820C60A6167C84A6167C50A0608", NULL, 1, 1076, 1314, 989, 0, 0, 2303 },
{ "WIPEOUT", "statika_from_uloz.to_2000.log", 0xF951, "8E9C2168D4B6A334124DACCD6C413FFB02001812B78F099DD02A0000000000301C902000000000000F03F000000000000F03F43E64640081208000000000001C17E000000000001C17E000000000001C17E000000000001C07E000000000001C07E000000000001C07E000000000001C07E000000000001C17F82046080C0A6167C84A6167C50A0608", NULL, 1, 1092, 1314, 989, 0, 0, 2303 },
{ "WIPEOUT", "statika_from_uloz.to_2000.log", 0xF955, "88FA7E4F0BD6B334124DACCD6C413FFB02003408A7AB3F9CD02A0000000000301C902000000000000F03F000000000000F03F43E646400812099C1800000001C17E000000000001C07ECBCDFFFFFFFFBE7E000000000001C07ECBCDFFFFFFFFBE7E000000000001C17F9C1800000001C17E000000000001C17F820C60A6167C84A6167C50A0608", NULL, 1, 1076, 1314, 989, 0, 0, 2303 },
{ "ATTDEF", "AecObjects_from_ACadSharp_2018.log", 0x2F7F, "E00087A00000F82B5E8F00FEA5AA0CCCCCCCCCCCFCCFD084169015504A10D400001F056BD1E01FD555000010452004F004F004D0041148013C013C01340111530050004100430045004F0042004A0045004300", "test/test-old/2018/from_ACadSharp/AecObjects.dxf", NULL, 1, 664, 38, 11909, 1430, 0, 664 },
2 changes: 2 additions & 0 deletions examples/alldxf_0.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2224,3 +2224,5 @@
"\216\202\363\175\020\305\041\034\003\377\377\377\377\377\374\067\002\072\013\315\364\103\024\210\120\052\072\013\315\364\103\024\210\120\040\000\000\000\000\000\017\003\360\000\000\000\000\000\017\003\364\036\144\144\000\100\220\140\000\000\000\000\000\015\013\366\031\233\015\017\126\315\173\360\000\000\000\000\000\016\013\363\114\331\345\341\102\153\023\360\200\000\000\000\000\015\013\377\257\377\377\377\377\375\363\377\057\377\377\377\377\374\363\360\000\000\000\000\000\016\003\360\000\000\000\000\000\016\003\366\034\331\345\341\102\153\023\360\360\000\000\000\000\015\003\365\231\233\015\017\126\315\173\366\010\042\210\202\201\207\007", 1, 1283, 1579, 1239, 0, 0, 281, NULL },
{ "WIPEOUT", "test/test-data/2013/flipped.dxf", 0x40C7, /* 1110 */
"\200\000\000\012\000\303\021\274\000\000\000\002\000\051\340\037\002\017\116\330\103\274\136\210\320\011\004\141\105\133\176\240\354\010\220\106\024\125\267\352\016\100\017\116\330\103\274\136\210\320\040\000\000\000\000\000\017\003\360\000\000\000\000\000\017\003\364\036\144\144\000\100\221\040\000\000\002\013\303\034\053\360\000\000\014\016\153\175\353\360\000\000\000\002\225\331\143\360\000\000\000\000\000\016\013\360\000\000\003\011\241\014\323\360\000\000\000\006\350\255\313\360\000\000\014\210\266\375\123\360\000\000\012\006\374\315\173\360\000\000\005\206\236\315\303\360\000\000\010\006\050\314\273\360\000\000\001\011\130\355\343\360\000\000\010\001\064\114\073\360\000\000\011\007\157\135\363\360\000\000\000\005\156\332\053\360\000\000\015\012\070\155\363\360\000\000\010\006\143\073\163\360\000\000\006\002\331\135\303\360\000\000\000\006\041\034\323\360\000\000\013\207\363\155\143\360\000\000\004\007\342\115\163\360\000\000\017\010\076\214\103\360\000\000\004\003\265\175\343\360\000\000\000\014\123\072\113\360\000\000\000\000\000\016\003\360\000\000\012\005\222\074\333\360\000\000\006\000\131\275\303\360\000\000\013\010\352\055\213\360\000\000\012\015\231\075\103\360\000\000\011\202\216\055\333\360\000\000\010\017\166\134\163\360\000\000\000\000\000\016\013\360\000\000\000\005\056\332\033\360\000\000\016\207\112\155\273\360\000\000\016\015\163\255\013\360\000\000\014\207\252\335\113\360\000\000\004\011\247\315\213\366\010\062\222\020\072\201\207\007", 1, 2955, 3891, 2903, 0, 0, 679, NULL },
// name, dxf, handle, bytes, is_entity, num_bits, commonsize, hdloff, strsize, hdlsize, bitsize, fieldptr
{ "ATTDEF", "test/test-old/2018/from_ACadSharp/AecObjects.dxf", 0x2F7F, "E00087A00000F82B5E8F00FEA5AA0CCCCCCCCCCCFCCFD084169015504A10D400001F056BD1E01FD555000010452004F004F004D0041148013C013C01340111530050004100430045004F0042004A0045004300540053003A004E0041004D0045004254801BC01BC01B4008001B8018401B401940120005", 1, 947, 0, 0, 0, 0, 947, NULL },
1 change: 1 addition & 0 deletions examples/alldxf_1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@
#include "alldxf_SWEPTSURFACE.inc"
#include "alldxf_TABLESTYLE.inc"
#include "alldxf_WIPEOUT.inc"
#include "alldxf_ATTDEF.inc"
1 change: 1 addition & 0 deletions examples/alldxf_2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1112,3 +1112,4 @@ unknown_dxf[1107].fields = unknown_dxf_WIPEOUT_1107;
unknown_dxf[1108].fields = unknown_dxf_WIPEOUT_1108;
unknown_dxf[1109].fields = unknown_dxf_WIPEOUT_1109;
unknown_dxf[1110].fields = unknown_dxf_WIPEOUT_1110;
unknown_dxf[1111].fields = unknown_dxf_ATTDEF_2F7F;
21 changes: 13 additions & 8 deletions examples/bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ decode (Bit_Chain *dat, int off, const int size)
int p = (int)bit_position (dat);
if (d != bit_nan ())
{
printf ("%.15f BD @%d (%d)\n", d, p, size);
printf ("%.15f BD @%d @%u.%u (%d)\n", d, p, p/8, p%8, size);
pos = p;
}
bit_set_position (dat, off);
Expand All @@ -52,7 +52,7 @@ decode (Bit_Chain *dat, int off, const int size)
int p = (int)bit_position (dat);
if (d != bit_nan ())
{
printf ("%.15f RD @%d (%d)\n", d, p, size);
printf ("%.15f RD @%d @%u.%u (%d)\n", d, p, p/8, p%8, size);
pos = p;
}
bit_set_position (dat, off);
Expand All @@ -63,7 +63,7 @@ decode (Bit_Chain *dat, int off, const int size)
int p = (int)bit_position (dat);
if (p <= size - off)
{
printf ("%u BL @%d (%d)\n", l, p, size);
printf ("%u BL @%d @%u.%u (%d)\n", l, p, p/8, p%8, size);
pos = p;
}
bit_set_position (dat, off);
Expand All @@ -72,7 +72,7 @@ decode (Bit_Chain *dat, int off, const int size)
{
BITCODE_BL l = (long)bit_read_RL (dat);
pos = (int)bit_position (dat);
printf ("%u RL @%d (%d)\n", l, pos, size);
printf ("%u RL @%d @%u.%u (%d)\n", l, pos, pos/8, pos%8, size);
bit_set_position (dat, off);
}
if (size - off >= 16)
Expand Down Expand Up @@ -177,6 +177,7 @@ int
main (int argc, char *argv[])
{
int hex = 0;
int print_bits = 0;
int i;
int pos;
Bit_Chain dat = EMPTY_CHAIN (0);
Expand All @@ -190,14 +191,16 @@ main (int argc, char *argv[])
"or examples/bits -x '8055 40f9 3284 d222 3e40 7436 e0d9 23fd'\n");
return 1;
}
if (argc > 2 && !strcmp (argv[1], "-x"))
i = 1;
if (argc > 2 && !strcmp (argv[i], "-x"))
{
hex = 1;
i = 2;
i++;
}
else
if (argc > 2 && !strcmp (argv[i], "-b"))
{
i = 1;
print_bits = 1;
i++;
}

// dat.chain = malloc (size + 1);
Expand All @@ -224,6 +227,8 @@ main (int argc, char *argv[])
while (i < argc);

pos = (int)bit_position (&dat);
if (print_bits)
bit_print_bits (&dat.chain[0], pos);
// accept all types, like CMC, BS, BL, HANDLE and print all possible variants
pos = decode (&dat, 0, (int)pos);

Expand Down
2 changes: 1 addition & 1 deletion examples/log_unknown.pl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ =head1 DESCRIPTION
}
next unless $bitsize and $handle;

if (/^unknown_bits \[(\d+) \((\d+),(-?\d+),(\d+)\) (\d+) TF\]: ([0-9A-F]+$)/) {
if (/^unknown_(?:bits|rest) \[(\d+) \((\d+),(-?\d+),(\d+)\) (\d+) TF\]: ([0-9A-F]+$)/) {
($num_bits, $commonsize, $hdloff, $strsize, $len, $b) = ($1, $2, $3, $4, $5, $6);
print "//offsets=$num_bits, $commonsize, $hdloff, $strsize, $hdlsize. len=$len\n";
chomp $b; next;
Expand Down
1 change: 0 additions & 1 deletion src/bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,6 @@ bit_read_BS (Bit_Chain *dat)
void
bit_write_BS (Bit_Chain *dat, BITCODE_BS value)
{
// BITCODE_BS is defined as uint16_t, but better safe than sorry
const uint16_t l = value;
if (l > 256)
{
Expand Down
4 changes: 2 additions & 2 deletions src/dec_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -992,8 +992,8 @@
double bd; \
Dwg_Handle hdl; \
rs = 24; \
if (objsize > 0 && dat->byte + rs > objsize) \
rs = (objsize - dat->byte) & 0xFFFF; \
if ((objsize) > 0 && dat->byte + rs > (objsize)) \
rs = ((objsize) - dat->byte) & 0xFFFF; \
if (dat->byte + rs > dat->size) \
rs = (dat->size - dat->byte - 1) & 0xFFFF; \
tmp = bit_read_TF (dat, (size_t)rs); \
Expand Down
34 changes: 17 additions & 17 deletions src/dwg.spec
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,15 @@ DWG_ENTITY_END
{ \
FIELD_B (is_really_locked, 0); \
DXF { \
SUB_FIELD_3BD (mtext, x_axis_dir, 11); \
DXF { VALUE_TFF ( "Embedded Object", 101 ); } \
SUB_FIELD_3BD (mtext, ins_pt, 10); \
FIELD_BD (alignment_pt.x, 11); \
FIELD_BD (alignment_pt.y, 21); \
VALUE_RD (0.0, 31); \
VALUE_TFF ( "Embedded Object", 101 ); \
FIELD_BD (ins_pt.x, 10); \
FIELD_BD (ins_pt.y, 20); \
VALUE_RD (0.0, 30); \
SUB_FIELD_BD (mtext, rect_width, 40); \
SUB_FIELD_BD (mtext, rect_height, 41); \
SUB_FIELD_BD (mtext, extents_width, 42); \
SUB_FIELD_BD (mtext, extents_height, 43); \
SUB_FIELD_BL (mtext, column_type, 71); \
SUB_VALUEOUTOFBOUNDS (mtext, column_type, 2) \
if (SUB_FIELD_VALUE (mtext, column_type)) \
Expand All @@ -217,25 +219,23 @@ DWG_ENTITY_END
FIELD_BS (annotative_data_size, 70); \
if (FIELD_VALUE (annotative_data_size) > 0) \
{ \
/* TODO looks more like the prompt TU is here */ \
/* FIELD_TF (annotative_data, _obj->annotative_data_size, 0); */\
/*FIELD_TF (annotative_data, _obj->annotative_data_size, 0);*/ \
SUB_FIELD_BS (mtext, attachment, 70); \
/*SUB_FIELD_3BD (mtext, x_axis_dir, 11);*/ \
DXF { VALUE_TFF ( "Embedded Object", 101 ); } \
SUB_FIELD_3BD (mtext, ins_pt, 10); \
DEBUG_HERE_OBJ \
SUB_FIELD_BD (mtext, rect_width, 40); \
SUB_FIELD_3BD (mtext, ins_pt, 10); \
SUB_FIELD_3BD (mtext, x_axis_dir, 11); \
SUB_FIELD_BD (mtext, rect_height, 41); \
SUB_FIELD_BD (mtext, extents_width, 42); \
SUB_FIELD_BD (mtext, extents_height, 43); \
SUB_FIELD_BL (mtext, column_type, 71); \
SUB_VALUEOUTOFBOUNDS (mtext, column_type, 2) \
SUB_FIELD_BD (mtext, rect_width, 40); /* 1.2: @112 */ \
/*SUB_FIELD_BD (mtext, extents_width, 42); \
SUB_FIELD_BD (mtext, extents_height, 43);*/ \
SUB_FIELD_BS (mtext, column_type, 71); /* 8: @180 */ \
/*SUB_VALUEOUTOFBOUNDS (mtext, column_type, 2)*/ \
if (SUB_FIELD_VALUE (mtext, column_type)) \
{ \
SUB_FIELD_BL (mtext, num_column_heights, 72); \
SUB_FIELD_BS (mtext, num_column_heights, 72); /* 5: @23.5 */\
SUB_FIELD_BD (mtext, column_width, 44); \
SUB_FIELD_BD (mtext, gutter, 45); \
SUB_FIELD_B (mtext, auto_height, 73); \
SUB_FIELD_BS (mtext, auto_height, 73); /* 1: 25.3 */ \
SUB_FIELD_B (mtext, flow_reversed, 74); \
if (!SUB_FIELD_VALUE (mtext, auto_height) \
&& SUB_FIELD_VALUE (mtext, column_type) == 2) \
Expand Down
4 changes: 4 additions & 0 deletions src/spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -1354,3 +1354,7 @@
# define PRER13_SECTION_HDR(name)
# define DWG_TABLE(token) DWG_OBJECT (token)
#endif

#ifndef _DEBUG_HERE
# define _DEBUG_HERE(x)
#endif

0 comments on commit 45946aa

Please sign in to comment.