Shows text is page.
This commit is contained in:
38
web/fini.fs
38
web/fini.fs
@ -19,7 +19,43 @@ forth definitions internals
|
||||
( Bring a forth to the top of the vocabulary. )
|
||||
: ok ." uEforth" raw-ok ;
|
||||
|
||||
: web-type 0 call ; ' web-type is type
|
||||
: jseval! ( a n index -- ) 0 call ;
|
||||
|
||||
r|
|
||||
(function(sp) {
|
||||
var n = i32[sp>>2]; sp -= 4;
|
||||
var a = i32[sp>>2]; sp -= 4;
|
||||
var text = GetString(a, n);
|
||||
eval(text);
|
||||
return sp;
|
||||
})
|
||||
| 2 jseval!
|
||||
: jseval ( a n -- ) 2 call ;
|
||||
|
||||
r|
|
||||
if (!globalObj['write']) {
|
||||
var console = document.createElement('pre');
|
||||
console.id = 'console';
|
||||
document.body.appendChild(console);
|
||||
}
|
||||
| jseval
|
||||
|
||||
r|
|
||||
(function(sp) {
|
||||
var n = i32[sp>>2]; sp -= 4;
|
||||
var a = i32[sp>>2]; sp -= 4;
|
||||
var text = GetString(a, n);
|
||||
if (globalObj['write']) {
|
||||
write(text);
|
||||
} else {
|
||||
var console = document.getElementById('console');
|
||||
console.innerText += text.replace(/[\r]/g, '');
|
||||
}
|
||||
return sp;
|
||||
})
|
||||
| 1 jseval!
|
||||
|
||||
: web-type 1 call ; ' web-type is type
|
||||
: web-key yield 0 ; ' web-key is key
|
||||
: web-key? yield 0 ; ' web-key? is key?
|
||||
|
||||
|
||||
@ -36,20 +36,15 @@ var u16 = new Uint16Array(heap);
|
||||
var u8 = new Uint8Array(heap);
|
||||
var builtins = [];
|
||||
var opcodes = {};
|
||||
var objects = [Type, Eval];
|
||||
var objects = [SetEval];
|
||||
|
||||
{{sys}}
|
||||
|
||||
function Type(sp) {
|
||||
function SetEval(sp) {
|
||||
var index = i32[sp>>2]; sp -= 4;
|
||||
var n = i32[sp>>2]; sp -= 4;
|
||||
var a = i32[sp>>2]; sp -= 4;
|
||||
console.log(GetString(a, n));
|
||||
}
|
||||
|
||||
function Eval(sp) {
|
||||
var n = i32[sp>>2]; sp -= 4;
|
||||
var a = i32[sp>>2]; sp -= 4;
|
||||
eval(GetString(a, n));
|
||||
objects[index] = eval(GetString(a, n));
|
||||
}
|
||||
|
||||
function Call(sp) {
|
||||
|
||||
Reference in New Issue
Block a user