# all flags are FALSE on start; in s:.edrc #255 is set to TRUE
#if !255 (source s:.edrc)
if $_m2patch (errormode m2 readerrs))
map sac-, (last left if !c=59 (right (;)) last -return)
map sac-m (split down split down c-tab)
#setmacro getname 0 (escimm (set name `))
#setmacro gettype 0 (escimm (set type `))
set getname (escimm (set name `))
set gettype (escimm (set type `))
set blockbeginner (BEGIN IF WHILE FOR WITH ELSE VAR ELSIF REPEAT CONST TYPE LOOP PROCEDURE CASE CLOSE)
set blockender (END ELSE ELSIF UNTIL BEGIN VAR CONST TYPE PROCEDURE CLOSE)
set stdimport ((FROM SYSTEM IMPORT ADR,ADDRESS,TAG;) sac-m (IMPORT))
##map -return (split down pushdot up firstnb while r (if top break up firstnb) if ca ( eval (\$currentword) ) set _crc \$colno popdot first while x<\$_crc (( )))
setmacro m2stdt 3 (freeline (\$arg1 \$arg2) spdw (END; (* \$arg1 *)) equalizeline up col +\$arg3 )
setmacro m2if 0 (m2stdt IF (() THEN) 4 )
setmacro m2case 0 (m2stdt CASE ( OF) 5 )
setmacro m2while 0 (m2stdt WHILE (() DO) 7 )
setmacro m2with 0 (m2stdt WITH ( DO) 5 )
setmacro m2for 0 (m2stdt FOR ( := TO DO) 4 )
setmacro m2loop 0 (m2stdt LOOP () 5 cr )
#setmacro m2if 0 (freeline (IF () THEN) spdw (END; (* IF *)) equalizeline up col +4 )
#setmacro m2case 0 (freeline (CASE OF) spdw (END; (* CASE *)) equalizeline up col +5 )
#setmacro m2while 0 (freeline (WHILE () DO) spdw (END; (* WHILE *)) equalizeline up col +7 )
#setmacro m2with 0 (freeline (WITH DO) spdw (END; (* WITH *)) equalizeline up col +5 )
#setmacro m2for 0 (freeline (FOR := TO DO) spdw (END; (* FOR *)) equalizeline up col +4 )
#(sa-m top first (IMPLEMENTATION ) goto +5 first tab)
#(top first $getname (MODULE \$name;) sac-m $stdimport sac-m bottom last sac-m first (BEGIN) sac-m first (CLOSE) sac-m first (END \$name.) cr goto 6 col 5)
#(freeline (LOOP) spdw (END; (* LOOP *)) equalizeline up last)
#((RECORD) sac-m (END; (* RECORD *)) firstnb up tab)
#(freeline (REPEAT) spdw (UNTIL ();) equalizeline col +7)
#((REPEAT) -return (UNTIL ();) col -2 $getname ((\$name)) up last -return tab)
#($getname (\$name = ) A-r down last col -3 (\$name) firstnb up tab)
#(freeline (WHILE () DO) spdw (END; (* WHILE *)) equalizeline up col +7 )
#(freeline (WITH DO) spdw (END; (* WITH *)) equalizeline up col +5 )