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:
Cary R 2011-10-12 09:29:55 -07:00 committed by Stephen Williams
parent b905c699d1
commit 52d05c0215
2 changed files with 4 additions and 4 deletions

View File

@ -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. */
enum_list = vpi_iterate(vpiMember, arg_enum);
enum_list = vpi_iterate(vpiEnumConst, arg_enum);
assert(enum_list);
do {
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) {
/* Check to see if we need to wrap to the beginning. */
if (loc + count > enum_size) {
enum_list = vpi_iterate(vpiMember, arg_enum);
enum_list = vpi_iterate(vpiEnumConst, arg_enum);
assert(enum_list);
count -= (enum_size - loc);
}
@ -321,7 +321,7 @@ static PLI_INT32 ivl_enum_method_next_prev_calltf(PLI_BYTE8*name)
} else {
/* The element we want is before the current
* element (at the beginning of the list). */
enum_list = vpi_iterate(vpiMember, arg_enum);
enum_list = vpi_iterate(vpiEnumConst, arg_enum);
assert(enum_list);
count = loc - count;
}

View File

@ -87,7 +87,7 @@ static vpiHandle enum_type_iterate(int code, vpiHandle obj)
struct __vpiEnumTypespec*ref = vpip_enum_typespec_from_handle(obj);
assert(ref);
if (code == vpiMember) {
if (code == vpiEnumConst) {
vpiHandle*args = (vpiHandle*)
calloc(ref->names.size(), sizeof(vpiHandle*));
for (size_t idx = 0 ; idx < ref->names.size() ; idx += 1)