MCPcopy Create free account
hub / github.com/RischardV/emoji-shellcoding / print_block

Function print_block

block/block.cpp:300–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300__attribute__((unused))
301static void print_block(const Block &block)
302{
303 const Instruction &goal = block.goal;
304 const Bytes &bytes = goal.bytes();
305 size_t goal_size = goal.size();
306
307 std::cout << KBLD "PRINT BLOCK " << bytes << KRST << std::endl;
308
309 if (block.is_sequence) {
310 std::cout << "!!!SEQUENCE " << bytes << std::endl;
311 }
312
313 for (size_t i=0; i<=goal_size; i++) {
314 Bytes buf_left = Bytes(bytes.begin(), bytes.begin() + i);
315 Bytes buf_right = Bytes(bytes.begin() + i, bytes.end());
316 const bool &prefix = block.prefix[i];
317 const bool &suffix = block.suffix[i];
318 const BlockList &prev = block.prev[i];
319 const BlockList &next = block.next[i];
320
321 if (!block.is_good(i)) {
322 std::cout << KRED "FAIL FOR " KRST << bytes << " split as " << buf_left << " | " << buf_right
323 << " suffix:" << suffix << " prefix:" << prefix
324 << " prev:" << prev.size() << " next:" << next.size() << std::endl;
325 } else {
326 std::cout << KGRN "GOOD FOR " KRST << bytes << " split as " << buf_left << " | " << buf_right
327 << " suffix:" << suffix << " prefix:" << prefix
328 << " prev:" << prev.size() << " next:" << next.size() << std::endl;
329
330 for (auto const& [key, seq] : sequences) {
331 if ((i > 0) && is_bytes_suffix(buf_left, key)) {
332 std::cout << "%%%%%%S" << std::endl;
333 std::cout << " " << Bytes(key.begin(), key.end() - buf_left.size())
334 << " <before land>" << std::endl;
335 }
336 }
337
338 for (const auto &instrs: prev) {
339 std::cout << "%%%%%%p" << std::endl;
340 for (const auto &instr: instrs) {
341 std::cout << " " << instr.bytes() << " " << instr.text() << std::endl;
342 }
343 }
344
345 std::cout << "========" << std::endl;
346 std::cout << "OUR GOAL " << bytes << " " << goal.text() << std::endl;
347 std::cout << "========" << std::endl;
348
349 if (!goal.is_jump()) {
350 for (const auto &instrs: next) {
351 for (const auto &instr: instrs) {
352 std::cout << " " << instr.bytes() << " " << instr.text() << std::endl;
353 }
354 std::cout << "%%%%%%n" << std::endl;
355 }
356 } else {
357 std::cout << "jump..." << std::endl;

Callers 1

mainFunction · 0.85

Calls 4

is_bytes_suffixFunction · 0.85
sizeMethod · 0.80
is_goodMethod · 0.80
is_jumpMethod · 0.80

Tested by

no test coverage detected