Created
October 17, 2012 18:56
-
-
Save crcx/3907395 to your computer and use it in GitHub Desktop.
yet another approach
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 variable: prefix:CHAR | |
create prefix:TABLE | |
256 allot | |
: getc:internal ( -c ) &getc 2 + @ do ; | |
[ dup @prefix:CHAR == [ drop getc:internal "prefix:TABLE" find drop @d->xt + @ dup 0 <> [ dip cr ] [ drop ] if 0 ] ifTrue ] is remapKeys | |
: bindTo: ( quote "character" - ) | |
getc "prefix:TABLE" find drop @d->xt + ! ; | |
[ cr | |
"? help text\n" puts | |
"d<word> documentation for word\n" puts | |
"s show stack contents\n" puts | |
"p<char> change trigger character to <char>\n" puts ] bindTo: ? | |
[ "display docs for: " puts | |
getToken find [ cr @d->doc 0; puts ] [ drop cr "no docs found!" puts ] if ] bindTo: d | |
[ "display functions matcing: " puts | |
getToken cr (matching) ] bindTo: m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment