Use correct name to iterate on enumeration constants.
The standard defines how to calculate the name for an access function or iterator if one is not given. It is supposed to be vpi followed by the words in the name with each word capitalized. For the one to many (iterator) interface from the enumeration typespec to the individual constants this is vpiEnumConst not vpiMember.
This commit is contained in:
parent
b905c699d1
commit
52d05c0215
|
|
@ -281,7 +281,7 @@ static PLI_INT32 ivl_enum_method_next_prev_calltf(PLI_BYTE8*name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for the current value in the enumeration list. */
|
/* Search for the current value in the enumeration list. */
|
||||||
enum_list = vpi_iterate(vpiMember, arg_enum);
|
enum_list = vpi_iterate(vpiEnumConst, arg_enum);
|
||||||
assert(enum_list);
|
assert(enum_list);
|
||||||
do {
|
do {
|
||||||
cur = vpi_scan(enum_list);
|
cur = vpi_scan(enum_list);
|
||||||
|
|
@ -307,7 +307,7 @@ static PLI_INT32 ivl_enum_method_next_prev_calltf(PLI_BYTE8*name)
|
||||||
if (strcmp(name, "$ivl_enum_method$next") == 0) {
|
if (strcmp(name, "$ivl_enum_method$next") == 0) {
|
||||||
/* Check to see if we need to wrap to the beginning. */
|
/* Check to see if we need to wrap to the beginning. */
|
||||||
if (loc + count > enum_size) {
|
if (loc + count > enum_size) {
|
||||||
enum_list = vpi_iterate(vpiMember, arg_enum);
|
enum_list = vpi_iterate(vpiEnumConst, arg_enum);
|
||||||
assert(enum_list);
|
assert(enum_list);
|
||||||
count -= (enum_size - loc);
|
count -= (enum_size - loc);
|
||||||
}
|
}
|
||||||
|
|
@ -321,7 +321,7 @@ static PLI_INT32 ivl_enum_method_next_prev_calltf(PLI_BYTE8*name)
|
||||||
} else {
|
} else {
|
||||||
/* The element we want is before the current
|
/* The element we want is before the current
|
||||||
* element (at the beginning of the list). */
|
* element (at the beginning of the list). */
|
||||||
enum_list = vpi_iterate(vpiMember, arg_enum);
|
enum_list = vpi_iterate(vpiEnumConst, arg_enum);
|
||||||
assert(enum_list);
|
assert(enum_list);
|
||||||
count = loc - count;
|
count = loc - count;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ static vpiHandle enum_type_iterate(int code, vpiHandle obj)
|
||||||
struct __vpiEnumTypespec*ref = vpip_enum_typespec_from_handle(obj);
|
struct __vpiEnumTypespec*ref = vpip_enum_typespec_from_handle(obj);
|
||||||
assert(ref);
|
assert(ref);
|
||||||
|
|
||||||
if (code == vpiMember) {
|
if (code == vpiEnumConst) {
|
||||||
vpiHandle*args = (vpiHandle*)
|
vpiHandle*args = (vpiHandle*)
|
||||||
calloc(ref->names.size(), sizeof(vpiHandle*));
|
calloc(ref->names.size(), sizeof(vpiHandle*));
|
||||||
for (size_t idx = 0 ; idx < ref->names.size() ; idx += 1)
|
for (size_t idx = 0 ; idx < ref->names.size() ; idx += 1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue