Optimized TO.
This commit is contained in:
@ -98,7 +98,9 @@ variable handler
|
|||||||
( Values )
|
( Values )
|
||||||
: value ( n -- ) constant ;
|
: value ( n -- ) constant ;
|
||||||
: value-bind ( xt-val xt )
|
: value-bind ( xt-val xt )
|
||||||
>r >body state @ if aliteral r> , else r> execute then ;
|
>r >body state @ if
|
||||||
|
r@ ['] ! = if rdrop ['] doset , , else aliteral r> , then
|
||||||
|
else r> execute then ;
|
||||||
: to ( n -- ) ' ['] ! value-bind ; immediate
|
: to ( n -- ) ' ['] ! value-bind ; immediate
|
||||||
: +to ( n -- ) ' ['] +! value-bind ; immediate
|
: +to ( n -- ) ' ['] +! value-bind ; immediate
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,6 @@ e: check-boot
|
|||||||
out: defer
|
out: defer
|
||||||
out: +to
|
out: +to
|
||||||
out: to
|
out: to
|
||||||
out: value-bind
|
|
||||||
out: value
|
out: value
|
||||||
out: throw
|
out: throw
|
||||||
out: catch
|
out: catch
|
||||||
|
|||||||
@ -112,6 +112,7 @@ typedef struct {
|
|||||||
YV(internals, 0BRANCH, if (!tos) ip = (cell_t *) *ip; else ++ip; DROP) \
|
YV(internals, 0BRANCH, if (!tos) ip = (cell_t *) *ip; else ++ip; DROP) \
|
||||||
YV(internals, DONEXT, *rp = *rp - 1; if (~*rp) ip = (cell_t *) *ip; else (--rp, ++ip)) \
|
YV(internals, DONEXT, *rp = *rp - 1; if (~*rp) ip = (cell_t *) *ip; else (--rp, ++ip)) \
|
||||||
YV(internals, DOLIT, DUP; tos = *ip++) \
|
YV(internals, DOLIT, DUP; tos = *ip++) \
|
||||||
|
YV(internals, DOSET, *((cell_t *) *ip++) = tos; DROP) \
|
||||||
YV(internals, DOCOL, ++rp; *rp = (cell_t) ip; ip = (cell_t *) (w + sizeof(cell_t))) \
|
YV(internals, DOCOL, ++rp; *rp = (cell_t) ip; ip = (cell_t *) (w + sizeof(cell_t))) \
|
||||||
YV(internals, DOCON, DUP; tos = *(cell_t *) (w + sizeof(cell_t))) \
|
YV(internals, DOCON, DUP; tos = *(cell_t *) (w + sizeof(cell_t))) \
|
||||||
YV(internals, DOVAR, DUP; tos = w + sizeof(cell_t)) \
|
YV(internals, DOVAR, DUP; tos = w + sizeof(cell_t)) \
|
||||||
|
|||||||
@ -44,6 +44,7 @@ internals definitions
|
|||||||
: see-one ( xt -- xt+1 )
|
: see-one ( xt -- xt+1 )
|
||||||
dup cell+ swap @
|
dup cell+ swap @
|
||||||
dup ['] DOLIT = if drop dup @ . cell+ exit then
|
dup ['] DOLIT = if drop dup @ . cell+ exit then
|
||||||
|
dup ['] DOSET = if drop ." TO " dup @ cell - see. cell+ exit then
|
||||||
dup ['] DOFLIT = if drop dup sf@ <# [char] e hold #fs #> type space cell+ exit then
|
dup ['] DOFLIT = if drop dup sf@ <# [char] e hold #fs #> type space cell+ exit then
|
||||||
dup ['] $@ = if drop ['] s" see.
|
dup ['] $@ = if drop ['] s" see.
|
||||||
dup @ dup >r >r dup cell+ r> type cell+ r> 1+ aligned +
|
dup @ dup >r >r dup cell+ r> type cell+ r> 1+ aligned +
|
||||||
|
|||||||
@ -71,7 +71,7 @@ e: test-see-fornext
|
|||||||
out: : test >R DONEXT ;
|
out: : test >R DONEXT ;
|
||||||
;e
|
;e
|
||||||
|
|
||||||
e: test-string-strides
|
e: test-see-string-strides
|
||||||
: test0 1 if ." " then ;
|
: test0 1 if ." " then ;
|
||||||
: test1 1 if ." >" then ;
|
: test1 1 if ." >" then ;
|
||||||
: test2 1 if ." ->" then ;
|
: test2 1 if ." ->" then ;
|
||||||
@ -108,3 +108,31 @@ e: test-noname
|
|||||||
. cr
|
. cr
|
||||||
out: 16
|
out: 16
|
||||||
;e
|
;e
|
||||||
|
|
||||||
|
e: test-see-variable
|
||||||
|
variable foo
|
||||||
|
: bar foo @ . ;
|
||||||
|
see bar
|
||||||
|
out: : bar foo @ . ;
|
||||||
|
;e
|
||||||
|
|
||||||
|
e: test-see-create
|
||||||
|
create foo
|
||||||
|
: bar foo @ . ;
|
||||||
|
see bar
|
||||||
|
out: : bar foo @ . ;
|
||||||
|
;e
|
||||||
|
|
||||||
|
e: test-see-value
|
||||||
|
0 value foo
|
||||||
|
: bar foo . ;
|
||||||
|
see bar
|
||||||
|
out: : bar foo . ;
|
||||||
|
;e
|
||||||
|
|
||||||
|
e: test-see-to
|
||||||
|
0 value foo
|
||||||
|
: bar 123 to foo ;
|
||||||
|
see bar
|
||||||
|
out: : bar 123 TO foo ;
|
||||||
|
;e
|
||||||
|
|||||||
@ -54,7 +54,7 @@ transfer{
|
|||||||
xt-find& xt-hide xt-transfer
|
xt-find& xt-hide xt-transfer
|
||||||
voc-stack-end last-vocabulary notfound
|
voc-stack-end last-vocabulary notfound
|
||||||
immediate? input-buffer ?echo ?arrow. arrow
|
immediate? input-buffer ?echo ?arrow. arrow
|
||||||
evaluate-buffer aliteral
|
evaluate-buffer aliteral value-bind
|
||||||
leaving( )leaving leaving leaving,
|
leaving( )leaving leaving leaving,
|
||||||
(do) (?do) (+loop)
|
(do) (?do) (+loop)
|
||||||
parse-quote digit $@ raw.s
|
parse-quote digit $@ raw.s
|
||||||
|
|||||||
Reference in New Issue
Block a user