Eliminate literal escape sequences from *.4th

Suggested by:	alfred
MFC after:	3 days
X-MFC-to:	stable/10
This commit is contained in:
Devin Teske 2015-04-02 01:48:12 +00:00
parent 011ac1b05a
commit 914ff88ad6
8 changed files with 154 additions and 93 deletions

View File

@ -26,13 +26,21 @@
2 brandX ! 1 brandY ! \ Initialize brand placement defaults 2 brandX ! 1 brandY ! \ Initialize brand placement defaults
: brand+ ( x y c-addr/u -- x y' )
2swap 2dup at-xy 2swap \ position the cursor
type \ print to the screen
1+ \ increase y for next time we're called
;
: brand ( x y -- ) \ "FreeBSD" [wide] logo in B/W (7 rows x 42 columns) : brand ( x y -- ) \ "FreeBSD" [wide] logo in B/W (7 rows x 42 columns)
2dup at-xy ." ______ ____ _____ _____ " 1+ s" ______ ____ _____ _____ " brand+
2dup at-xy ." | ____| | _ \ / ____| __ \ " 1+ s" | ____| | _ \ / ____| __ \ " brand+
2dup at-xy ." | |___ _ __ ___ ___ | |_) | (___ | | | |" 1+ s" | |___ _ __ ___ ___ | |_) | (___ | | | |" brand+
2dup at-xy ." | ___| '__/ _ \/ _ \| _ < \___ \| | | |" 1+ s" | ___| '__/ _ \/ _ \| _ < \___ \| | | |" brand+
2dup at-xy ." | | | | | __/ __/| |_) |____) | |__| |" 1+ s" | | | | | __/ __/| |_) |____) | |__| |" brand+
2dup at-xy ." | | | | | | || | | |" 1+ s" | | | | | | || | | |" brand+
at-xy ." |_| |_| \___|\___||____/|_____/|_____/ " s" |_| |_| \___|\___||____/|_____/|_____/ " brand+
2drop
; ;

View File

@ -28,25 +28,34 @@
46 logoX ! 4 logoY ! \ Initialize logo placement defaults 46 logoX ! 4 logoY ! \ Initialize logo placement defaults
: logo+ ( x y c-addr/u -- x y' )
2swap 2dup at-xy 2swap \ position the cursor
[char] @ escc! \ replace @ with Esc
type \ print to the screen
1+ \ increase y for next time we're called
;
: logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns) : logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns)
2dup at-xy ." , ," 1+ s" @[31m, ," logo+
2dup at-xy ." /( )`" 1+ s" /( )`" logo+
2dup at-xy ." \ \___ / |" 1+ s" \ \___ / |" logo+
2dup at-xy ." /- _ `-/ '" 1+ s" /- @[m_@[31m `-/ '" logo+
2dup at-xy ." (/\/ \ \ /\" 1+ s" (@[m/\/ \@[31m \ /\" logo+
2dup at-xy ." / / | ` \" 1+ s" @[m/ / |@[31m ` \" logo+
2dup at-xy ." O O ) / |" 1+ s" @[34mO O @[m) @[31m/ |" logo+
2dup at-xy ." `-^--'`< '" 1+ s" @[m`-^--'@[31m`< '" logo+
2dup at-xy ." (_.) _ ) /" 1+ s" (_.) _ ) /" logo+
2dup at-xy ." `.___/` /" 1+ s" `.___/` /" logo+
2dup at-xy ." `-----' /" 1+ s" `-----' /" logo+
2dup at-xy ." <----. __ / __ \" 1+ s" @[33m<----.@[31m __ / __ \" logo+
2dup at-xy ." <----|====O)))==) \) /====|" 1+ s" @[33m<----|====@[31mO)))@[33m==@[31m) \) /@[33m====|" logo+
2dup at-xy ." <----' `--' `.__,' \" 1+ s" @[33m<----'@[31m `--' `.__,' \" logo+
2dup at-xy ." | |" 1+ s" | |" logo+
2dup at-xy ." \ / /\" 1+ s" \ / /\" logo+
2dup at-xy ." ______( (_ / \______/" 1+ s" @[36m______@[31m( (_ / \______/" logo+
2dup at-xy ." ,' ,-----' |" 1+ s" @[36m,' ,-----' |" logo+
at-xy ." `--{__________)" s" `--{__________)@[m" logo+
2drop
; ;

View File

@ -27,25 +27,33 @@
46 logoX ! 4 logoY ! \ Initialize logo placement defaults 46 logoX ! 4 logoY ! \ Initialize logo placement defaults
: logo+ ( x y c-addr/u -- x y' )
2swap 2dup at-xy 2swap \ position the cursor
type \ print to the screen
1+ \ increase y for next time we're called
;
: logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns) : logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns)
2dup at-xy ." , ," 1+ s" , ," logo+
2dup at-xy ." /( )`" 1+ s" /( )`" logo+
2dup at-xy ." \ \___ / |" 1+ s" \ \___ / |" logo+
2dup at-xy ." /- _ `-/ '" 1+ s" /- _ `-/ '" logo+
2dup at-xy ." (/\/ \ \ /\" 1+ s" (/\/ \ \ /\" logo+
2dup at-xy ." / / | ` \" 1+ s" / / | ` \" logo+
2dup at-xy ." O O ) / |" 1+ s" O O ) / |" logo+
2dup at-xy ." `-^--'`< '" 1+ s" `-^--'`< '" logo+
2dup at-xy ." (_.) _ ) /" 1+ s" (_.) _ ) /" logo+
2dup at-xy ." `.___/` /" 1+ s" `.___/` /" logo+
2dup at-xy ." `-----' /" 1+ s" `-----' /" logo+
2dup at-xy ." <----. __ / __ \" 1+ s" <----. __ / __ \" logo+
2dup at-xy ." <----|====O)))==) \) /====|" 1+ s" <----|====O)))==) \) /====|" logo+
2dup at-xy ." <----' `--' `.__,' \" 1+ s" <----' `--' `.__,' \" logo+
2dup at-xy ." | |" 1+ s" | |" logo+
2dup at-xy ." \ / /\" 1+ s" \ / /\" logo+
2dup at-xy ." ______( (_ / \______/" 1+ s" ______( (_ / \______/" logo+
2dup at-xy ." ,' ,-----' |" 1+ s" ,' ,-----' |" logo+
at-xy ." `--{__________)" s" `--{__________)" logo+
2drop
; ;

View File

@ -27,19 +27,27 @@
52 logoX ! 9 logoY ! \ Initialize logo placement defaults 52 logoX ! 9 logoY ! \ Initialize logo placement defaults
: logo+ ( x y c-addr/u -- x y' )
2swap 2dup at-xy 2swap \ position the cursor
type \ print to the screen
1+ \ increase y for next time we're called
;
: logo ( x y -- ) \ "FreeBSD" logo in B/W (13 rows x 21 columns) : logo ( x y -- ) \ "FreeBSD" logo in B/W (13 rows x 21 columns)
2dup at-xy ." ______" 1+ s" ______" logo+
2dup at-xy ." | ____| __ ___ ___ " 1+ s" | ____| __ ___ ___ " logo+
2dup at-xy ." | |__ | '__/ _ \/ _ \" 1+ s" | |__ | '__/ _ \/ _ \" logo+
2dup at-xy ." | __|| | | __/ __/" 1+ s" | __|| | | __/ __/" logo+
2dup at-xy ." | | | | | | |" 1+ s" | | | | | | |" logo+
2dup at-xy ." |_| |_| \___|\___|" 1+ s" |_| |_| \___|\___|" logo+
2dup at-xy ." ____ _____ _____" 1+ s" ____ _____ _____" logo+
2dup at-xy ." | _ \ / ____| __ \" 1+ s" | _ \ / ____| __ \" logo+
2dup at-xy ." | |_) | (___ | | | |" 1+ s" | |_) | (___ | | | |" logo+
2dup at-xy ." | _ < \___ \| | | |" 1+ s" | _ < \___ \| | | |" logo+
2dup at-xy ." | |_) |____) | |__| |" 1+ s" | |_) |____) | |__| |" logo+
2dup at-xy ." | | | |" 1+ s" | | | |" logo+
at-xy ." |____/|_____/|_____/" s" |____/|_____/|_____/" logo+
2drop
; ;

View File

@ -26,21 +26,30 @@
46 logoX ! 7 logoY ! \ Initialize logo placement defaults 46 logoX ! 7 logoY ! \ Initialize logo placement defaults
: logo+ ( x y c-addr/u -- x y' )
2swap 2dup at-xy 2swap \ position the cursor
[char] @ escc! \ replace @ with Esc
type \ print to the screen
1+ \ increase y for next time we're called
;
: logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns) : logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
2dup at-xy ." ``` `" 1+ s" @[31m``` @[31;1m`@[31m" logo+
2dup at-xy ." s` `.....---.......--.``` -/" 1+ s" s` `.....---...@[31;1m....--.``` -/@[31m" logo+
2dup at-xy ." +o .--` /y:` +." 1+ s" +o .--` @[31;1m/y:` +.@[31m" logo+
2dup at-xy ." yo`:. :o `+-" 1+ s" yo`:. @[31;1m:o `+-@[31m" logo+
2dup at-xy ." y/ -/` -o/" 1+ s" y/ @[31;1m-/` -o/@[31m" logo+
2dup at-xy ." .- ::/sy+:." 1+ s" .- @[31;1m::/sy+:.@[31m" logo+
2dup at-xy ." / `-- /" 1+ s" / @[31;1m`-- /@[31m" logo+
2dup at-xy ." `: :`" 1+ s" `: @[31;1m:`@[31m" logo+
2dup at-xy ." `: :`" 1+ s" `: @[31;1m:`@[31m" logo+
2dup at-xy ." / /" 1+ s" / @[31;1m/@[31m" logo+
2dup at-xy ." .- -." 1+ s" .- @[31;1m-.@[31m" logo+
2dup at-xy ." -- -." 1+ s" -- @[31;1m-.@[31m" logo+
2dup at-xy ." `:` `:`" 1+ s" `:` @[31;1m`:`" logo+
2dup at-xy ." .-- `--." 1+ s" @[31;1m.-- `--." logo+
at-xy ." .---.....----." s" .---.....----.@[m" logo+
2drop
; ;

View File

@ -26,21 +26,29 @@
46 logoX ! 7 logoY ! \ Initialize logo placement defaults 46 logoX ! 7 logoY ! \ Initialize logo placement defaults
: logo+ ( x y c-addr/u -- x y' )
2swap 2dup at-xy 2swap \ position the cursor
type \ print to the screen
1+ \ increase y for next time we're called
;
: logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns) : logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns)
2dup at-xy ." ``` `" 1+ s" ``` `" logo+
2dup at-xy ." s` `.....---.......--.``` -/" 1+ s" s` `.....---.......--.``` -/" logo+
2dup at-xy ." +o .--` /y:` +." 1+ s" +o .--` /y:` +." logo+
2dup at-xy ." yo`:. :o `+-" 1+ s" yo`:. :o `+-" logo+
2dup at-xy ." y/ -/` -o/" 1+ s" y/ -/` -o/" logo+
2dup at-xy ." .- ::/sy+:." 1+ s" .- ::/sy+:." logo+
2dup at-xy ." / `-- /" 1+ s" / `-- /" logo+
2dup at-xy ." `: :`" 1+ s" `: :`" logo+
2dup at-xy ." `: :`" 1+ s" `: :`" logo+
2dup at-xy ." / /" 1+ s" / /" logo+
2dup at-xy ." .- -." 1+ s" .- -." logo+
2dup at-xy ." -- -." 1+ s" -- -." logo+
2dup at-xy ." `:` `:`" 1+ s" `:` `:`" logo+
2dup at-xy ." .-- `--." 1+ s" .-- `--." logo+
at-xy ." .---.....----." s" .---.....----." logo+
2drop
; ;

View File

@ -395,14 +395,15 @@ also menu-infrastructure definitions
setenv setenv
\ Assign third to ansi_caption[x][y] \ Assign third to ansi_caption[x][y]
kerncapbuf 0 s" Kernel: " strcat kerncapbuf 0 s" @[1mK@[37mernel: " [char] @ escc! strcat
kernmenuidx @ [char] 0 = if kernmenuidx @ [char] 0 = if
s" default/" s" default/@[32m"
else else
s" " s" @[34;1m"
then strcat then
[char] @ escc! strcat
2over strcat 2over strcat
s" " strcat s" @[37m" [char] @ escc! strcat
kernidx @ kernmenuidx @ ansi_caption[x][y] kernidx @ kernmenuidx @ ansi_caption[x][y]
setenv setenv

View File

@ -62,3 +62,13 @@ marker task-screen.4th
\ Disable inverse foreground/background mode ( Esc-[27m ) \ Disable inverse foreground/background mode ( Esc-[27m )
: -inv ( -- ) escc 27 .# [char] m emit ; : -inv ( -- ) escc 27 .# [char] m emit ;
\ Convert all occurrences of given character (c) in string (c-addr/u) to Esc
: escc! ( c-addr/u c -- c-addr/u )
2 pick 2 pick
begin dup 0> while
over c@ 3 pick = if over 27 swap c! then
1- swap 1+ swap
repeat
2drop drop
;