Refine jseval words.
This commit is contained in:
@ -14,10 +14,9 @@
|
|||||||
|
|
||||||
vocabulary web web definitions
|
vocabulary web web definitions
|
||||||
|
|
||||||
: jseval! ( a n index -- ) 0 call ;
|
|
||||||
|
|
||||||
1 value jsslot
|
1 value jsslot
|
||||||
: JSWORD ( "name" )
|
: jseval! ( a n index -- ) 0 call ;
|
||||||
|
: JSWORD: ( "name" )
|
||||||
create jsslot jseval! jsslot , 1 +to jsslot
|
create jsslot jseval! jsslot , 1 +to jsslot
|
||||||
does> @ call ;
|
does> @ call ;
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ r|
|
|||||||
eval(text);
|
eval(text);
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD jseval ( a n -- )
|
| JSWORD: jseval ( a n -- )
|
||||||
|
|
||||||
r~
|
r~
|
||||||
globalObj.ueforth = context;
|
globalObj.ueforth = context;
|
||||||
@ -513,7 +512,7 @@ r|
|
|||||||
}
|
}
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD web-type-raw ( a n -- yield? )
|
| JSWORD: web-type-raw ( a n -- yield? )
|
||||||
: web-type ( a n -- ) web-type-raw if yield then ;
|
: web-type ( a n -- ) web-type-raw if yield then ;
|
||||||
' web-type is type
|
' web-type is type
|
||||||
|
|
||||||
@ -534,7 +533,7 @@ r|
|
|||||||
}
|
}
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD web-key-raw ( -- n )
|
| JSWORD: web-key-raw ( -- n )
|
||||||
: web-key ( -- n ) begin yield web-key-raw dup if exit then drop again ;
|
: web-key ( -- n ) begin yield web-key-raw dup if exit then drop again ;
|
||||||
' web-key is key
|
' web-key is key
|
||||||
|
|
||||||
@ -548,7 +547,7 @@ r|
|
|||||||
sp += 4; i32[sp>>2] = context.inbuffer.length ? -1 : 0;
|
sp += 4; i32[sp>>2] = context.inbuffer.length ? -1 : 0;
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD web-key?-raw ( -- f )
|
| JSWORD: web-key?-raw ( -- f )
|
||||||
: web-key? ( -- f ) yield web-key?-raw ;
|
: web-key? ( -- f ) yield web-key?-raw ;
|
||||||
' web-key? is key?
|
' web-key? is key?
|
||||||
|
|
||||||
@ -562,7 +561,7 @@ r|
|
|||||||
}
|
}
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD terminate ( n -- )
|
| JSWORD: terminate ( n -- )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -573,7 +572,7 @@ r|
|
|||||||
}
|
}
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD shouldEcho? ( -- f )
|
| JSWORD: shouldEcho? ( -- f )
|
||||||
shouldEcho? echo !
|
shouldEcho? echo !
|
||||||
|
|
||||||
r|
|
r|
|
||||||
@ -585,7 +584,7 @@ r|
|
|||||||
context.setMode(mode);
|
context.setMode(mode);
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD grmode ( mode -- )
|
| JSWORD: grmode ( mode -- )
|
||||||
: gr 1 grmode ;
|
: gr 1 grmode ;
|
||||||
: text 0 grmode ;
|
: text 0 grmode ;
|
||||||
|
|
||||||
@ -608,7 +607,7 @@ r|
|
|||||||
context.ctx.fillRect(x, y, w, h);
|
context.ctx.fillRect(x, y, w, h);
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD rawbox ( x y w h col -- )
|
| JSWORD: rawbox ( x y w h col -- )
|
||||||
$ffffff value color
|
$ffffff value color
|
||||||
: box ( x y w h -- ) color rawbox ;
|
: box ( x y w h -- ) color rawbox ;
|
||||||
|
|
||||||
@ -623,7 +622,7 @@ r|
|
|||||||
context.canvas.height = h;
|
context.canvas.height = h;
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD window ( w h -- )
|
| JSWORD: window ( w h -- )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -636,7 +635,7 @@ r|
|
|||||||
sp += 4; i32[sp>>2] = context.height;
|
sp += 4; i32[sp>>2] = context.height;
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD viewport@ ( -- w h )
|
| JSWORD: viewport@ ( -- w h )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -650,21 +649,21 @@ r|
|
|||||||
context.Resize();
|
context.Resize();
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD textRatios ( tf mp -- )
|
| JSWORD: textRatios ( tf mp -- )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
sp += 4; i32[sp>>2] = context.mobile;
|
sp += 4; i32[sp>>2] = context.mobile;
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD mobile ( -- f )
|
| JSWORD: mobile ( -- f )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
sp += 4; i32[sp>>2] = context.KEYBOARD_HEIGHT;
|
sp += 4; i32[sp>>2] = context.KEYBOARD_HEIGHT;
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD keys-height ( -- n )
|
| JSWORD: keys-height ( -- n )
|
||||||
|
|
||||||
: show-text ( f -- )
|
: show-text ( f -- )
|
||||||
if
|
if
|
||||||
@ -683,7 +682,7 @@ r|
|
|||||||
context.ctx.translate(x, y);
|
context.ctx.translate(x, y);
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD translate ( x y )
|
| JSWORD: translate ( x y )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -696,7 +695,7 @@ r|
|
|||||||
context.ctx.scale(x / d, y / d);
|
context.ctx.scale(x / d, y / d);
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD scale ( x y div )
|
| JSWORD: scale ( x y div )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -708,7 +707,7 @@ r|
|
|||||||
context.ctx.rotate(Math.PI * 2 * angle / d);
|
context.ctx.rotate(Math.PI * 2 * angle / d);
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD rotate ( angle div )
|
| JSWORD: rotate ( angle div )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -718,7 +717,7 @@ r|
|
|||||||
context.ctx.save();
|
context.ctx.save();
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD gpush
|
| JSWORD: gpush
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -728,7 +727,7 @@ r|
|
|||||||
context.ctx.restore();
|
context.ctx.restore();
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD gpop
|
| JSWORD: gpop
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -739,7 +738,7 @@ r|
|
|||||||
context.canvas.style.imageRendering = f ? '' : 'pixelated';
|
context.canvas.style.imageRendering = f ? '' : 'pixelated';
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD smooth ( f -- )
|
| JSWORD: smooth ( f -- )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -760,7 +759,7 @@ r|
|
|||||||
}
|
}
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD setItem ( a n a n sess -- )
|
| JSWORD: setItem ( a n a n sess -- )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -787,7 +786,7 @@ r|
|
|||||||
sp += 4; i32[sp>>2] = data.length;
|
sp += 4; i32[sp>>2] = data.length;
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD getItem ( a n a n sess -- n )
|
| JSWORD: getItem ( a n a n sess -- n )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -814,7 +813,7 @@ r|
|
|||||||
sp += 4; i32[sp>>2] = data.length;
|
sp += 4; i32[sp>>2] = data.length;
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD getKey ( a n sess -- n )
|
| JSWORD: getKey ( a n sess -- n )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -831,7 +830,7 @@ r|
|
|||||||
sp += 4; i32[sp>>2] = len;
|
sp += 4; i32[sp>>2] = len;
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD keyCount ( sess -- n )
|
| JSWORD: keyCount ( sess -- n )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -839,7 +838,7 @@ r|
|
|||||||
context.ReleaseHandle(handle);
|
context.ReleaseHandle(handle);
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD release ( handle -- )
|
| JSWORD: release ( handle -- )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -848,7 +847,7 @@ r|
|
|||||||
context.handles[i] = new AudioContext();
|
context.handles[i] = new AudioContext();
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD newAudioContext ( -- h )
|
| JSWORD: newAudioContext ( -- h )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -858,7 +857,7 @@ r|
|
|||||||
context.handles[i] = context.handles[audio_ctx].createOscillator();
|
context.handles[i] = context.handles[audio_ctx].createOscillator();
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD createOscillator ( h -- h )
|
| JSWORD: createOscillator ( h -- h )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -868,7 +867,7 @@ r|
|
|||||||
context.handles[i] = context.handles[audio_ctx].createGain();
|
context.handles[i] = context.handles[audio_ctx].createGain();
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD createGain ( h -- h )
|
| JSWORD: createGain ( h -- h )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -878,7 +877,7 @@ r|
|
|||||||
context.handles[i] = context.handles[audio_ctx].createBiquadFilter();
|
context.handles[i] = context.handles[audio_ctx].createBiquadFilter();
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD createBiquadFilter ( h -- h )
|
| JSWORD: createBiquadFilter ( h -- h )
|
||||||
|
|
||||||
r|
|
r|
|
||||||
(function(sp) {
|
(function(sp) {
|
||||||
@ -888,7 +887,7 @@ r|
|
|||||||
context.handles[i] = context.handles[audio_ctx].createBufferSource();
|
context.handles[i] = context.handles[audio_ctx].createBufferSource();
|
||||||
return sp;
|
return sp;
|
||||||
})
|
})
|
||||||
| JSWORD createBufferSource ( h -- h )
|
| JSWORD: createBufferSource ( h -- h )
|
||||||
|
|
||||||
forth definitions web
|
forth definitions web
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user