Loop over an Empty File Does Not Produce an Error #233
-
Dear GROOPS Team, The topic of this message concerns the performance of the “LoopPrograms” program over an empty file. In the “Loop” class’ description of the GROOPS documentation, it is mentioned that when the “FileAscii” config element is selected the loop takes place over a list of strings included in the specified file. Alternatively, if the “ManualList” is selected, then the loop takes place over a list of strings which are specified by the user. A really nice feature of GROOPS which I have been using is to place the “LoopPrograms” program with the “ManualList” config element selected inside the “GroupPrograms” program where for the latter the “catchErrors” config element is specified as “< enabled >”. This way, I can overcome the potential problem of an empty manual list and continue with another loop/program specified in the “errorProgram”. I thought that the same performance would be achieved when using the “LoopPrograms” program with the “FileAscii” config element selected inside the “GroupPrograms” program. However, when an empty file is used, the “errorProgram” is not executed which in my opinion should be the case since the file does not contain any string. At the same time and as it is expected, the loop does not execute the program which is specified inside it. Attached you will find the “LoopOverEmptyFile.zip” file which includes the empty file “EmptyFile.txt” and the “LoopOverEmptyFile.xml” file which is a simple script I created so as to demonstrate the different performance when the loop takes place over an empty file versus an empty manual list. As you will see, for the case of the loop over the empty file neither the program specified inside the loop nor the program specified as “errorProgram” is executed; however, for the case of the loop over the empty manual list the “errorProgram” program is executed and the following message appears: "--- GroupPrograms (Check with an empty manual list) --- Is there any edit that should take place on the “source\config\config.cpp” and/or the “source\classes\loop\loopFileAscii.h” files so as for the loop to produce an error when an empty file is used or is there something which I have not understood correctly? It would be really useful if an error was triggered when an empty file is used. Thank you very much in advance for your time and looking forward to your feedback. Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi Grigorios, Sorry for my late answer. I think groops does what I would expect: I know of no programming language in which an empty loop generates an error. Creating an empty ManualList, on the other hand, is pointless because the result is known at startup. This should not actually be configurable in the GUI. If you want to change the source code you can add the line
in Alternatively, the behavior can also be imitated in the script: regards |
Beta Was this translation helpful? Give feedback.
Hi Grigorios,
Sorry for my late answer.
I think groops does what I would expect: I know of no programming language in which an empty loop generates an error. Creating an empty ManualList, on the other hand, is pointless because the result is known at startup. This should not actually be configurable in the GUI.
If you want to change the source code you can add the line
in
classes/loop/loopFileAscii.h
at the end of the constructor (near line 93).Alternatively, the behavior can also be imitated in the script:
Create a loop->ManualList and a loop->fileAscii in the global section.
Then loop the element
string
with loopfileAscii (set loop) and s…