Patch:    ivtools-131104-scott-003
For:      ivtools-1.2.11
Author:   scott@wavesemi.com
Subject:  depth-first streaming primitive

This is an intermediate patch to ivtools-1.2.11.  To apply, cd to the
top-level directory of the ivtools source tree (the directory with src
and config subdirs), and apply like this:

	patch -p0 <ThisFile

Then rebuild with "make;make install"


Index: src/ComUnidraw/grstrmfunc.c
===================================================================
--- src/ComUnidraw/grstrmfunc.c	(revision 8255)
+++ src/ComUnidraw/grstrmfunc.c	(revision 8259)
@@ -186,13 +186,13 @@
     avl->Next(i);
     ComValue* stopval = (ComValue*)avl->GetAttrVal(i);
     
-    /* filter stream */
+    /* depth-first seach */
     if (currval->is_known()) {
       OverlayComp* currcomp = (OverlayComp*)currval->geta(OverlayComp::class_symid(), OVERLAY_COMP);
       OverlayComp* prevcomp = (OverlayComp*)prevval->geta(OverlayComp::class_symid(), OVERLAY_COMP);
       OverlayComp* stopcomp = (OverlayComp*)stopval->geta(OverlayComp::class_symid(), OVERLAY_COMP);
       OverlayComp* nextcomp = currcomp->DepthNext(prevcomp);
-      while(nextcomp && nextcomp==(OverlayComp*)currcomp->GetParent()) {
+      while(nextcomp && nextcomp==(OverlayComp*)currcomp->GetUp()) {
 	prevcomp=currcomp;
 	currcomp=nextcomp;
         nextcomp = currcomp->DepthNext(prevcomp);
Index: src/ComTerp/comvalue.c
===================================================================
--- src/ComTerp/comvalue.c	(revision 8255)
+++ src/ComTerp/comvalue.c	(revision 8259)
@@ -405,7 +405,8 @@
       return obj_val();
   } else {
     if (compid>=0 && object_compview()) {
-      if (((ComponentView*)obj_val())->GetSubject()->IsA(compid))
+      if (((ComponentView*)obj_val())->GetSubject() && 
+	  ((ComponentView*)obj_val())->GetSubject()->IsA(compid))
         return ((ComponentView*)obj_val())->GetSubject();
     }
     return nil;
Index: src/OverlayUnidraw/ovcomps.h
===================================================================
--- src/OverlayUnidraw/ovcomps.h	(revision 8255)
+++ src/OverlayUnidraw/ovcomps.h	(revision 8259)
@@ -186,6 +186,9 @@
     virtual void ClearVisit() { visited(false); }
     // clear visit mark 
 
+    virtual OverlayComp* GetUp() { return (OverlayComp*)GetParent(); }
+    // usually same as parent
+
 protected:
     ParamList* GetParamList();
     // return ParamList of required/optional/keyword arguments to be read
