JetCore/__for.cpp

30 lines
868 B
C++

#include "__for.h"
#include "Exception.h"
#include <iostream>
namespace jet {
__for::__for(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent) : Tag(in, parentOut, global, parent) {
double counter = 0.0f;
double end = 0.0f;
double step = 0.0f;
bool nameDefined = variableDefined("name");
if(variableDefined(coreutils::ZString("start"))) {
counter = variables["start"].asDouble();
}
if(variableDefined(coreutils::ZString("end"))) {
end = variables["end"].asDouble();
}
if(variableDefined(coreutils::ZString("step"))) {
step = variables["step"].asDouble();
}
for(double ix = counter; ix <= end; ix += step) {
if(nameDefined)
variables[variables["name"]] = ix;
processContainer(container);
container.reset();
}
}
}