* * ADDBLOCK.KEX * * Scan the current file starting at the current line and look for any lines * with an odd number of either single or double quotes. If any of these are * found then copy them to another file along with their respective line * numbers in the original file. * * Works with: * * KEDIT for Windows 1.5 * KEDIT 5.0 for DOS * KEDIT 5.0 for OS/2 * * Save the name of the current file CurrentFile = fileid.1() ErrorFile = "error.log" "k" ErrorFile "(new" "k" CurrentFile do while \focuseof() * Count the single quotes in the current line "nomsg count /'" if OddNumber(word(lastmsg.1(), 1)) then call FlagError else do * Count the double quotes in the current line 'nomsg count /"' if OddNumber(word(lastmsg.1(), 1)) then call FlagError end * Look at the next line "down 1" end "k" ErrorFile if size.1() = 0 then do "qquit" "k" CurrentFile say "No unbalanced quotes were found..." end "top" exit * Return TRUE if the argument is odd OddNumber: parse arg num * Could be "No occurrences..." if lower(num) = "no" then return 0 * The remainder for any integer number divided by 2 will be 1 for an * odd number and 0 for even return num // 2 * Log the current line as a possible error FlagError: * Get a copy of the current line and it's line number within the file line = curline.3() n = line.1() * Write this data to the error log file "k" ErrorFile "i" "Line #"n":" line * Go back to the source file "k" CurrentFile return