* * ADDEM.KEX * * KEXX macro to sum the numbers in the currently marked box block and display * the result on the message line. * * Works with: * * KEDIT for Windows 1.5 * KEDIT 5.0 for DOS * KEDIT 5.0 for OS/2 * if block.1() = 'NONE' then do 'emsg ADDEM Error 1: You forgot to mark a box block' exit 1 end if block.1() \= 'BOX' then do 'emsg ADDEM Error 2: ADDEM works with box blocks only' exit 2 end if \block() then do 'emsg ADDEM Error 3: Box block must be in current file' exit 3 end sum = 0 LineNum = line.1() 'sos blockstart' size = block.4() - block.2() + 1 do size number = substr(curline.3(), block.3(), block.5() - block.3() + 1) if number = ' ' then do 'down 1' iterate end if datatype(number) \= 'NUM' then do 'emsg ADDEM Error 4: Invalid KEXX number... ['number']' exit 4 end sum = sum + number 'down 1' end ':'LineNum say 'Sum =' sum