- May
- 62
- 1
Synopsis: echo statements are inconsistently generating apparently unrelated errors.
Spoiler: problem goes away when I replace the for () construct in the following code chunk with a do/enddo construct. But these results are still mildly interesting.
I have a .btm script that processes one or more filesets, which are specified on the command line. The heart of the script looks like this:
I'm using echo and pause statements (two shown here, commented out) as a poor man's debug. When those statements are turned on (remove the colons), the script does exactly as I expect in TCC 28 (but not in TCC 22). When those statements are either commented out or removed, the script (usually) gives multiple error messages "TCC: C:\batch\ls.btm [169] Unknown command '&'" on what appear to be random iterations of the loop. The number of error messages depends on whether I have removed one or the other or both of the comments, and on which version of TCC I am using. The error message points to that closing right parenthesis. The character "&" does not appear in the script. That character is defined to TCC as my command separator.
Playing with turning the echo statements on and off in two versions of TCC yielded these results.
Adding other echo statements kept changing the error-message counts. Nonetheless, in all other respects, the output of the script was identical and correct in all cases.
So what do the error messages really mean, and what really triggered them?
Spoiler: problem goes away when I replace the for () construct in the following code chunk with a do/enddo construct. But these results are still mildly interesting.
I have a .btm script that processes one or more filesets, which are specified on the command line. The heart of the script looks like this:
Code:
do while "%1" != ""
<code here to parse fileset from command line>
for %recurse_fileset_path %file in (%@quote[%fileset]) (
<a lotta code here>
:: echo just before gosub
gosub COMMIFY filesz
:: echo just after gosub
<some more code here>
)
shift
enddo
Playing with turning the echo statements on and off in two versions of TCC yielded these results.
Code:
Error Msg Count
Situation v. 22.00.41 x64 v. 28.01.14 x64
both echo lines active 15 0
first (::)ed out 0 6
second (::)ed out 11 0
both (::)ed out 0 1
first (rem)ed out 0 5
second (rem)ed out 29 2
both (rem)ed out 4 6
first removed 41 0
second removed 0 0
both removed 0 0
Adding other echo statements kept changing the error-message counts. Nonetheless, in all other respects, the output of the script was identical and correct in all cases.
So what do the error messages really mean, and what really triggered them?