MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / parse_with_error

Method parse_with_error

Processor/Program.cpp:62–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void Program::parse_with_error(string filename)
63{
64 name = boost::filesystem::path(filename).stem().string();
65 ifstream pinp(filename);
66 if (pinp.fail())
67 throw file_error(filename);
68
69 try
70 {
71 parse(pinp);
72 }
73 catch (bytecode_error& e)
74 {
75 stringstream os;
76 os << "Cannot parse " << filename << " (" << e.what() << ")" << endl;
77 os << "Does the compiler version match the virtual machine? "
78 << "If in doubt, recompile the VM";
79 if (not OnlineOptions::singleton.executable.empty())
80 os << " using 'make " << OnlineOptions::singleton.executable << "'";
81 os << ".";
82 throw bytecode_error(os.str());
83 }
84
85 // compute hash
86 pinp.clear();
87 pinp.seekg(0);
88 Hash hasher;
89 while (pinp.peek(), !pinp.eof())
90 {
91 char buf[1024];
92 size_t n = pinp.readsome(buf, 1024);
93 hasher.update(buf, n);
94 }
95 hash = hasher.final().str();
96}
97
98void Program::parse(istream& s)
99{

Callers 1

generateMethod · 0.80

Calls 11

file_errorClass · 0.85
bytecode_errorClass · 0.85
eofMethod · 0.80
failMethod · 0.45
whatMethod · 0.45
emptyMethod · 0.45
strMethod · 0.45
clearMethod · 0.45
seekgMethod · 0.45
updateMethod · 0.45
finalMethod · 0.45

Tested by

no test coverage detected