By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Fixed _DO_FILES and _DO_DIRS wrong

TCC 13.04.63 and 14.01.33 - WinXP SP3 - 32b

Executing DO d in fileset.

1/ _DO_FILES is not reset when a new DO command is executed
2/ _DO_FILES is incremented by 1 more than the number of times through the loop
3/ if fileset contains directories, they are counted in _DO_FILES and not in _DO_DIRS

Executing DO d in /s fileset. with many subdirectories, one without files, others with one file each:

_DO_DIRS remains zero!

Executing DO d in /a:-d /s fileset (same tree):

_DO_FILES counts directories even though they do not match the specifications

Not tested: behavior of _DO_FILES when members of fileset are excluded by range specification.

Documentation nits:
- %_do_dirs - explain what is meant by "traversed"
- %_do_files - explain that it means "directory entries processed", i.e., both files and directories
- mention that the loop control variable is a normal environment variable, any preexisting values overwritten on executing DO, and deleted when the DO is completed, but remains defined if the DO is exited by LEAVE or GOTO.

Suggested enhancements
- new internal variable: _do_count
this variable would be set to 0 when DO is entered, and incremented each time the body of the loop is executed, available as a counter within the DO loop and after it is completed.

Similar threads