diff options
| -rw-r--r-- | jefs.fs | 8 | ||||
| -rw-r--r-- | readme.md | 1 |
2 files changed, 7 insertions, 2 deletions
@@ -71,8 +71,8 @@ hex : ret, c3 c, ; decimal : ." [compile] s" ' say compile, ; immediate \ lol this word breaks the highlighting, here have another " : z" 1 >in +! [ char " ] literal cparse branch >mark >r 2dup cmove, 0 c, nip r> dup >resolve 4 + [compile] lit drop ( 1+ [compile] lit ) ; immediate -\ todo s>z z>s : s>z ( a u -- zstr ) here @ -rot cmove, 0 c, ; +: strlen ( zstr -- len ) dup begin dup c@ 0<> while 1+ repeat swap - ; \ creates a word called _ (so don't create an actual word called that!!!) \ maybe it could be an empty string but that might require some rewriting @@ -353,6 +353,12 @@ make line-buffer line-buffer-length allot : include ( "path" -- ) parse included ; \ }}} +\ ARGS {{{ +: argc rs0 @ @ ; +: argv ( n -- a u ) 1+ cells rs0 @ + @ dup strlen ; \ segfaults if n>=argc +: environ argc 2 + cells rs0 @ + ; +\ }}} + \ TERMINAL CONTROL {{{ 60 constant termios# make termios termios# allot @@ -59,7 +59,6 @@ the error codes are: ## TODO -- argc + argv - testing - `DEPTH` - more terminal control words |
