© serviceprofessionalgmbh

IF and SELECT constuctions loose their appeal with every time you need to code them. An auto completion tool could recognise the intended word to be written after the first characters and complete it e.g. (SELECT is the only command in REXX beginning with SE - the supported commands are IF, SELECT and DO-loops).

The macro tests the current line and completes the fragments of coding as soon as it recognises it.

You type if and start the macro via function key and the macro will complete your source code (column sensitiv) like this:

IF bedingung THEN DO
   NOP
END
ELSE DO
   NOP
END


/* REXX * EDIT MACRO *************************************************/ /* */ /* Macroname.: $RXSYN */ /* Zweck.....: Erkennt Instruktion in der Cursor-Zeile und */ /* ergaenzt den Befehl */ /* */ address isredit "macro" "(csr,col) = CURSOR" "(CMD) = line .zcsr" upper cmd start=pos(strip(cmd),cmd) cmdstrip=strip(cmd,b) select when pos(cmdstrip,"IF")> 0 then label="IF" when word(cmdstrip,1) = "DO" then label="DO" when pos(cmdstrip,"SELECT") > 0 then label="SELECT" otherwise do zedsmsg="Unbekannter Befehl" zedlmsg="Unterstuetzte Befehle sind IF, SELECT und DO" address ispexec "setmsg msg(isrz000)" exit end end blanks=copies(' ',start-1) interpret "CALL" label "line .zcsr = '"zeile.0"'" do cnt = 1 to zeile.max "line_after .zcsr = '"zeile.cnt"'" end exit if: zeile.max=5 zeile.0=blanks"IF bedingung THEN DO" zeile.5=blanks" NOP" zeile.4=blanks"END" zeile.3=blanks"ELSE DO" zeile.2=blanks" NOP" zeile.1=blanks"END" return select: zeile.max=10 zeile.0 =blanks"SELECT" zeile.10=blanks" WHEN bedingung THEN DO" zeile.9 =blanks" NOP" zeile.8 =blanks" END" zeile.7 =blanks" WHEN bedingung THEN DO" zeile.6 =blanks" NOP" zeile.5 =blanks" END" zeile.4 =blanks" OTHERWISE DO" zeile.3 =blanks" NOP" zeile.2 =blanks" END" zeile.1 =blanks"END" return do: parm = subword(cmdstrip,2) select when parm = "" then loopkopf = "DO" when pos('=',parm) > 0 then loopkopf = "DO var = ? TO ??" when pos("WHILE",parm) > 0 then loopkopf = "DO WHILE bedingung" when pos("UNTIL",parm) > 0 then loopkopf = "DO UNTIL bedingung" otherwise loopkopf = cmdstrip end zeile.max=2 zeile.0=blanks!!loopkopf zeile.2=blanks" NOP" zeile.1=blanks"END" return
back to Edit Macros