Differences From Artifact [0fbd43f64df94e24]:
File rxe.retro part of check-in [e1d6b3829d] - Add copyright notice to RxE sources by charleschilders on 2010-06-06 15:48:56. [annotate] [view]
To Artifact [02ed1b5b657a8b66]:
File rxe.retro part of check-in [e937e83ca5] - Update RxE to work with the new chained vocabularies. by charleschilders on 2010-07-25 00:13:46. [annotate] [view]
@@ -1,10 +1,8 @@
( Retro Experimental Editor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
( This is a replacement for the RED/REM editors used in past )
( releases of Retro. )
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
-( Copyright 2009 - 2010 Charles Childers, Luke Parrish )
-( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
( Key Action )
( --- ------------------------------------------------- )
( i Move cursor up )
( j Move cursor left )
@@ -29,11 +27,8 @@
( TAB Switch between edit and command mode )
( ESC Switch between edit and command mode )
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
-&console open
-&files open
-
vocab rxe::core
((
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
3 elements #-blocks offset blk
@@ -41,17 +36,18 @@
: (block) @blk block ;
: (line) 64 * (block) + ;
{{
- : <|> red '| emit ;
- : <+> red '+ emit ;
+ : <|> \console.red '| emit ;
+ : <+> \console.red '+ emit ;
: type for @+ emit next drop ;
- : rows 8 for <|> dup 64 cyan type 64 + <|> cr next ;
+ : rows 8 for <|> dup 64 \console.cyan type 64 + <|> cr next ;
: .block space ." #" @blk . cr ;
- : bar red <+> 64 for '- emit next <+> ;
- : vb bar cr @blk block rows drop bar yellow .block white ;
+ : bar \console.red <+> 64 for '- emit next <+> ;
+ : vb bar cr @blk block rows drop bar \console.yellow .block \console.white ;
+ : defer update off later update on redraw ;
---reveal---
- : (v) ( - ) home vb ;
+ : (v) ( - ) @\console.colors if \console.home else clear then defer vb ;
: new ( - ) offset @ 32 512 #-blocks @ * fill ;
: e ( - ) (block) 512 eval ;
: ea ( - ) @offset @#-blocks 512 * eval ;
: set-blocks ( n- )
@@ -129,40 +125,38 @@
: $$] blk ++ ; ( n = next block )
: $$z ( z = exit rxe )
&rxe::keys shut
&remap-keys :devector
- pop pop 2drop normal ;
+ pop pop 2drop \console.normal ;
: $$e ( e = evaluate block )
- normal pop pop 2drop e ;
+ \console.normal pop pop 2drop e ;
: $$E ( E = evaluate all )
- normal pop pop 2drop ea ;
+ \console.normal pop pop 2drop ea ;
{{
3 elements fid action mode
- : ask ( $- ) type space 32 accept ;
- : open ( - ) tib @mode fopen !fid ;
- : emit ( c- ) @fid fwrite drop ;
+ : ask ( - ) ." File? " 32 accept ;
+ : open ( - ) tib @mode \files.open !fid ;
+ : emit ( c- ) @fid \files.write drop ;
: dump ( an- ) for @+ emit next drop 10 emit ;
- : key ( -c ) @fid fread ;
+ : key ( -c ) @fid \files.read ;
: read ( an- ) for key swap !+ next key 2drop ;
: short ( an- ) drop repeat key dup 10 =if 2drop ;then swap !+ again ;
: all ( -a ) @blk block 8 for dup 64 @action execute 64 + next ;
- : end ( a- ) @fid fclose 2drop ;
- : common ( - ) ask !mode !action open @fid if all end then clear ;
+ : end ( a- ) @fid \files.close 2drop ;
+ : common ( - ) ask open @fid if all end then clear ;
---reveal---
- : $${ &dump :w s" Save to:" common ;
- : $$} &read :r s" Read from:" common ;
- : $$| &short :r s" Read from:" common ;
+ : $${ &dump !action \files.:w !mode common ;
+ : $$} &read !action \files.:r !mode common ;
+ : $$| &short !action \files.:r !mode common ;
}}
))
: edit ( - )
+ @fb if \console.colors off then
&remap &remap-keys :is
- &rxe::keys open clear bold
+ &rxe::keys open clear \console.bold
repeat rxe.display key edit? match again ;
&rxe::keys shut
&rxe::core shut
-&files shut
-&console shut
-( Load optional extensions )
include rxe.extensions.retro