Fix vpiScope iterator.
This commit is contained in:
parent
329e943e4e
commit
fbaf8f91bb
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_scope.cc,v 1.17 2002/07/12 18:23:30 steve Exp $"
|
||||
#ident "$Id: vpi_scope.cc,v 1.18 2002/07/14 02:52:05 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compile.h"
|
||||
|
|
@ -97,13 +97,29 @@ static vpiHandle scope_get_handle(int code, vpiHandle obj)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Handle subclasses for vpiTypes */
|
||||
static inline int compare_types(int code, int type)
|
||||
{
|
||||
if (code == type ||
|
||||
code == vpiScope &&
|
||||
type == vpiModule ||
|
||||
type == vpiFunction ||
|
||||
type == vpiTask ||
|
||||
type == vpiNamedBegin ||
|
||||
type == vpiNamedFork)
|
||||
{
|
||||
return 1;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static vpiHandle module_iter_subset(int code, struct __vpiScope*ref)
|
||||
{
|
||||
unsigned mcnt = 0, ncnt = 0;
|
||||
vpiHandle*args;
|
||||
|
||||
for (unsigned idx = 0 ; idx < ref->nintern ; idx += 1)
|
||||
if (ref->intern[idx]->vpi_type->type_code == code)
|
||||
if (compare_types(code, ref->intern[idx]->vpi_type->type_code))
|
||||
mcnt += 1;
|
||||
|
||||
if (mcnt == 0)
|
||||
|
|
@ -111,7 +127,7 @@ static vpiHandle module_iter_subset(int code, struct __vpiScope*ref)
|
|||
|
||||
args = (vpiHandle*)calloc(mcnt, sizeof(vpiHandle));
|
||||
for (unsigned idx = 0 ; idx < ref->nintern ; idx += 1)
|
||||
if (ref->intern[idx]->vpi_type->type_code == code)
|
||||
if (compare_types(code, ref->intern[idx]->vpi_type->type_code))
|
||||
args[ncnt++] = ref->intern[idx];
|
||||
|
||||
assert(ncnt == mcnt);
|
||||
|
|
@ -136,7 +152,7 @@ static vpiHandle module_iter(int code, vpiHandle obj)
|
|||
|
||||
switch (code) {
|
||||
case vpiInternalScope:
|
||||
return vpip_make_iterator(ref->nintern, ref->intern, false);
|
||||
return module_iter_subset(vpiScope, ref);
|
||||
|
||||
/* Generate and iterator for all the modules contained
|
||||
in this scope. */
|
||||
|
|
@ -392,6 +408,9 @@ void vpip_attach_to_current_scope(vpiHandle obj)
|
|||
|
||||
/*
|
||||
* $Log: vpi_scope.cc,v $
|
||||
* Revision 1.18 2002/07/14 02:52:05 steve
|
||||
* Fix vpiScope iterator.
|
||||
*
|
||||
* Revision 1.17 2002/07/12 18:23:30 steve
|
||||
* Use result buf for event and scope names.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue