Okay.
The code file is lectic.cc
#include <argp.h>
#include <cassert>
#include <cstdio>
#include <ext/hash_map>
#include <fstream>
#include <iostream>
#include <numeric>
#include <queue>
#include <vector>
#include "CompactReport.h"
#include "NumRuns.h"
#include "PredStats.h"
#include "Progress/Bounded.h"
#include "ReportReader.h"
#include "RunsDirectory.h"
#include "RunSet.h"
#include "OutcomeRunSets.h"
#include "SiteCoords.h"
#include "classify_runs.h"
#include "fopen.h"
#include "termination.h"
#include "utils.h"
using namespace std;
using __gnu_cxx::hash_map;
////////////////////////////////////////////////////////////////////////
//
// information about one interesting predicate
//
struct PredInfo
{
OutcomeRunSets tek;
OutcomeRunSets lek;
};
class PredInfos : public hash_map<PredCoords, PredInfo>
{
};
static PredInfos predInfos;
class Reader : public ReportReader
{
public:
Reader(Outcome, unsigned);
protected:
void handleSite(const SiteCoords &, vector<count_tp> &);
private:
void notice(const SiteCoords &coords, unsigned, bool) const;
const Outcome outcome;
const unsigned runId;
};
inline
Reader::Reader(Outcome outcome, unsigned runId)
: outcome(outcome),
runId(runId)
{
}
static void process_cmdline(int argc, char **argv)
{
static const argp_child children[] = {
{ &CompactReport::argp, 0, 0, 0 },
{ &NumRuns::argp, 0, 0, 0 },
{ &ReportReader::argp, 0, 0, 0 },
{ &RunsDirectory::argp, 0, 0, 0 },
{ 0, 0, 0, 0 }
};
static const argp argp = {
0, 0, 0, 0, children, 0, 0
};
argp_parse(&argp, argc, argv, 0, 0, 0);
};
int main(int argc, char** argv)
{
set_terminate_verbose();
process_cmdline(argc, argv);
classify_runs();
ofstream ofp("tek.txt");
ofstream tfp("lek.txt");
// interesting predicates in "preds.txt" order
typedef queue<const PredInfo *> InterestingPreds;
InterestingPreds interesting;
{
const unsigned numPreds = PredStats::count();
Progress::Bounded progress("reading interesting predicate list", numPreds);
FILE * const pfp = fopenRead(PredStats::filename);
pred_info pi;
while (read_pred_full(pfp, pi)) {
progress.step();
const PredInfo &info = predInfos[pi];
interesting.push(&info);
}
fclose(pfp);
}
[B] {
Progress::Bounded progress("computing tek lek", NumRuns::count());
for (unsigned runId = NumRuns::begin; runId < NumRuns::end; ++runId) {
progress.step();
Outcome outcome = 0;
if (is_srun[runId])
outcome = &OutcomeRunSets::success;
else if (is_frun[runId])
outcome = &OutcomeRunSets::failure;
else
continue;
Reader(outcome, runId).read(runId);
}
}
[/B] {
Progress::Bounded progress("printing tek and lek", predInfos.size());
while (!interesting.empty()) {
progress.step();
const PredInfo * const info = interesting.front();
ofp << info->tek ;
tfp << info->lek;
interesting.pop();
}
}
return 0;
}
Basically I am trying to understand some other people's code which is written in C++. This is basically a system which generates two files; tek.txt and lek.txt which are executed with 100 runs (100 test inputs). It generates 100 folder which have Outcome file and Label file.(I attached as folder 0, 1, 2). Supposed there are 100 of these folders with different values in these files. The code which generate these numbers is from lectic.cc.
However, I could not understand how these crunchy numbers are generated.
My initial guess is this function actually generated data for tek.txt and lek.txt.I do not understand how the numbers are generated especially with lek.txt ; the entry of "S: " is empty. Perhaps my understanding of the code is wrong. As what I understand so far, it first call cairns.cc file which gather information and do the counts in it.In this file, it has read_run function. In this function, I am not too sure how the while loop of
while (file >> runId && runId < numRuns) {
progress.stepTo(runId);
if (runId >= NumRuns::begin) {
bits[runId] = 1;
++count;
}
}
are doing. Does it means assigning value of 1 to every numRuns?
If that is the case, back in the file lectic.cc, every single is_srun[run_id] and is_frun[run_id] are always 1.
Perhaps its too vague after seeing the code, Do let me know because the original files are too large unless I can try upload in some server and you guys could download to see whole picture of it.
THanks.
you have not posted any code so how in the world do you expect anyone to tell you what's wrong ?