Skip to content
Browse files

Fix vpiScope iterator.

  • Loading branch information...
1 parent 329e943 commit fbaf8f91bbe2175751116b348491f7a283e7f6e1 steve committed Jul 14, 2002
Showing with 23 additions and 4 deletions.
  1. +23 −4 vvp/vpi_scope.cc
View
27 vvp/vpi_scope.cc
@@ -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,21 +97,37 @@ 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)
return 0;
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.
*

0 comments on commit fbaf8f9

Please sign in to comment.
Something went wrong with that request. Please try again.