* * NUMSORT.KEX * * When sorting numbers in a box block the resulting order will be incorrect if * the numbers are left justified within the block. This macro right justifies * the numbers, sorts them and then left justifies them again. It is assumed * that if any numbers have decimal points then all numbers have them and each * number has the same number of decimal places. * * Works with: * * KEDIT for Windows 1.5 * KEDIT 5.0 for DOS * KEDIT 5.0 for OS/2 * * Original author: Kent Downs, MSG, 8/96 * if block.1() = 'NONE' then do 'emsg NUMSORT Error 1: You forgot to mark a box block' exit 1 end if block.1() \= 'BOX' then do 'emsg NUMSORT Error 2: NUMSORT works with box blocks only' exit 2 end if \block() then do 'emsg NUMSORT Error 3: Box block must be in current file' exit 3 end "preserve" "set autosave off" NewAlt1 = alt.1() + 1 NewAlt2 = alt.2() + 1 ResetBlock = 0 if version.1() = "KEDIT/WINDOWS" then do if block.7() = "SELECTION" then do ResetBlock = 1 "mark persistent" end end * Right-adjust the contents of the block "rightadjust block" * Do the sort "sort block" * Left-adjust the contents of the block "leftadjust block" "restore" "sos blockstart" if ResetBlock then "reset block" * We only want the alteration count to go up by 1 "set alt" NewAlt1 NewAlt2 exit 0