tcc 16 for in mystery, connected to setdos and/or else clause

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Jan 16, 2011
5
0
#1
Yeah, I know: another crazy user :-). Please bear with me.

This btm file ...

setlocal
:: setdos /c%=@

for %k in (%1) do (

iff "foo" == "foo" then
echo if says "%k"
else
echo else says "%k"
endiff
)
endlocal

... works as expected in TCC 16, producing this output:

TCC 16.03.55 x64 Windows 7 [Version 6.1.7601]
Copyright 2014 JP Software Inc. All Rights Reserved
Registered to David Habermehl - 1 System License

[C:\Command\TCMD16x64]foo.btm *.flac
setlocal
for %k in (%1) do ( iff "foo" == "foo" then & echo if says "%k" & else & echo else says "%k" & endiff )
if says "01.flac"
if says "02.flac"
if says "03.flac"
if says "04.flac"
if says "05.flac"
if says "06.flac"
if says "07.flac"
if says "08.flac"
if says "09.flac"
if says "10.flac"
if says "11.flac"
if says "12.flac"
if says "13.flac"
if says "14.flac"
if says "15.flac"
if says "16.flac"
if says "17.flac"
if says "18.flac"
if says "19.flac"
endlocal

[C:\Command\TCMD16x64]​

But when I uncomment the setdos line, the for loop terminates after just one iteration:

TCC 16.03.55 x64 Windows 7 [Version 6.1.7601]
Copyright 2014 JP Software Inc. All Rights Reserved
Registered to David Habermehl - 1 System License

[C:\Command\TCMD16x64]foo.btm *.flac
setlocal
setdos /c^@
for %k in (%1) do ( iff "foo" == "foo" then @ echo if says "%k" @ else @ echo else says "%k" @ endiff )
if says "01.flac"

[C:\Command\TCMD16x64]​

Question and possibly-useful data points:
  1. The first output shows that none of the filenames contain @, so why should the setdos command have an impact?
  2. The btm file with the uncommented setdos line behaves as expected with TCC 12.10.67 x64.
  3. The btm file with the uncommented setdos line behaves as expected with TCC 16.03.55 x64 if I remove the else clause!

TCC 16.03.55 x64 Windows 7 [Version 6.1.7601]
Copyright 2014 JP Software Inc. All Rights Reserved
Registered to David Habermehl - 1 System License

[C:\Command\TCMD16x64]foo.btm *.flac
setlocal
setdos /c^@
for %k in (%1) do ( iff "foo" == "foo" then @ echo if says "%k" )
if says "01.flac"
if says "02.flac"
if says "03.flac"
if says "04.flac"
if says "05.flac"
if says "06.flac"
if says "07.flac"
if says "08.flac"
if says "09.flac"
if says "10.flac"
if says "11.flac"
if says "12.flac"
if says "13.flac"
if says "14.flac"
if says "15.flac"
if says "16.flac"
if says "17.flac"
if says "18.flac"
if says "19.flac"
endlocal

[C:\Command\TCMD16x64]​

Any help will be very much appreciated.

Thanks,

David Habermehl
 

Attachments

#2
It's OK here.
Code:
v:\> type dumb.btm
echo on
setlocal
setdos /c%=@

for %k in (%1) do (
iff "foo" == "foo" then
  echo if says "%k"
else
  echo else says "%k"
endiff
)
endlocal
v:\> dumb.btm *.btm
setlocal
setdos /c^@
for %k in (%1) do ( iff "foo" == "foo" then @ echo if says "%k" @ else @ echo else says "%k" @ endiff )
if says "args.btm"
if says "args.u.btm"
if says "avtemp.btm"
if says "avtempee.btm"
if says "dumb.btm"
if says "dumb2.btm"
if says "escape.btm"
if says "iconshow.btm"
if says "ifftest.btm"
if says "plink.btm"
if says "regextest.btm"
if says "test.btm"
if says "uc.btm"
if says "uni.btm"
if says "w32tmparams.btm"
if says "w32tmparams17.btm"
if says "w32tmparamsx.btm"
endlocal