home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
source
/
sedcase.seq
< prev
next >
Wrap
Text File
|
1991-02-27
|
5KB
|
140 lines
\ SEDCASE Case conversion, paste date/time, & tab expansion
editor definitions
headerless
: paste_datetime ( --- )
?browse ?exit
true save!> imode
bl schr getdate form-date count bounds
?do i c@ schr loop
bl schr gettime form-time count bounds
?do i c@ schr loop
bl schr
restore> imode ;
: tabxp ( --- ) \ tab expansion word
?browse ?exit
save> slook.buf
9 slook.buf 1+ c! 1 slook.buf c!
mxlln save!> rmargin
false save!> caps
shom
begin incr> screenchar <slooker>
looked
while fdel stab lchr
repeat shom
restore> caps
restore> rmargin
restore> slook.buf ;
: tab_to_space ( -- ) \ show tabs as spaces
?exp_tabs 0= !> ?exp_tabs
putline getline
?exp_type_set scrshow ;
: l>lcase ( --- ) \ convert the current line to lower case
?browse ?exit
linebuf 1+ linelen bounds
?do i c@ 'A' 'Z' between
if i c@ bl or i c!
then
loop modified
putline getline sdisplay ;
: l>ucase ( --- ) \ convert the current line to lower case
?browse ?exit
linebuf 1+ linelen bounds
?do i c@ 'a' 'z' between
if i c@ 95 and i c!
then
loop modified
putline getline sdisplay ;
: w>lcase ( --- ) \ convert the current word to lower case
?browse ?exit
linebuf 1+ screenchar + linelen screenchar - 0MAX bounds
?do i c@ 'A' 'Z' between
if i c@ bl or i c!
then i c@ bl = ?leave \ leave at word end
loop modified
putline getline sdisplay ;
: w>ucase ( --- ) \ convert the current word to lower case
?browse ?exit
linebuf 1+ screenchar + linelen screenchar - 0MAX bounds
?do i c@ 'a' 'z' between
if i c@ 95 and i c!
then i c@ bl = ?leave \ leave at word end
loop modified
putline getline sdisplay ;
: c-alpha? ( --- f1 )
linebuf 1+ screenchar + c@
dup 'A' 'Z' between \ either A to Z
swap 'a' 'z' between or ; \ or a to z
\ cursor MUST be sitting on a letter or NOTHING happens.
: wcasetgl ( --- ) \ word case conversion toggle
?browse ?exit
c-alpha?
if linebuf 1+ screenchar + c@ 'A' 'Z' between
if w>lcase
else w>ucase
then
then modified
putline getline sdisplay ;
: ccasetgl ( --- ) \ word case conversion toggle
?browse ?exit
c-alpha?
if linebuf 1+ screenchar +
dup c@ dup 'A' 'Z' between
if bl or else 95 and then swap c!
then modified
putline getline sdisplay ;
: ALT-OPTION ( --- ) \ Alt-O options
savescr
['] noop save!> dobutton
?doingmac 0= \ If we are doing a macro, don't display
\ command menu box.
if screenline 1+ dup 11 >
if 13 -
then 20 swap 60 over 12 + box&fill
." Other commands.. Select an operation" bcr bcr
." A - enter Any Character" bcr
." X - Expand all TABS to spaces" bcr
." S - Show all TABS as spaces" bcr
." L - convert line to Lowercase" bcr
." U - convert line to Uppercase" bcr
." W - Word case toggle" bcr
." C - Character case toggle" bcr
." P - Paste the Time and Date" bcr
." \s10\r ESC \0 = cancel"
showcur
then
key bl or >r
restscr
'a' r@ = if insany then
'x' r@ = if tabxp then
's' r@ = if tab_to_space then
'p' r@ = if paste_datetime then
'l' r@ = if l>lcase then
'u' r@ = if l>ucase then
'c' r@ = if ccasetgl then
'w' r> = if wcasetgl then
restore> dobutton
sdisplay showstat cursor-on ;
' ALT-OPTION IS ALT-O
headers
forth definitions