Skip to content

Commit f436fd6

Browse files
michal-josef-spacekrurban
authored andcommitted
Improve vector logging
New one in MLINE: verts[0].vertex: (-1.20008e+06, -800053, 0) [3BD 11] verts[0].vertex_direction: (1, 0, 0) [3BD 12] verts[0].miter_direction: (2.22045e-16, 1, 0) [3BD 13] verts[0].lines[0].num_segparms: 2 [BS 74] verts[0].lines[0].segparms[0]: 0 [BD 41] verts[0].lines[0].segparms[1]: 0 [BD 41] verts[0].lines[0].num_areafillparms: 0 [BS 75] verts[0].lines[1].num_segparms: 2 [BS 74] verts[0].lines[1].segparms[0]: 0 [BD 41] verts[0].lines[1].segparms[1]: 0 [BD 41] verts[0].lines[1].num_areafillparms: 0 [BS 75] verts[1].vertex: (-1.20008e+06, -800053, 0) [3BD 11] verts[1].vertex_direction: (1, 0, 0) [3BD 12] verts[1].miter_direction: (2.22045e-16, 1, 0) [3BD 13] verts[1].lines[0].num_segparms: 2 [BS 74] verts[1].lines[0].segparms[0]: 0 [BD 41] verts[1].lines[0].segparms[1]: 0 [BD 41] verts[1].lines[0].num_areafillparms: 0 [BS 75] verts[1].lines[1].num_segparms: 2 [BS 74] verts[1].lines[1].segparms[0]: 0 [BD 41] verts[1].lines[1].segparms[1]: 0 [BD 41] verts[1].lines[1].num_areafillparms: 0 [BS 75] Affected lines with segparms. Previously something: verts[rcount1].lines[rcount2].segparms[0]: 0 [BD 41]
1 parent ea95e6d commit f436fd6

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

src/dec_macros.h

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,38 @@
197197
#define LOG_TRACE_TF(var, len) LOG_TF (TRACE, var, len)
198198
#define LOG_INSANE_TF(var, len) LOG_TF (INSANE, var, len)
199199

200+
#define FIELD_VEC_TRACE_N(nam, type, vcount, value, dxf) \
201+
if (DWG_LOGLEVEL >= DWG_LOGLEVEL_TRACE) \
202+
{ \
203+
char *s1 = strrplc (#nam, "[rcount1]", "[%d]"); \
204+
if (s1) \
205+
{ \
206+
char *s2 = strrplc (s1, "[rcount2]", "[%d]"); \
207+
if (s2) \
208+
{ \
209+
GCC46_DIAG_IGNORE (-Wformat-nonliteral) \
210+
LOG_TRACE (strcat (s2, "[%ld]: " FORMAT_##type " [" #type \
211+
" %d]"), rcount1, rcount2, vcount, value, dxf) \
212+
GCC46_DIAG_RESTORE \
213+
free (s2); \
214+
free (s1); \
215+
} \
216+
else \
217+
{ \
218+
GCC46_DIAG_IGNORE (-Wformat-nonliteral) \
219+
LOG_TRACE (strcat (s1, "[%ld]: " FORMAT_##type " [" #type \
220+
" %d]"), rcount1, vcount, value, dxf) \
221+
GCC46_DIAG_RESTORE \
222+
free (s1); \
223+
} \
224+
} \
225+
else \
226+
{ \
227+
LOG_TRACE (#nam "[%ld]: " FORMAT_##type " [" #type " %d]", \
228+
vcount, value, dxf) \
229+
} \
230+
LOG_POS; \
231+
}
200232
#define FIELD_2PT_TRACE(nam, type, dxf) \
201233
if (DWG_LOGLEVEL >= DWG_LOGLEVEL_TRACE) \
202234
{ \
@@ -1090,9 +1122,8 @@
10901122
for (vcount = 0; vcount < (BITCODE_BL)size; vcount++) \
10911123
{ \
10921124
_obj->name[vcount] = bit_read_##type (dat); \
1093-
LOG_TRACE (#name "[%ld]: " FORMAT_##type " [" #type " %d]", \
1094-
(long)vcount, _obj->name[vcount], dxf) \
1095-
LOG_POS \
1125+
FIELD_VEC_TRACE_N (name, type, (long)vcount, _obj->name[vcount], \
1126+
dxf) \
10961127
} \
10971128
}
10981129
#define SUB_FIELD_VECTOR_N(o, nam, type, csize, dxf) \

0 commit comments

Comments
 (0)