Skip to content

Commit

Permalink
Fix BLOCKSTRETCHACTION object codes
Browse files Browse the repository at this point in the history
Part of GH#1054
Revised by Reini Urban
  • Loading branch information
michal-josef-spacek authored and rurban committed Dec 8, 2024
1 parent ea93bca commit 5dce8b0
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 63 deletions.
6 changes: 3 additions & 3 deletions doc/dynapi.texi
Original file line number Diff line number Diff line change
Expand Up @@ -13796,10 +13796,10 @@ BD*
struct _dwg_object_BLOCKSTRETCHACTION*
@item bl95
BL, DXF 95
@item bs76
@item num_indexes
BS, DXF 76
@item bl94
BL, DXF 94
@item indexes
BL*

@end vtable
@end indentedblock
Expand Down
6 changes: 3 additions & 3 deletions include/dwg.h
Original file line number Diff line number Diff line change
Expand Up @@ -7806,9 +7806,9 @@ typedef struct _dwg_BLOCKSTRETCHACTION_handles {

typedef struct _dwg_BLOCKSTRETCHACTION_codes {
struct _dwg_object_BLOCKSTRETCHACTION *parent;
BITCODE_BL bl95; // 95
BITCODE_BS bs76; // 76
BITCODE_BL bl94; // 94
BITCODE_BL bl95; // 95
BITCODE_BS num_indexes; // 76
BITCODE_BL *indexes; // 94
} Dwg_BLOCKSTRETCHACTION_codes;

typedef struct _dwg_object_BLOCKSTRETCHACTION
Expand Down
76 changes: 38 additions & 38 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/* Define if __attribute__((visibility("default"))) is supported. */
#undef HAVE_ATTRIBUTE_VISIBILITY_DEFAULT

/* Define to 1 if you have the `basename' function. */
/* Define to 1 if you have the 'basename' function. */
#undef HAVE_BASENAME

/* Define to 1 if be64toh is available in <endian.h>. */
Expand Down Expand Up @@ -81,7 +81,7 @@
/* Define to 1 if you have the <float.h> header file. */
#undef HAVE_FLOAT_H

/* Define to 1 if you have the `floor' function. */
/* Define to 1 if you have the 'floor' function. */
#undef HAVE_FLOOR

/* Define to 1 if the system has the `aligned' function attribute */
Expand All @@ -108,13 +108,13 @@
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H

/* Define to 1 if you have the `getopt_long' function. */
/* Define to 1 if you have the 'getopt_long' function. */
#undef HAVE_GETOPT_LONG

/* Define to 1 if you have the `gettimeofday' function. */
/* Define to 1 if you have the 'gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY

/* Define to 1 if you have the `gmtime_r' function. */
/* Define to 1 if you have the 'gmtime_r' function. */
#undef HAVE_GMTIME_R

/* macOS 12.6.5 lies about its gperf version, using size_t as 3.0 */
Expand Down Expand Up @@ -156,7 +156,7 @@
/* Define to 1 if you have the <libgen.h> header file. */
#undef HAVE_LIBGEN_H

/* Define to 1 if you have the `m' library (-lm). */
/* Define to 1 if you have the 'm' library (-lm). */
#undef HAVE_LIBM

/* Define to 1 if you have the <libps/pslib.h> header file. */
Expand All @@ -168,20 +168,20 @@
/* Define to 1 if you have the <machine/endian.h> header file. */
#undef HAVE_MACHINE_ENDIAN_H

/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
/* Define to 1 if your system has a GNU libc compatible 'malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC

/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H

/* Define to 1 if you have the `memchr' function. */
/* Define to 1 if you have the 'memchr' function. */
#undef HAVE_MEMCHR

/* Define to 1 if you have the `memmem' function. */
/* Define to 1 if you have the 'memmem' function. */
#undef HAVE_MEMMEM

/* Define to 1 if you have the `memmove' function. */
/* Define to 1 if you have the 'memmove' function. */
#undef HAVE_MEMMOVE

/* Define to 1 if you have the <mimalloc-override.h> header file. */
Expand All @@ -196,26 +196,26 @@
/* If available, contains the Python version number currently in use. */
#undef HAVE_PYTHON

/* Define to 1 if your system has a GNU libc compatible `realloc' function,
/* Define to 1 if your system has a GNU libc compatible 'realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC

/* Define to 1 if you have the `scandir' function. */
/* Define to 1 if you have the 'scandir' function. */
#undef HAVE_SCANDIR

/* Define to 1 if you have the `setenv' function. */
/* Define to 1 if you have the 'setenv' function. */
#undef HAVE_SETENV

/* Define to 1 if you have the `sincos' function. */
/* Define to 1 if you have the 'sincos' function. */
#undef HAVE_SINCOS

/* Define to 1 if you have the `sqrt' function. */
/* Define to 1 if you have the 'sqrt' function. */
#undef HAVE_SQRT

/* Define to 1 if you have the `sscanf_s' function. */
/* Define to 1 if you have the 'sscanf_s' function. */
#undef HAVE_SSCANF_S

/* Define to 1 if `stat' has the bug that it succeeds when given the
/* Define to 1 if 'stat' has the bug that it succeeds when given the
zero-length file name argument. */
#undef HAVE_STAT_EMPTY_STRING_BUG

Expand All @@ -231,13 +231,13 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the `strcasecmp' function. */
/* Define to 1 if you have the 'strcasecmp' function. */
#undef HAVE_STRCASECMP

/* Define to 1 if you have the `strcasestr' function. */
/* Define to 1 if you have the 'strcasestr' function. */
#undef HAVE_STRCASESTR

/* Define to 1 if you have the `strchr' function. */
/* Define to 1 if you have the 'strchr' function. */
#undef HAVE_STRCHR

/* Define to 1 if you have the <strings.h> header file. */
Expand All @@ -246,25 +246,25 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the `strnlen' function. */
/* Define to 1 if you have the 'strnlen' function. */
#undef HAVE_STRNLEN

/* Define to 1 if you have the `strrchr' function. */
/* Define to 1 if you have the 'strrchr' function. */
#undef HAVE_STRRCHR

/* Define to 1 if you have the `strstr' function. */
/* Define to 1 if you have the 'strstr' function. */
#undef HAVE_STRSTR

/* Define to 1 if you have the `strtol' function. */
/* Define to 1 if you have the 'strtol' function. */
#undef HAVE_STRTOL

/* Define to 1 if you have the `strtoll' function. */
/* Define to 1 if you have the 'strtoll' function. */
#undef HAVE_STRTOLL

/* Define to 1 if you have the `strtoul' function. */
/* Define to 1 if you have the 'strtoul' function. */
#undef HAVE_STRTOUL

/* Define to 1 if you have the `strtoull' function. */
/* Define to 1 if you have the 'strtoull' function. */
#undef HAVE_STRTOULL

/* Define to 1 if you have the <sys/byteorder.h> header file. */
Expand Down Expand Up @@ -294,19 +294,19 @@
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H

/* Define to 1 if you have the `wcscmp' function. */
/* Define to 1 if you have the 'wcscmp' function. */
#undef HAVE_WCSCMP

/* Define to 1 if you have the `wcscpy' function. */
/* Define to 1 if you have the 'wcscpy' function. */
#undef HAVE_WCSCPY

/* Define to 1 if you have the `wcslen' function. */
/* Define to 1 if you have the 'wcslen' function. */
#undef HAVE_WCSLEN

/* Define to 1 if you have the `wcsnlen' function. */
/* Define to 1 if you have the 'wcsnlen' function. */
#undef HAVE_WCSNLEN

/* Define to 1 if you have the `wcsstr' function. */
/* Define to 1 if you have the 'wcsstr' function. */
#undef HAVE_WCSSTR

/* Define to 1 if you have the <wctype.h> header file. */
Expand All @@ -321,7 +321,7 @@
/* Define to 1 if you have the <winsock2.h> header file. */
#undef HAVE_WINSOCK2_H

/* Define to 1 if the system has the type `_Bool'. */
/* Define to 1 if the system has the type '_Bool'. */
#undef HAVE__BOOL

/* Define as const if the declaration of iconv() needs const. */
Expand All @@ -331,7 +331,7 @@
DWG versions and objects. */
#undef IS_RELEASE

/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
/* Define to 1 if 'lstat' dereferences a symlink specified with a trailing
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK

Expand Down Expand Up @@ -359,7 +359,7 @@
/* Define to the printf() modifier to use with size_t. */
#undef PRI_SIZE_T_MODIFIER

/* The size of `size_t', as computed by sizeof. */
/* The size of 'size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T

/* The number of bytes in type wchar_t */
Expand All @@ -373,7 +373,7 @@
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION

/* Define to 1 if all of the C90 standard headers exist (not just the ones
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
Expand Down Expand Up @@ -412,7 +412,7 @@
/* Needed for cygwin strdup */
#undef __XSI_VISIBLE

/* Define to `__inline__' or `__inline' if that's what the C compiler
/* Define to '__inline__' or '__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
Expand All @@ -439,7 +439,7 @@
/* If restrict is broken with this C compiler */
#undef restrict

/* Define to `unsigned int' if <sys/types.h> does not define. */
/* Define as 'unsigned int' if <stddef.h> doesn't define. */
#undef size_t

/* Define to the type of an unsigned integer type of width exactly 16 bits if
Expand Down
7 changes: 3 additions & 4 deletions src/dwg.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12428,17 +12428,16 @@ DWG_OBJECT (BLOCKSTRETCHACTION)
REPEAT_BLOCK
SUB_FIELD_HANDLE (hdls[rcount1], hdl, 0, 331);
SUB_FIELD_BS (hdls[rcount1], num_indexes, 74);
SUB_FIELD_VALUE (hdls[rcount1], indexes) = (BITCODE_BL *)calloc (_obj->hdls[rcount1].num_indexes, sizeof (BITCODE_BL));
SUB_FIELD_VECTOR_INL (hdls[rcount1], indexes, BL, _obj->hdls[rcount1].num_indexes, 94);
SUB_FIELD_VECTOR (hdls[rcount1], indexes, BL, num_indexes, 94);
SET_PARENT_OBJ (hdls[rcount1]);
END_REPEAT_BLOCK
END_REPEAT (hdls)
FIELD_BL (num_codes, 75);
REPEAT (num_codes, codes, Dwg_BLOCKSTRETCHACTION_codes)
REPEAT_BLOCK
SUB_FIELD_BL (codes[rcount1], bl95, 95);
SUB_FIELD_BS (codes[rcount1], bs76, 76);
SUB_FIELD_BL (codes[rcount1], bl94, 94);
SUB_FIELD_BS (codes[rcount1], num_indexes, 76);
SUB_FIELD_VECTOR (codes[rcount1], indexes, BL, num_indexes, 94);
SET_PARENT_OBJ (codes[rcount1]);
END_REPEAT_BLOCK
END_REPEAT (codes)
Expand Down
6 changes: 3 additions & 3 deletions src/dynapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -11242,10 +11242,10 @@ static const Dwg_DYNAPI_field _dwg_BLOCKSTRETCHACTION_codes_fields[] = {
1,1,0, 0 },
{ "bl95", "BL", sizeof (BITCODE_BL), OFF (struct _dwg_BLOCKSTRETCHACTION_codes, bl95),
0,0,0, 95 },
{ "bs76", "BS", sizeof (BITCODE_BS), OFF (struct _dwg_BLOCKSTRETCHACTION_codes, bs76),
{ "num_indexes", "BS", sizeof (BITCODE_BS), OFF (struct _dwg_BLOCKSTRETCHACTION_codes, num_indexes),
0,0,0, 76 },
{ "bl94", "BL", sizeof (BITCODE_BL), OFF (struct _dwg_BLOCKSTRETCHACTION_codes, bl94),
0,0,0, 94 },
{ "indexes", "BL*", sizeof (BITCODE_BL*), OFF (struct _dwg_BLOCKSTRETCHACTION_codes, indexes),
1,1,0, 0 },
{NULL, NULL, 0, 0, 0,0,0, 0},
};
/* from typedef struct _dwg_BLOCKSTRETCHACTION_handles: (sorted by offset) */
Expand Down
26 changes: 16 additions & 10 deletions src/in_dxf.c
Original file line number Diff line number Diff line change
Expand Up @@ -7906,18 +7906,24 @@ add_AcDbBlockStretchAction (Dwg_Object *restrict obj, Bit_Chain *restrict dat)
dxf_free_pair (pair);

pair = dxf_read_pair (dat);
EXPECT_DXF (obj->name, o->codes[i].bs76, 76);
o->codes[i].bs76 = pair->value.i;
LOG_TRACE ("%s.codes[%d].bs76 = %d [BS 76]\n", obj->name, i,
o->codes[i].bs76);
EXPECT_DXF (obj->name, o->codes[i].num_indexes, 76);
o->codes[i].num_indexes = pair->value.i;
LOG_TRACE ("%s.codes[%d].num_indexes = %d [BS 76]\n", obj->name, i,
o->codes[i].num_indexes);
dxf_free_pair (pair);

pair = dxf_read_pair (dat);
EXPECT_DXF (obj->name, o->codes[i].bl94, 94);
o->codes[i].bl94 = pair->value.i;
LOG_TRACE ("%s.codes[%d].bl94 = %d [BL 94]\n", obj->name, i,
o->codes[i].bl94);
dxf_free_pair (pair);
if (o->codes[i].num_indexes)
{
for (unsigned j = 0; j < o->hdls[i].num_indexes; j++)
{
pair = dxf_read_pair (dat);
EXPECT_DXF (obj->name, o->codes[i].indexes[j], 94);
o->codes[i].indexes[j] = pair->value.i;
LOG_TRACE ("%s.codes[%d].indexes[%d] = %d [BL 94]\n", obj->name, i, j,
o->codes[i].indexes[j]);
dxf_free_pair (pair);
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/unit-testing/blockstretchaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ api_process (dwg_object *obj)
for (i = 0; i < num_codes; i++)
{
CHK_SUBCLASS_TYPE (_obj->codes[i], BLOCKSTRETCHACTION_codes, bl95, BL);
CHK_SUBCLASS_TYPE (_obj->codes[i], BLOCKSTRETCHACTION_codes, bs76, BS);
CHK_SUBCLASS_TYPE (_obj->codes[i], BLOCKSTRETCHACTION_codes, bl94, BL);
CHK_SUBCLASS_TYPE (_obj->codes[i], BLOCKSTRETCHACTION_codes, num_indexes, BS);
CHK_SUBCLASS_VECTOR_TYPE (_obj->codes[i], BLOCKSTRETCHACTION_codes, indexes, _obj->codes[i].num_indexes, BL);
}

CHK_ENTITY_TYPE (_obj, BLOCKSTRETCHACTION, action_offset_x, BD);
Expand Down

0 comments on commit 5dce8b0

Please sign in to comment.