JetCore/__for.cpp

31 lines
931 B
C++

#include "__for.h"
#include "Exception.h"
#include <iostream>
namespace jet {
__for::__for(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
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();
}
std::cout << "start: " << counter << "; end: " << end << "; step: " << step << std::endl;
for(double ix = counter; ix <= end; ix += step) {
if(nameDefined)
variables[variables["name"]] = ix;
processContainer(container);
container.reset();
}
}
}