From cd6876a7850a11117fee511384a46ba42bca6f49 Mon Sep 17 00:00:00 2001
From: Jake Read <jake.read@cba.mit.edu>
Date: Mon, 16 Dec 2019 14:18:23 -0500
Subject: [PATCH] is continue, not break

---
 hunks/view.js  | 41 ++++++++++++++++++++++++++++-------------
 style.css      | 11 +++++++++++
 view/blocks.js |  2 ++
 3 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/hunks/view.js b/hunks/view.js
index 80ac7f4..83d2997 100644
--- a/hunks/view.js
+++ b/hunks/view.js
@@ -464,6 +464,7 @@ export default function View() {
         spec.inputs[i].ind = i
         spec.inputs[i].parent = od
         od.inputs.push(spec.inputs[i])
+        //console.log(`indice: ${i}, pushed, now len: ${od.inputs.length}`)
       }
     }
     for (let o in spec.outputs) {
@@ -474,6 +475,7 @@ export default function View() {
         spec.outputs[o].ind = o
         spec.outputs[o].parent = od
         od.outputs.push(spec.outputs[o])
+        //console.log(`indice: ${o}, pushed, now len: ${od.outputs.length}`)
       }
     }
     for (let s in spec.states) {
@@ -988,6 +990,7 @@ export default function View() {
             }
             // de-reference to indice-indice type,
             for (let cn of op.conn) {
+              console.log(`SL ${df.name} op ${op.name} push ${cn.parent.ind}, ${cn.ind}`)
               oph.conn.push([parseInt(cn.parent.ind), parseInt(cn.ind)])
             }
             hnk.outputs.push(oph)
@@ -1071,12 +1074,20 @@ export default function View() {
     return new Promise(async (resolve, reject) => {
       let nh = patch.hunks.length
       let recursor = async (n) => {
+        if(debug) console.log(`MLL for ${patch.hunks[n].name}`)
         // we want to walk the list of outputs in the patch, and reconn.
         for (let op in patch.hunks[n].outputs) {
-          if (!defs[n].outputs[op]) break // if the thing-actually-loaded doesn't have an output here, pass
-          if (!patch.hunks[n].outputs[op].conn) break // during some serializations / deserializations, empty arrays are culled, so
+          if(debug) console.log(`MLL for ${patch.hunks[n].outputs[op].name}`)
+          if (!defs[n].outputs[op]){
+            if(debug) console.log(`no output for reciprocal actual-def`)
+            break // if the thing-actually-loaded doesn't have an output here, pass
+          }
+          if (!patch.hunks[n].outputs[op].conn) {
+            if(debug) console.log(`no conn for patch op`)
+            continue // during some serializations / deserializations, empty arrays are culled, so
+          }
           for (let cn of patch.hunks[n].outputs[op].conn) {
-            if (debug) console.log('mergeLinkList would like to conn', n, op, 'to', cn)
+            if (debug) console.log(`conn for ${patch.hunks[n].name}, output ${op}, to ${patch.hunks[cn[0]].name}, ${cn[1]}`)
             // now! we would like to see about whether / not this link already exist.
             // it's possible to double up wires, so let's try not to ...
             let existenceProof = defs[n].outputs[op].conn.find((cand) => {
@@ -1086,19 +1097,22 @@ export default function View() {
             if (existenceProof) {
               if (debug) console.log('link exists, continueing')
               continue
-            }
-            // here is case to put error handling in the ll, at addlink,
-            // then just ignore the ones we miss ...
-            try {
-              await this.requestAddLinkLikeACaveman(n, op, cn[0], cn[1])
-            } catch (err) {
-              console.error('passing by this erroneous link-addition during link-list merging')
-              console.error(err)
+            } else {
+              // here is case to put error handling in the ll, at addlink,
+              // then just ignore the ones we miss ...
+              try {
+                if(debug) console.log('go for add', n, op, 'to', cn)
+                await this.requestAddLinkLikeACaveman(n, op, cn[0], cn[1])
+              } catch (err) {
+                console.error('passing by this erroneous link-addition during link-list merging')
+                console.error(err)
+              }
             }
           }
         } // end for-each-output
-        if ((n++) < (nh - 1)) {
-          recursor(n++)
+        n ++
+        if (n < nh) {
+          recursor(n)
         } else {
           resolve()
         }
@@ -1118,6 +1132,7 @@ export default function View() {
       try {
         await mergeHunkList(system, debug)
         await mergeLinkList(system, debug)
+        console.log(`MLL COMPLETE`)
         for (let s in system.hunks) {
           let spec = system.hunks[s]
           if (spec.contains) {
diff --git a/style.css b/style.css
index fd42f43..8019260 100644
--- a/style.css
+++ b/style.css
@@ -71,10 +71,21 @@ body {
 }
 
 .subplane{
+	background: #f0f0f0;
 	position: absolute;
 	width: 1200px;
 	height: 800px;
+	background-image:
+		linear-gradient(rgba(255, 255, 255, .2) 2px, transparent 2px),
+		linear-gradient(90deg, rgba(255, 255, 255, .2) 2px, transparent 2px);
+	background-size: 100px 100px;
+}
+
+.offwhite{
 	background: #c1c1c1;
+	position: absolute;
+	width: 1200px;
+	height: 800px;
 	background-image:
 		linear-gradient(rgba(255, 255, 255, .2) 2px, transparent 2px),
 		linear-gradient(90deg, rgba(255, 255, 255, .2) 2px, transparent 2px);
diff --git a/view/blocks.js b/view/blocks.js
index 0aa7339..16a0b67 100644
--- a/view/blocks.js
+++ b/view/blocks.js
@@ -108,6 +108,8 @@ let makeLink = (ldef, titleblock) => {
       // build the plane, carry it around.
       // make the new plane,
       context.plane = $('<div>').addClass('subplane').attr('id', `${ldef.name}_plane`).get(0)
+      // zerbras
+      if(!$(ldef.context.plane).is('.offwhite')) $(context.plane).addClass('offwhite')
       if (!context.size){
         context.size = { x: 900, y: 600 }
       }
-- 
GitLab