implementing loops in callback

Marc dirix <[email protected]> Fri, 31 Mar 2017 14:40:25 +0000
Newsgroups gmane.comp.lang.pike.user
Message-ID <CAERi-x0qTuj2KYAdL4CDTydxeuSZ5RJ4jFQQkA0u4j6OcZGozg@mail.gmail.com>
Hello,

I am currently using pike for automating some testing procedure. The
testing procedure automatically covers looping over several measurement
parameters. An example is shown below.

In the current setup the actual test is executed by runnin a single process
on the host machine by Process.run(); In a new version the process will be
run on several machines, simultaneously. To do this I want the test to run
in callback mode, where each of the machines can return the test results
when they are ready (through http/json).

However, I'm in doubt how to approach the looping over the measurement
parameters can be coded effectively. Is it wise to create an array(mapping)
and have a callback function run over the array. Or should I create
multiple callback functions which call eachother.

What are the thoughts of more experienced pike programmers in this matter?

<code>
for(int nPos=(int)Config->turntable->PositionStart;nPos<=(int)
Config->turntable->PositionStop;nPos+=(int) Config->turntable->PositionStep)
{
TT->goPosition(nPos);
foreach(fading,int currfading)
{
MPE->setBypass(currfading);
for(float nAtt=(float)Config->mpe->AttenuatorStart;nAtt<=(float)
Config->mpe->AttenuatorStop;nAtt+=(float) Config->mpe->AttenuatorStep)
{
//write("Setting Attenuators to %0.2f\n",(float) nAtt);
foreach(direction,int dir)
{

for (int nRetry=0; nRetry < (int) Config->general->retry; nRetry++)
{
                                           iPerf->RunTest();
                                        }
                                }
                        }
               }
}
</code>