diff --git a/README.md b/README.md
index acfc87c414615305c9d60187dc3183a6f006cb15..defb17fedccfdfcb05d2bc52a5e43393dc521c2a 100644
--- a/README.md
+++ b/README.md
@@ -14,17 +14,17 @@ Native Cuttlefish 'Hunks' are given access to a DOM/div element, making them nic
# Scratch
-At the moment, working on serialization, and a reduction of the manager's role. This probably means migrating much messiness to view.js and making manager.js straightforward, to the point where we can expect to write manager.cpp w/o great pain, strife.
+I'm very close, though, and want to focus. I should be talking to a nautilus manager tonight and prototyping how I want remote resources to open up from cuttlefish.
-OK, I'm closing in on the serialization struggle. I want to finally write down the list of messages that I'd like to assemble from, write those out, and then just go through assembling shit in the dom. I'll break things and fix them as I do.
+The next meaningful work on ponyo happens when I can:
+ - easily load the messy program-via-links that is cuttlefish -> nautilus with-a-link, from cuttlefish, with minimal clicks (assuming a running nautilus scratch)
-I'm very close, though, and want to focus. I should be talking to a nautilus manager tonight and prototyping how I want remote resources to open up from cuttlefish.
-> manager cleanup, ref to old code ...
- - refresh button in th view,
- refresh wipes and then asks for currently-running program,
- - manager responds with 'describe self' containing a top level descr, numhunks, numlinks ... view with some state about that ...
+ - separating link and hunk managements in the manager ...
+ - a big re-write !
Here's my list of things I think I will need ...
diff --git a/hunks/hunks.js b/hunks/hunks.js
index 14ccdc9ecabd0084bbb1d915d81fea851d5bf481..0c2c807a9249465676f4c49d7fcb2b03feba3406 100644
--- a/hunks/hunks.js
+++ b/hunks/hunks.js
@@ -154,7 +154,7 @@ function Output(type, name, linktype) {
if (this.type === input.type || input.type === 'Any' || true ) {
this.connections.push({
input: input,
- parentid: pid
+ parentId: pid
})
} else {
throw new Error('attempt to attach mismatched types')
@@ -165,12 +165,12 @@ function Output(type, name, linktype) {
// find by names pls
let recip = {
input: input,
- parentid: pid
+ parentId: pid
}
let pos = -1
let conn = this.connections.find((cn, i) => {
pos = i
- return ((cn.parentid === recip.parentid) && (cn.input.name === recip.input.name))
+ return ((cn.parentId === recip.parentId) && (cn.input.name === recip.input.name))
})
if (conn !== undefined | conn !== null) {
this.connections.splice(pos, 1)
@@ -183,7 +183,7 @@ function Output(type, name, linktype) {
this.unhook = (pid) => {
for (let conn of this.connections) {
- if (conn.parentid === pid) {
+ if (conn.parentId === pid) {
this.remove(conn)
}
}
diff --git a/hunks/manager.js b/hunks/manager.js
index cd9d1bc6f763656fe452c1f51a4cb9197617673f..144ba263c3e9beded8c5448e58af548b134e0628 100644
--- a/hunks/manager.js
+++ b/hunks/manager.js
@@ -25,7 +25,7 @@ function Manager() {
this.inputs.push(msgsin)
this.outputs.push(msgsout)
- let hunkCount = 0
+ // we have hunks,
let hunks = new Array()
this.hunks = hunks
@@ -63,21 +63,9 @@ function Manager() {
}
/* --------------------------- ---------------------------- */
- /* ----------------- REPLY WITH DESCRIPTIONS ----------------- */
+ /* ------------------------ SERIALIZE ------------------------ */
/* --------------------------- ---------------------------- */
- this.describeRunningProgram = () => {
- for (let hnk in hunks) {
- this.sendHunkAsDef(hunks[hnk])
- } // and also links,
- }
-
- this.sendHunkAsDef = (hunk) => {
- let def = writeDefinition(hunk)
- if (msgverbose) this.log('msg: putdef', def)
- writeMessage('putdef', def)
- }
-
let serializeHunk = (hunk, bytes) => {
// write the hunk into this array
bytes.push(HK.ID)
@@ -110,79 +98,6 @@ function Manager() {
MSGS.writeTo(bytes, st.value, st.type, true)
}
}
- // HERE you r at this ... name / id / inputs / outputs / state
- }
-
- // bit confusing this / but is functional code
- let writeDefinition = (hunk) => {
- if (hunk.id === null) {
- throw new Error('hunk with no id in writeHunkDefinition')
- }
- // ok
- // write tree
- let def = {
- name: hunk.name,
- id: hunk.id,
- inputs: new Array(),
- outputs: new Array(),
- state: new Array()
- }
-
- // add inputs
- if (hunk.inputs.length > 0) {
- for (let ip of hunk.inputs) {
- // just the string identifiers, yarrr
- def.inputs.push({
- name: ip.name,
- type: ip.type
- })
- }
- }
-
- if (hunk.outputs.length > 0) {
- for (let op of hunk.outputs) {
- // connections like,
- let cn = new Array()
- if (op.connections.length > 0) {
- for (let conn of op.connections) {
- cn.push({
- input: conn.input.name,
- parentId: conn.parentid
- })
- }
- }
- // and rep like,
- def.outputs.push({
- name: op.name,
- type: op.type,
- connections: cn
- })
- }
- }
-
- // add outputs
- if (hunk.state.length > 0) {
- for (let st of hunk.state) {
- def.state.push({
- name: st.name,
- type: st.type,
- value: st.value
- })
- }
- }
-
- return def
- }
-
- this.findHunkById = (id) => {
- let theHunk = hunks.find((hunk) => {
- return hunk.id === id
- })
- if (theHunk !== undefined) {
- return theHunk
- } else {
- return undefined
- }
}
/* --------------------------- ---------------------------- */
@@ -234,9 +149,8 @@ function Manager() {
hunk.id = id
} else {
// TODO: probably there is a better id, and what of program loads?
- hunk.id = 'hnk_' + hunkCount
+ hunk.id = 'hnk_' + hunks.length
}
- hunkCount++
// a backdoor, a greeting, an ouroboros
hunk.mgr = this
@@ -357,12 +271,6 @@ function Manager() {
}
}
- this.addLinkByObject = (fromHunk, outputName, toHunk, inputName) => {
- // TODO: not throwing errors when outputname does not exist
- // I.E. addLink doesn't actually use 'name' property, it uses [key]
- return this.addLink(fromHunk.id, outputName, toHunk.id, inputName)
- }
-
this.removeLink = (outHunkId, outputName, inHunkId, inputName) => {
// console.log('REMOVELINK looking for hunk, with name, and in, with name', outHunkId, outputName, inHunkId, inputName)
let outHunk = hunks.find((hunk) => {
@@ -397,6 +305,31 @@ function Manager() {
}
}
+ // programmatically, and as makes sense in memory, link connections are lists that are stored
+ // at the output, but we serialize and communicate links, and hunks, separately.
+ // ... while we have a lit of hunks to easily rip through while serializing that,
+ // we don't have one for links, so this exists
+
+ let writeLinkList = () => {
+ let links = new Array ()
+ // for hunks,
+ for(let hnk of hunks){
+ // have outputs,
+ for(let otp of hnk.outputs){
+ for(let cn of otp.connections){
+ links.push({
+ outHunkId: hnk.id,
+ outputName: otp.name,
+ inHunkId: cn.parentId,
+ inputName: cn.input.name
+ })
+ }
+ }
+ }
+ // ok,
+ return links
+ }
+
/* --------------------------- ---------------------------- */
/* ---------------------- STATE CHANGES ---------------------- */
/* --------------------------- ---------------------------- */
@@ -419,74 +352,6 @@ function Manager() {
})
}
- /* --------------------------- ---------------------------- */
- /* --------------------- PROGRAM LOADING --------------------- */
- /* --------------------------- ---------------------------- */
-
- this.addProgram = (prgname) => {
- console.log('opening program', prgname)
- return new Promise((resolve, reject) => {
- let unloaded = new Array()
- let loaded = new Array()
- // first, we should get the program
- // HERE consider this,
- // probably re-write addlink to auto-complete as well
- // and then: the view init ... the stuffy message buffer ... the flush ?
- GG.getJson('programs/' + prgname + '.json').then((obj) => {
- if (obj.programname !== null && obj.programname !== undefined) {
- errmsg(`opening program with name: ${obj.programname}`)
- addHunkList(obj.hunks).then((newHunks) => {
- if (verbose) this.log(`finished adding hunks from: ${obj.programname}, now links`)
- for (let lnk of obj.links) {
- if (this.addLink(lnk.outhunk, lnk.outname, lnk.inhunk, lnk.inname)) {
- // success! continue
- } else {
- reject('watch err in program load, at links', lnk)
- }
- }
- resolve(newHunks)
- }).catch((err) => {
- reject(err)
- })
- } else {
- reject(new Error('program loads, not named'))
- }
- }).catch((err) => {
- reject(err)
- })
- })
- }
-
- let addHunkList = (list) => {
- // list is str8 json 'hunks' list
- // objects always have "name" and "id" properties,
- // sometimes have "state" properties
- return new Promise((resolve, reject) => {
- let unloaded = new Array()
- let loaded = new Array()
- // first, we should get the program
- for (let hnk in list) {
- let name = list[hnk].name
- let id = list[hnk].id
- let state = list[hnk].state
- unloaded.push(id)
- this.addHunk(name, id, state).then((hunk) => {
- if (unloaded.includes(hunk.id)) {
- unloaded.splice(unloaded.indexOf(hunk.id), 1)
- loaded.push(hunk)
- if (unloaded.length < 1) {
- resolve(loaded)
- }
- } else {
- reject(new Error('strange catch when adding a list of hunks'))
- }
- }).catch((err) => {
- reject(err)
- })
- }
- })
- }
-
/* --------------------------- ---------------------------- */
/* ---------------------- STARTUP, LOOP ---------------------- */
/* --------------------------- ---------------------------- */
@@ -495,6 +360,7 @@ function Manager() {
// startup by giving ourselves an ID if we haven't been assigned one?
// and then adding ourselves to ourselves ?
if (this.id === null || this.id === undefined) throw new Error('managers with no IDs are no good 4 u')
+ // nest in self,
hunks.push(this)
this.log(`manager hello, id is ${this.id}`)
}
@@ -512,11 +378,29 @@ function Manager() {
case MK.HELLO:
writeMessage([MK.HELLO])
break
- case MK.DESCRIBESELF:
+ case MK.REQDESCRIBESELF:
resp.push(MK.BRIEF)
MSGS.writeTo(resp, this.id, 'string')
MSGS.writeTo(resp, GG.interpretername, 'string')
+ MSGS.writeTo(resp, hunks.length, 'uint32')
+ MSGS.writeTo(resp, writeLinkList().length, 'uint32')
writeMessage(resp)
+ // now start sending hunks,
+ for(let hnk of hunks){
+ let serhunk = [MK.HUNKALIVE]
+ serializeHunk(hnk, serhunk)
+ writeMessage(serhunk)
+ }
+ // and links,
+ let links = writeLinkList()
+ for(let lnk of links){
+ let serlink = [MK.LINKALIVE]
+ MSGS.writeTo(serlink, lnk.outHunkId, 'string')
+ MSGS.writeTo(serlink, lnk.outputName, 'string')
+ MSGS.writeTo(serlink, lnk.inHunkId, 'string')
+ MSGS.writeTo(serlink, lnk.inputName, 'string')
+ writeMessage(serlink)
+ }
break
case MK.REQLISTAVAIL:
// allow for error path,
@@ -556,93 +440,25 @@ function Manager() {
console.log('addhunk err', err)
})
break
- default:
- throw new Error(`manager receives message with no switch; ${msg}`)
- break
- }
-
- /*
- switch (false) {
- case 'hello':
- let options = this.getHelloResponses()
- writeMessage('putcontextoptions', options)
- break
- case 'listhunks':
- getListOfAvailableComponents().then((list) => {
- let options = new Array()
- // this *probably* needs work
- for (let item of list) {
- let option = {
- text: item,
- header: 'addhunk',
- content: item
- }
- options.push(option)
- }
- writeMessage('putcontextoptions', options)
- }).catch((err) => {
- writeMessage('error', 'ERR while getting list of available' + err)
- })
- break
- case 'addprogram':
- // TODO: try muxed up JSON, returns unhandled promise rejection
- // in node?
- this.addProgram(content).then((newHunks) => {
- // newhunks are automatically reported on msgs, and so are new links
- // so we just want a catch block here
- }).catch((err) => {
- writeMessage('error', 'ERR while adding program: ' + err)
- })
+ case MK.REQSTATECHANGE:
+ console.error('manager state changes not written')
break
- case 'addhunk':
- // TODO same here, addhunk should return automatically
- this.log('adding this hunk', content)
- this.addHunk(content).then((hunk) => {
- this.log('added hunk with id', hunk.id)
- }).catch((err) => {
- this.log('ERR while adding hunk', err)
- writeMessage('error', 'ERR on adding hunk: ' + err)
- })
+ case MK.REQRMHUNK:
+ console.error('manager reqrmhunk not written')
break
- case 'removehunk':
- if (this.removeHunk(content)) {
- writeMessage('removedef', content.id)
- } else {
- writeMessage('error', 'could not remove hunk as requested')
- }
- break
- case 'addlink':
- if (this.addLink(content.outId, content.outName, content.inId, content.inName)) {
- // gr8 success, and addlink automatically updates with a message to the view
- } else {
- writeMessage('error', 'could not add link as requested')
- }
+ case MK.REQADDLINK:
+ console.error('manager req to add link not written')
break
- case 'removelink':
- if (this.removeLink(content.outId, content.outName, content.inId, content.inName)) {
- // gr8 success, continue
- } else {
- writeMessage('error', 'cannot remove link as requested')
- }
+ case MK.REQRMLINK:
+ console.error('manager removelink not written')
break
- case 'statechange':
- this.stateChange(content.id, content.name, content.value).then(() => {
- // no response for this, message should pass from hunk
- }).catch((err) => {
- this.log('ERR at statechange', err)
- writeMessage('error', 'could not change state as requested')
- })
- break
-
default:
- writeMessage('error', 'manager receives message with no switch!')
- this.log('MGR: msg with no switch')
+ throw new Error(`manager receives message with no switch; ${msg}`)
break
}
- */
-
} // end msgs input
+ // MSGS output check,
if (outmsgbuffer.length > 0) {
let debug = true
if (!msgsout.io) {
@@ -710,12 +526,6 @@ function Manager() {
} // end loop
- /* --------------------------- ---------------------------- */
- /* --------------------- MESSAGES OUTPUT --------------------- */
- /* --------------------------- ---------------------------- */
-
-
-
/* --------------------------- ---------------------------- */
/* --------------------- MESSAGES OUTPUT --------------------- */
/* --------------------------- ---------------------------- */
diff --git a/hunks/view.js b/hunks/view.js
index f7b057cd641865f2215962664dbe6c6496fd06c7..c4ba7dd6e53332963d96d7cde8ad785c83116cf8 100644
--- a/hunks/view.js
+++ b/hunks/view.js
@@ -20,10 +20,10 @@ import {
} from './hunks.js'
import {
- TSET, // typset
- MK, // manager keys,
- HK, // hunk keys,
- MSGS // messaging
+ TSET, // typset
+ MK, // manager keys,
+ HK, // hunk keys,
+ MSGS // messaging
} from '../typeset.js'
import * as BZ from '../bztools.js'
@@ -34,8 +34,6 @@ function View() {
let verbose = true
let msgverbose = true
- // view of a manager, has route to that manager (via a link?)
-
let msgsin = new Input('byteArray', 'msgs')
let msgsout = new Output('byteArray', 'msgs')
@@ -52,7 +50,53 @@ function View() {
// and things inside of it,
let zoomExtentsCheckbox = {}
let refreshButton = {}
- // also some verifiable state
+ let stateBlock = {}
+ // also some verifiable state: lord help us all
+ let viewState = "just loaded, unknown contents at link"
+ let setViewStateString = (string) => {
+ viewState = string
+ $(this.msgbox).find('#stateBox').text(viewState)
+ }
+ // tracking a load,
+ let briefState = {
+ recipId: '',
+ recipName: '',
+ numHunksLeft: 0,
+ numLinksLeft: 0,
+ setFromBrief: function(brief) {
+ this.recipId = brief.interpreterId
+ this.recipName = brief.interpreterName
+ this.numHunksLeft = brief.numHunks
+ this.numLinksLeft = brief.numLinks
+ this.postToDom()
+ },
+ decrementHunks: function() {
+ this.numHunksLeft--
+ this.postToDom()
+ },
+ incrementHunks: function() {
+ this.numHunksLeft ++
+ this.postToDom()
+ },
+ decrementLinks: function() {
+ this.numLinksLeft--
+ this.postToDom()
+ },
+ incrementHunks: function() {
+ this.numLinksLeft ++
+ this.postToDom()
+ },
+ postToDom: function() {
+ let str
+ if(this.numHunksLeft > 0 || this.numLinksLeft > 0){
+ str = `id: ${this.recipId}, name: ${this.recipName} <br> awaiting ${this.numHunksLeft} hunks and ${this.numLinksLeft} links`
+ } else {
+ str = `id: ${this.recipId}, name: ${this.recipName} <br> all loaded OK`
+ }
+ $($.find('#titleBox')).html(str)
+ }
+ }
+
/* --------------------------- ---------------------------- */
/* -------------------- INIT, LISTENERS ---------------------- */
/* --------------------------- ---------------------------- */
@@ -66,20 +110,26 @@ function View() {
this.plane = $('<div>').addClass('plane').get(0)
// to log, type, etc
this.msgbox = $('<div>').addClass('msgbox').get(0)
- // a refresh plane
+ // the title, and id of your manager
+ this.msgbox.append($('<div>').attr('id', 'titleBox').addClass('msgboxmsg').append('name and interpreter unknown').get(0))
+ // say hello to your manager,
+ this.msgbox.append($('<div>').addClass('msgboxbutton').addClass('msgboxmsg').append('~ say hello ~').click((evt) => {
+ writeMessage([MK.HELLO])
+ }).get(0))
+ // a refresh button
refreshButton = $('<div>').addClass('msgboxbutton').addClass('msgboxmsg').append('~ refresh view ~').get(0)
$(refreshButton).click((evt) => {
this.refresh()
})
this.msgbox.append(refreshButton)
- // HERE ... uuuh ... messages .. annealing ... refresh routine ... manager sending lists ... sending links ...
- // delete a bunch of shiiiit ... also in the manager
- // maybe start the cleanup by writing in dummy switch statements, then fleshing those out one by one
-
+ // state,
+ stateBlock = $('<div>').attr('id', 'stateBox').addClass('msgboxmsg').append(viewState).get(0)
+ this.msgbox.append(stateBlock)
// zoom extents object,
zoomExtentsCheckbox = $('<input/>').attr({
- type: 'checkbox'
- }).prop('checked', true).get(0)
+ type: 'checkbox',
+ checked: true
+ }).get(0)
$(zoomExtentsCheckbox).change(() => {
if ($(zoomExtentsCheckbox).prop('checked')) {
zoomExtents()
@@ -147,9 +197,11 @@ function View() {
this.refresh = () => {
// wipe ya docs, and ask yonder manager for a complete description
- console.log("WRITE THIS: refresh should wipe current screen first!")
- let msg = [MK.HELLO]
- writeMessage(msg)
+ // everything is friggen jquery, so check it out
+ $(this.plane).children('.block').remove()
+ // and then say hello,
+ writeMessage([MK.REQDESCRIBESELF])
+ setViewStateString("waiting for current program ... ")
// that's fine, we can wait for a response, but we have to track and setup the next move
}
@@ -169,11 +221,11 @@ function View() {
let ch = this.msgbox.clientHeight
if (heightcheck() > ch) {
console.log('rm 1', heightcheck(), ch)
- $(this.msgbox).children().get(1).remove()
+ $(this.msgbox).children().get(5).remove()
// two at most, sloppy but fast
if (heightcheck() > ch) {
console.log('rm 2', heightcheck(), ch)
- $(this.msgbox).children().get(1).remove()
+ $(this.msgbox).children().get(5).remove()
}
}
}
@@ -617,8 +669,8 @@ function View() {
// starting at 2, msgs[0] is 'hnkalive'
let i = start
// ripperoni,
- outer: while(i < bytes.length){
- switch (bytes[i]){
+ outer: while (i < bytes.length) {
+ switch (bytes[i]) {
case HK.ID:
i += 1
temp = MSGS.readFrom(bytes, i, 'string')
@@ -915,7 +967,7 @@ function View() {
let cn = port.connections[conn]
// HERE is the missing link (haha) ... defid , what is
// has undefined in title ...
- dom.connectedTo.push('#' + cn.parentid + '_input_' + cn.input)
+ dom.connectedTo.push('#' + cn.parentId + '_input_' + cn.input)
}
// messy global for the potential floater
let floater = {}
@@ -1039,9 +1091,9 @@ function View() {
return dom
}
- let requestStateChange = (parentid, state, value) => {
+ let requestStateChange = (parentId, state, value) => {
writeMessage('statechange', {
- id: parentid,
+ id: parentId,
name: state.name,
value: value
})
@@ -1049,8 +1101,8 @@ function View() {
// responses (change state / add link)
- let receiveStateChange = (parentid, name, value) => {
- let blkstate = $(this.plane).find('#' + parentid + '_state_' + name)
+ let receiveStateChange = (parentId, name, value) => {
+ let blkstate = $(this.plane).find('#' + parentId + '_state_' + name)
if (blkstate !== null && blkstate !== undefined) {
// find value / etc
let inp = $(blkstate).children('input').get(0)
@@ -1059,7 +1111,7 @@ function View() {
inp.value = value
} else {
if (typeof value !== 'boolean') {
- writeToMessageBox('View ERR: State Change for non Boolean on Boolean Type: ' + parentid + ", state: " + name + ", value: " + value)
+ writeToMessageBox('View ERR: State Change for non Boolean on Boolean Type: ' + parentId + ", state: " + name + ", value: " + value)
} else {
$(blkstate).children('span').text(value)
}
@@ -1096,16 +1148,34 @@ function View() {
if (msgsin.io) {
let msg = msgsin.get()
// at view, read in and deserialize list
- if(msgverbose) console.log('VIEW MSG:', msg)
- if(!Array.isArray(msg)) throw new Error(`view throwing object message, having header ${msg.header}`)
+ if (msgverbose) console.log('VIEW MSG:', msg)
+ if (!Array.isArray(msg)) throw new Error(`view throwing object message, having header ${msg.header}`)
// ok,
- switch(msg[0]) {
+ switch (msg[0]) {
case MK.ERR:
writeToMessageBox(MSGS.readFrom(msg, 1, 'string').item)
break
- case MK.HELLORESPONSE:
- writeToMessageBox('manager responds OK')
+ case MK.HELLO:
+ // todo: track and heartbeat,
+ writeToMessageBox('manager says hello...')
+ break
+ case MK.BRIEF:
+ // title, name of manager, lsit of unloaded hunks ?
+ writeToMessageBox('manger sends program brief, will begin loading...')
+ // serial -> js, by procedure du jakhey
+ let brief = {}
+ let bi = 1
+ // reading strings returns item, increment
+ let id = MSGS.readFrom(msg, bi, 'string')
+ bi += id.increment
+ brief.interpreterId = id.item
+ let intrprtrnm = MSGS.readFrom(msg, bi, 'string')
+ bi += intrprtrnm.increment
+ brief.interpreterName = intrprtrnm.item
+ brief.numHunks = MSGS.readFrom(msg, bi, 'uint32')
+ brief.numLinks = MSGS.readFrom(msg, bi + 5, 'uint32')
+ briefState.setFromBrief(brief)
break
case MK.LISTOFAVAIL:
// HERE: readListFrom is untested
@@ -1120,40 +1190,37 @@ function View() {
case MK.HUNKSTATECHANGE:
console.error('hunkstatechange serialized doth not written')
break
- default:
- throw new Error(`view receives message with no switch: ${msg[0]}`)
- }
-
-
- /*
- let header = ref.header
- let content = ref.content
- if (msgverbose) this.log(`gets msg ${header}`)
- switch (header) {
- case 'putdef':
- putDef(content)
- break
- case 'removedef':
- removeDef(content)
- break
- case 'putlink':
- putLink(content.outId, content.outName, content.inId, content.inName)
+ case MK.HUNKREMOVED:
+ console.error('hunkremoved serialized doth not written')
break
- case 'removelink':
- removeLink(content.outId, content.outName, content.inId, content.inName)
+ case MK.LINKALIVE:
+ let al = MSGS.readListFrom(msg, 1, 'string')
+ putLink(al[0], al[1], al[2], al[3])
break
- case 'putstate':
- receiveStateChange(content.id, content.name, content.value)
- break
- case 'error':
- writeToMessageBox(content)
+ case MK.LINKREMOVED:
+ console.error('view linkremoved not written')
break
default:
- console.log('VIEW: msg with no switch')
- break
- } */
- }
- }
+ throw new Error(`view receives message with no switch: ${msg[0]}`)
+ } // end msgs switch
+ } // end if-have-message
+
+ // MSGS output check,
+ if (outmsgbuffer.length > 0) {
+ let debug = true
+ if (!msgsout.io) {
+ if (debug) {
+ let msg = outmsgbuffer.shift()
+ if (msgverbose) this.log(`buffer release msg type: ${msg.header}`)
+ //console.log(msg.content)
+ msgsout.put(msg)
+ } else {
+ msgsout.put(outmsgbuffer.shift())
+ }
+ }
+ } // end msgs output check
+
+ } // end loop
}
export default View
diff --git a/style.css b/style.css
index e247d4ac0ca02e058e4266a738a6f16368b0f3d8..e8991ba86d32687e915774d7b192f238deee558e 100644
--- a/style.css
+++ b/style.css
@@ -69,10 +69,12 @@ body {
background-color: white;
font-family: Courier;
font-size: 11px;
+ line-height: 15px;
}
.msgboxbutton:hover{
- background-color: blue;
+ background-color: rgb(255, 209, 237);
+ cursor: pointer;
}
.plane {
@@ -92,6 +94,7 @@ body {
width: 100px;
height: 100px;
background: #000;
+ cursor: se-resize;
}
.contextmenu {
@@ -159,6 +162,7 @@ body {
.blockid:hover{
background-color: #969696;
+ cursor: grab;
}
.inputs {
diff --git a/typeset.js b/typeset.js
index 49c398136f50d5d87d565632e72d54673655411e..9cd009cd2e8e87ad63aea97ad762173a8ae98321 100644
--- a/typeset.js
+++ b/typeset.js
@@ -62,6 +62,9 @@ const TSET = [{
for(let i = 0; i < lb.len; i ++){
str += String.fromCharCode(arr[start + 1 + lb.numBytes + i])
}
+ // TODO: it would be *super tite* if I could pass in an i to increment ... maybe I pass in an object,
+ // containing that incrementer ?
+ // this could be optional for all?
// more complex types, we need to know upstream how far to increment counter as well,
// the +1 here is assuming incrementing over the leading key as well, so that at arr[start + increment] we find a next key,
return {
@@ -183,7 +186,6 @@ const MSGS = {
}
}
-
// typically: call, response expected
// manager keys
const MK = {
@@ -192,8 +194,8 @@ const MK = {
// heartbeats, wakeup
HELLO: 253, // (eom)
// request a top-level description
- //DESCRIBESELF: 251, // (eom)
- //BRIEF: 250, // (str) name of interpreter, # hunks, # links (and then begin firing list back)
+ REQDESCRIBESELF: 251, // (eom)
+ BRIEF: 250, // (str) name of interpreter, # hunks, # links (and then begin firing list back)
// please show what is available
REQLISTAVAIL: 249, // (eom)
LISTOFAVAIL: 248, // (list)(str) names 'dirs/like/this' (includes programs ?) (this might be multiple packets?)
@@ -202,12 +204,12 @@ const MK = {
HUNKALIVE: 246, // (hunkdescription): name, id, inputlist, outputlist, statelist
REQSTATECHANGE: 245,
HUNKSTATECHANGE: 244,
- //REQRMHUNK: 243, // (str) id
- //HUNKREMOVED: 242, // (str) id
- //REQADDLINK: 241, // (str) id, (str) outname, (str) id, (str) inname
- //LINKALIVE: 240, // (str) id, (str) outname, (str) id, (str) inname
- //REQRMLINK: 239, // (str) id, (str) outname, (str) id, (str) inname
- //LINKREMOVED: 238, // (str) id, (str) outname, (str) id, (str) inname
+ REQRMHUNK: 243, // (str) id
+ HUNKREMOVED: 242, // (str) id
+ REQADDLINK: 241, // (str) id, (str) outname, (str) id, (str) inname
+ LINKALIVE: 240, // (str) id, (str) outname, (str) id, (str) inname
+ REQRMLINK: 239, // (str) id, (str) outname, (str) id, (str) inname
+ LINKREMOVED: 238, // (str) id, (str) outname, (str) id, (str) inname
}
// hunk description keys,