duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit fd05e89833da2f3a8edd2af1157304c4525f7b60
parent d14bf48abc89bbd6586d5502711b363a6c88fb6d
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Thu,  8 Sep 2022 15:01:15 -0400

cc: use stdin directly instead of defining cc<

This alias layer was spurious.

Diffstat:
Mfs/cc/ast.fs | 6+++---
Mfs/cc/io.fs | 3+--
Mfs/cc/tok.fs | 10+++++-----
3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/fs/cc/ast.fs b/fs/cc/ast.fs @@ -221,10 +221,10 @@ ASTIDCNT wordtbl astdatatbl ( node -- node ) \ Macros. See doc/cc -1 value _pslvl \ PS level at last #[ +: _ begin word runword _pslvl 0< until ; : runmacro - ['] cc< to@! in< >r - begin word runword _pslvl 0< until - r> to in< ; + to@ stdin ['] in< = if _ else + ['] stdin to@! in< >r _ r> to in< then ; : #[0 scnt to _pslvl runmacro ; : #[1 scnt 1+ to _pslvl runmacro ; diff --git a/fs/cc/io.fs b/fs/cc/io.fs @@ -1,6 +1,5 @@ \ C compiler I/O words -alias stdin cc< 0 value putback -: _cc< ( -- c ) putback ?dup if 0 to putback else cc< then ; +: _cc< ( -- c ) putback ?dup if 0 to putback else stdin then ; diff --git a/fs/cc/tok.fs b/fs/cc/tok.fs @@ -66,9 +66,9 @@ create _ 10 c, ," 09AZaz__$$" : nextt? ( -- tok-or-0 ) tonws dup not if ( EOF ) exit then ( c ) case of isSym1? ( ) - r@ cc< 2dup isSym2? if ( c1 c2 ) + r@ stdin 2dup isSym2? if ( c1 c2 ) 2dup is<<>>? if ( c1 c2 ) - cc< dup '=' = if ( c1 c2 '=' ) + stdin dup '=' = if ( c1 c2 '=' ) rot> swap 3 ( '=' c2 c1 len ) _writesym else ( c1 c2 c3 ) to putback swap 2 ( c2 c1 len ) _writesym then @@ -79,18 +79,18 @@ create _ 10 c, ," 09AZaz__$$" nextt? dup not if ( EOF! ) rdrop exit then ( tok ) S" */" s= until nextt? endof S" //" of s= drop begin ( ) - cc< dup not if ( EOF! ) rdrop exit then LF = until + stdin dup not if ( EOF! ) rdrop exit then LF = until nextt? endof endcase endof ''' of = \ the char literal is a special case: anything can go in between '' - cc< cc< ''' = not if _err then ( c ) ''' tuck ( ' c ' ) 3 _writesym + stdin stdin ''' = not if _err then ( c ) ''' tuck ( ' c ' ) 3 _writesym endof of ident-or-lit? \ identifier or number literal [ -4 [rcnt] ! ] \ V1=c MAXTOKSZ syspad :allot dup >r >r \ V2=tok V3=a 0 8b to!+ V3 ( len placeholder ) V1 begin ( c ) - 8b to!+ V3 cc< dup ident-or-lit? not until to putback + 8b to!+ V3 stdin dup ident-or-lit? not until to putback r> ( a ) r> ( a tok ) tuck 1+ - ( tok len ) over c! endof _err