[Swift-user] Externally controlled loop
Carolyn Phillips
cphillips at mcs.anl.gov
Fri Aug 31 12:02:21 CDT 2012
Hello,
So I want to create an externally controlled loop, meaning, the number of times the loop repeats is determined by the output of a executable called within the loop. That output is written to a file so it can be read and checked. I am experimenting with getting a very rudimentary set up. Below you can see that I have two lines that determine if the iteration is done, one based on the variable "passes" and the other based on the variable "read passes" that is read from a file. The second does not work and throws a execution failed exception. Any advice on how to make this kind of structure work?
type file;
iterate passes {
# try writing the iteration to a log file
file passlog <"passes.log">;
passlog = writeData(passes);
# try reading from another log file
int value = readData("errorlog");
int readpasses = readData(passlog);
# Write to the Output Log
int i = 3;
tracef("%s: %i\n", "the value is", value);
tracef("%s: %i\n", "Iteration :", passes);
tracef("%s: %i\n", "Iteration Read :", readpasses);
#} until (readpasses == 2); # Determine if Done
} until (passes == 2); # Determine if Done
More information about the Swift-user
mailing list