## (for compability to DME-Macros: there were not as good commands as in XDME)
MACRO clearblock
BODY unblock resettoggle $_block2
MACRO startblock
BODY unblock bstart settoggle $_block2
MACRO endblock
BODY if blockon abort if !$_block2 abort bend resettoggle $_block2
## Utilities: startofword/endofword
## toupper/tolower
# goto start of word
MACRO sow
BODY while !left (ifelse ca (left) (right break))
# goto end of word
MACRO eow
BODY while !right (ifelse ca (right) (left break))
# make the current word to_lower
MACRO strlower
BODY sow while ca (if cu (tlate +32) right)
# make the current word to_upper
MACRO strupper
BODY sow while ca (if cl (tlate -32) right)
# make the current char to_lower
MACRO tolower
BODY if cu (tlate +32)
# make the current word to_upper
MACRO toupper
BODY if cl (tlate -32)
## Commodity of DME
## a almost perfect multireplace - it only needs FILTER
## (perhaps for 1.60.06)
MACRO multireplace
ARGS 2
BODY findstr $arg1 repstr $arg2 next mr_title filter m (( ) y n q a) (mr_res) (ifelse \$mr_res=1 (mr_this) (ifelse \$mr_res=2 (next) (ifelse \$mr_res=3 (mr_quit) (if \$mr_res=4 (mr_all)))) mr_title)
MACRO mr_title
BODY title (replace (y/n/q/a))
MACRO mr_all
BODY unfail (repeat -1 mr_this) mr_quit
MACRO mr_quit
BODY filter q () () () abort
MACRO mr_this
BODY right prevr next
## Commodity of DME
## a almost perfect commandname-completition - it only needs FILTER
## (perhaps for 1.60.06)
MACRO startmatching
ARGS 1
BODY endmatching set _M_QUEST ($arg1) matchnext
MACRO matchfstart
BODY if !l wleft eval (startmatching $currentword matchfilter)
MACRO matchfilter
BODY filter amb (q x esc tab spc return enter) _M_FIL (matchf2 \$_M_FIL)
MACRO matchf2
ARGS 1
BODY eval (ifelse \$arg1>2 (ifelse \$arg1>3 (while ca del (\$_M_RES ) matchfend if \$arg1>4 return) (matchnext)) (ifelse \$arg1>0 (matchfend) (title (forbidden key))))
MACRO matchfend
BODY endmatching filter q x x x
MACRO matchnext
BODY untitle (rx ('x=LS_FIND("$tabfile",$_M_COUNT,"$_M_QUEST",a); "set" _M_COUNT WORD(x,1)+1" set _M_RES ("DELWORD(x,1,1)")"')) titlevar _M_RES
MACRO endmatching
BODY set _M_COUNT 0 set _M_QUEST () set _M_RES ()
## some shortcuts
MACRO so
BODY saveold
MACRO tg
ARGS 1
BODY toggle $arg1
MACRO nf
ARGS 1
BODY newfile $arg1
MACROS END
# checkblockers BODY untitle (firstnb if ca (rx ("'rxgetvalue X currentvar'; if find('$blockbeginner', x) ~= 0 then 'add $arg1 $tabstop'")))