- May
- 3,515
- 5
Charles:
I would appreciate help with the problem below.
I have dynamically created pure ASCII files I try to analyze. The file is styled like a configuration file of sections and entries, but typically it has many entries with the same name in a section, so I cannot use the @iniread function [OT: Rex has long ago refused my request to extend @iniread to support this style, very common before the days of WinAPI calls for reading and writing configuration files, and still common on non-Windows platforms]. Some of the lines contain unsafe characters, thus processing them in a TCC batch program results in error messages. My batch program tries to locate and process all entries with the keyword "file" in a specific section (never the first). It processes each line of the file using the "DO line in @file" syntax; ignores every line until it detects the line containing the section name; then it processes every line until EOF or a line that does not start with "file=".
I tried to insert "set line=%@safeexp[line]" immediately after DO to avoid error messages; now I can no longer detect the section title line, even after I switched from direct comparison to trying to match "%safeline" with %@safeenv["[section]"].
I suppose I could switch to reading the file into a binary buffer, but that would require processing a character at a time, instead of a line at a time. Using an array is not a real alternative, because each line is still unsafe.
There are only two literal strings that I need to be able to match (section title and entry name), but I could not figure out how to set these matches so that a safed line (or part thereof) could be matched against them using EQC.
I would appreciate help with the problem below.
I have dynamically created pure ASCII files I try to analyze. The file is styled like a configuration file of sections and entries, but typically it has many entries with the same name in a section, so I cannot use the @iniread function [OT: Rex has long ago refused my request to extend @iniread to support this style, very common before the days of WinAPI calls for reading and writing configuration files, and still common on non-Windows platforms]. Some of the lines contain unsafe characters, thus processing them in a TCC batch program results in error messages. My batch program tries to locate and process all entries with the keyword "file" in a specific section (never the first). It processes each line of the file using the "DO line in @file" syntax; ignores every line until it detects the line containing the section name; then it processes every line until EOF or a line that does not start with "file=".
I tried to insert "set line=%@safeexp[line]" immediately after DO to avoid error messages; now I can no longer detect the section title line, even after I switched from direct comparison to trying to match "%safeline" with %@safeenv["[section]"].
I suppose I could switch to reading the file into a binary buffer, but that would require processing a character at a time, instead of a line at a time. Using an array is not a real alternative, because each line is still unsafe.
There are only two literal strings that I need to be able to match (section title and entry name), but I could not figure out how to set these matches so that a safed line (or part thereof) could be matched against them using EQC.