diff --git a/hunks/comm/websocketclient.js b/hunks/comm/websocketclient.js index 94b579777c46b4afa2b1732521bcd1af2aca1463..d94956c5c5d8429b33ac7a8e7cf22b44728c12bf 100644 --- a/hunks/comm/websocketclient.js +++ b/hunks/comm/websocketclient.js @@ -56,7 +56,7 @@ function WebSocketClient() { ws.binaryType = "arraybuffer" ws.onopen = (evt) => { this.log('ws opened') - statusMessage.set('opened') + statusMessage.set('open') } ws.onerror = (evt) => { this.log('ws error, will reset to check') diff --git a/hunks/hunks.js b/hunks/hunks.js index 322dde95701fc81008ea5dffa234b2a7fb0591ef..492dbbf675cd72193aed85ec6e402a56d455a5a9 100644 --- a/hunks/hunks.js +++ b/hunks/hunks.js @@ -284,6 +284,9 @@ function isOKType(type) { }) if(ind === -1){ return false + } else if (type === 'any') { + console.log('WARN!, type of "any" is a bit risky, and cannot traverse a link') + return true } else { return true } diff --git a/hunks/view.js b/hunks/view.js index 4e914efd1b60e43b4be7c1db289f7297ae85b72f..3ba9e1e3c5522ec2918e0d6fe064eb60f19f0fd7 100644 --- a/hunks/view.js +++ b/hunks/view.js @@ -143,6 +143,7 @@ function View() { this.refresh = () => { // wipe ya docs, and ask yonder manager for a complete description // everything is friggen jquery, so check it out + console.log("REFRESHING THE VIEW") $(this.plane).children('.def').remove() // also, defs.length = 0 @@ -887,9 +888,9 @@ function View() { $(this.dom).find('.contextmenu').remove() } else { if(verbose) console.log('replacing hunk at', spec.ind) - replaceDef(spec) + let nd = replaceDef(spec) msgbox.write(`replaced ${spec.name}_${spec.ind} with a new definition`) - patchset.onHunkLoaded() + patchset.onHunkLoaded(nd) } // hmmm ... // @@ -899,16 +900,11 @@ function View() { if (msgverbose) console.log('VIEW MSG is a state change') let stchHnkInd = MSGS.readFrom(msg, 1, 'uint16').item let stchStInd = MSGS.readFrom(msg, 4, 'uint8').item - let stDef - try { - stDef = defs[stchHnkInd].states[stchStInd] - let stValUpdate = MSGS.readFrom(msg, 6, stDef.type).item - stDef.set(stValUpdate) - patchset.onStateChanged(stDef) - msgbox.write(`changed state at ${stchHnkInd} ${stDef.name} to ${stValUpdate}`) - } catch (err) { - console.error('likely error from state change indexing', err) - } + let stDef = defs[stchHnkInd].states[stchStInd] + let stValUpdate = MSGS.readFrom(msg, 6, stDef.type).item + stDef.set(stValUpdate) + patchset.onStateChanged(stDef) + msgbox.write(`changed state at ${stchHnkInd} ${stDef.name} to ${stValUpdate}`) break case MK.HUNKREMOVED: if (msgverbose) console.log('VIEW MSG is a hunk to remove') diff --git a/programs/nautilus/ntThru.json b/programs/nautilus/ntThru.json new file mode 100644 index 0000000000000000000000000000000000000000..ba12aaf896ccbc4f04319c1ad73e5a419d1aac25 --- /dev/null +++ b/programs/nautilus/ntThru.json @@ -0,0 +1 @@ +{"interpreterName":"nautilus","interpreterVersion":"v0.1","hunks":[{"name":"manager","states":[]},{"name":"link","states":[{"ind":0,"type":"string","value":"mgrMsgs (byteArray), numtoview (number)"},{"ind":1,"type":"string","value":"mgrMsgs (byteArray), numfromview (number)"}]},{"name":"comm/websocketserver","states":[{"ind":0,"type":"string","value":"connected"},{"ind":1,"type":"number","value":2042}]},{"name":"comm/cobserial","states":[{"ind":0,"type":"string","value":"closed"},{"ind":1,"type":"string","value":"8022"},{"ind":2,"type":"boolean","value":false}]},{"name":"link","states":[{"ind":0,"type":"string","value":"mgrMsgs (byteArray), numthru (number)"},{"ind":1,"type":"string","value":"mgrMsgs (byteArray), numback (number)"}]}],"links":[{"outInd":0,"outputInd":0,"inInd":1,"inputInd":1},{"outInd":1,"outputInd":0,"inInd":2,"inputInd":0},{"outInd":1,"outputInd":1,"inInd":0,"inputInd":0},{"outInd":1,"outputInd":2,"inInd":4,"inputInd":2},{"outInd":2,"outputInd":0,"inInd":1,"inputInd":0},{"outInd":3,"outputInd":0,"inInd":4,"inputInd":0},{"outInd":4,"outputInd":0,"inInd":3,"inputInd":0},{"outInd":4,"outputInd":2,"inInd":1,"inputInd":2}]} \ No newline at end of file diff --git a/typeset.js b/typeset.js index 272295cd338934fe551b2d44075dda228da11444..f7ada08d0f7f2f5c50435f613979ba7f4d8bcfc3 100644 --- a/typeset.js +++ b/typeset.js @@ -281,7 +281,7 @@ const writeLenBytes = (len) => { } if (i > 2) throw new Error('suspiciously long len cast', bts) } - console.log(`for len ${len}, wrote bytes`, bts) + //console.log(`for len ${len}, wrote bytes`, bts) return bts } diff --git a/view/vptch.js b/view/vptch.js index e0b51af5678e9de62fddfddcf61037e7bc5be7ce..894d4b321068e6494e0d8e7fd83c72bfc5116116 100644 --- a/view/vptch.js +++ b/view/vptch.js @@ -38,6 +38,7 @@ function PatchSet(View, MsgBox) { } let patchStep = 0 + let linkLoadingStarted = false let unloadedHunks = [] let awaitStates = [] let unloadedLinks = [] @@ -59,7 +60,11 @@ function PatchSet(View, MsgBox) { view.requestStateChange(view.defs[patchStep].states[st], unloadedHunks[0].states[st].value) // we have to track this ... msgbox.briefState.stateIsHappening() - awaitState.push(view.defs[patchStep].states[st].name) + awaitStates.push({ + defname: view.defs[patchStep].name, + defind: view.defs[patchStep].ind, + statename: view.defs[patchStep].states[st].name + }) } } } @@ -80,11 +85,14 @@ function PatchSet(View, MsgBox) { this.onStateChanged = (stateDef) => { if(awaitStates.length < 1) return true - let indOf = awaitStates.indexOf(stateDef.name) + let indOf = awaitStates.findIndex((cand) => { + return (cand.statename === stateDef.name) + }) if(indOf === -1){ console.error(`misplaced state: ${stateDef.name}`) } else { awaitStates.splice(indOf, 1) + console.log('splicing state item', stateDef) if(awaitStates.length < 0){ msgbox.briefState.stateIsNotHappening() unloadedHunks.shift() @@ -94,9 +102,16 @@ function PatchSet(View, MsgBox) { } // callbacks, + // this happens *also* when we update some link state, yikes, this.onHunkLoaded = (def) => { // not interested, if (unloadedHunks.length < 1) return true + // ok, is it something we were asking for a state change on ? + // we *also* receive a state update message, which is nice, + let iopossible = awaitStates.findIndex((cand) => { + return (cand.defname === def.name && cand.defind === def.ind) + }) + if(iopossible !== -1) return true // ur loaded, patchStep++ // ok ... @@ -116,6 +131,7 @@ function PatchSet(View, MsgBox) { if (unloadedHunks.length < 1) { msgbox.write(`patchset loaded all hunks`) reqNextLink() + linkLoadingStarted = true } else { msgbox.write(`patchset placed ${def.name}_${def.ind}, ${unloadedHunks.length} hunks remaining`) reqNextHunk() @@ -133,6 +149,7 @@ function PatchSet(View, MsgBox) { this.onLinkLoaded = (addOutInd, addOutputInd, addInInd, addInputInd) => { // not interested in this + if (!linkLoadingStarted) return true if (unloadedLinks.length < 1) return true // find in list, rm, let lnk = unloadedLinks[0] @@ -143,6 +160,7 @@ function PatchSet(View, MsgBox) { unloadedLinks.shift() if (unloadedLinks.length < 1) { msgbox.write(`patchset loaded all links, FIN DU LOAD`) + linkLoadingStarted = false } else { msgbox.write(`patchset placed a link, ${unloadedLinks.length} links remaining`) reqNextLink()