Compare commits

..

No commits in common. "7e4bd2b49212262db5eb6e4f9a260ddbf28dca01" and "8b58f65c84cc404b1310f05ab764ab6d2803e676" have entirely different histories.

6 changed files with 414 additions and 448 deletions

View file

@ -243,7 +243,7 @@ if( typeof AFRAME != 'undefined '){
this.term.emit('term_init', {instance, aEntity:this}) this.term.emit('term_init', {instance, aEntity:this})
//instance.winbox.resize(720,380) //instance.winbox.resize(720,380)
let size = `width: ${this.data.width}; height: ${this.data.height}` let size = `width: ${this.data.width}; height: ${this.data.height}`
instance.setAttribute("window", `title: xrsh.iso; uid: ${instance.uid}; attach: #overlay; dom: #${instance.dom.id}; ${size}; min: ${this.data.minimized}; max: ${this.data.maximized}; class: no-full, no-max, no-resize`) instance.setAttribute("window", `title: xrsh.iso; uid: ${instance.uid}; attach: #overlay; dom: #${instance.dom.id}; ${size}; min: ${this.data.minimized}; max: ${this.data.maximized}; class: no-full, no-resize`)
}) })
instance.addEventListener('window.oncreate', (e) => { instance.addEventListener('window.oncreate', (e) => {

View file

@ -290,27 +290,6 @@ ISOTerminal.prototype.bufferOutput = function(byte,cb,latency){
} }
} }
//ISOTerminal.prototype.bufferOutput = function(byte, cb, latency, buffer) {
// const str = String.fromCharCode(byte);
// //if (str === '\r' || str === '\n' || str.charCodeAt(0) < 32 || str.charCodeAt(0) === 127) {
// // cb(str);
// //} else if (str === '\x1b') { // ESC
// // buffer.esc = true;
// //} else if (buffer.esc) {
// // cb('\x1b' + str);
// // buffer.esc = false;
// //} else {
// buffer.str = (buffer.str || '') + str;
// if (Date.now() - (buffer.timestamp || 0) >= latency) {
// console.log(buffer.str)
// cb(buffer.str);
// buffer.str = '';
// buffer.timestamp = Date.now();
// }
// //}
//}
ISOTerminal.prototype.preventFrameDrop = function(cb){ ISOTerminal.prototype.preventFrameDrop = function(cb){
// don't let workers cause framerate dropping // don't let workers cause framerate dropping
const xr = this.instance.sceneEl.renderer.xr const xr = this.instance.sceneEl.renderer.xr

View file

@ -22,25 +22,17 @@ if( typeof emulator != 'undefined' ){
ISOTerminal.addEventListener('javascript-eval', async function(e){ ISOTerminal.addEventListener('javascript-eval', async function(e){
const {script,PID} = e.detail const {script,PID} = e.detail
let res; let res
try{ try{
let f = new Function(`${script}`); res = (new Function(`${script}`))()
res = f();
if( res && typeof res != 'string' ) res = JSON.stringify(res,null,2) if( res && typeof res != 'string' ) res = JSON.stringify(res,null,2)
}catch(err){ }catch(e){
console.error(err) console.error(e)
console.dir(err) console.info(script)
res = "error: "+err.toString() res = "error: "+e.toString()
if( e.filename ){
// try to figure out line *FIXME* res += "\n"+e.filename+":"+e.lineno+":"+e.colno
let line = err.stack.split("\n").find(e => e.includes("<anonymous>:") || e.includes("Function:")); }
if( line ){
let lineIndex = (line.includes("<anonymous>:") && line.indexOf("<anonymous>:") + "<anonymous>:".length) || (line.includes("Function:") && line.indexOf("Function:") + "Function:".length);
let lnr = +line.substring(lineIndex, lineIndex + 1) - 2
res += script.split("\n")[lnr-1]
}else console.dir(script)
console.error(res)
} }
// update output to 9p with PID as filename (in /mnt/run) // update output to 9p with PID as filename (in /mnt/run)
if( PID ){ if( PID ){

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -12,29 +12,26 @@ this.runISO = function(opts){
console.log("[worker.js] started emulator") console.log("[worker.js] started emulator")
// event forwarding // event forwarding
emulator.buf0 = {}
emulator.buf1 = {}
emulator.buf2 = {}
emulator.add_listener("serial0-output-byte", function(byte){ emulator.add_listener("serial0-output-byte", function(byte){
ISOTerminal.prototype.bufferOutput(byte, (str) => { // we buffer to prevent framerate dropping ISOTerminal.prototype.bufferOutput(byte, (str) => { // we buffer to prevent framerate dropping
if( !str ) return if( !str ) return
this.postMessage({event:"serial0-output-string",data:str}); this.postMessage({event:"serial0-output-string",data:str});
}, opts.bufferLatency, emulator.buf0 ) }, opts.bufferLatency )
}.bind(this)); }.bind(this));
emulator.add_listener("serial1-output-byte", function(byte){ emulator.add_listener("serial1-output-byte", function(byte){
ISOTerminal.prototype.bufferOutput(byte, (str) => { // we buffer to prevent framerate dropping ISOTerminal.prototype.bufferOutput(byte, (str) => { // we buffer to prevent framerate dropping
if( !str ) return if( !str ) return
this.postMessage({event:"serial1-output-string",data:str}); this.postMessage({event:"serial1-output-string",data:str});
}, opts.bufferLatency, emulator.buf1 ) }, opts.bufferLatency )
}.bind(this)); }.bind(this));
emulator.add_listener("serial2-output-byte", function(byte){ emulator.add_listener("serial2-output-byte", function(byte){
ISOTerminal.prototype.bufferOutput(byte, (str) => { // we buffer to prevent framerate dropping ISOTerminal.prototype.bufferOutput(byte, (str) => { // we buffer to prevent framerate dropping
if( !str ) return if( !str ) return
this.postMessage({event:"serial2-output-string",data:str}); this.postMessage({event:"serial2-output-string",data:str});
}, opts.bufferLatency, emulator.buf2 ) }, opts.bufferLatency )
}.bind(this)); }.bind(this));
emulator.add_listener("emulator-started", function(){ emulator.add_listener("emulator-started", function(){