MCPcopy Create free account
hub / github.com/SoarGroup/Soar / DoPrint

Method DoPrint

Core/CLI/src/cli_print.cpp:713–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711}
712
713bool CommandLineInterface::DoPrint(PrintBitset options, int depth, const std::string* pArg)
714{
715 agent* thisAgent = m_pAgentSML->GetSoarAgent();
716 if (depth < 0)
717 {
718 depth = thisAgent->default_wme_depth;
719 }
720
721 if (options.test(PRINT_STACK))
722 {
723 // if neither states option nor operators option are set, set them both
724 if (!options.test(PRINT_STATES) && !options.test(PRINT_OPERATORS))
725 {
726 options.set(PRINT_STATES);
727 options.set(PRINT_OPERATORS);
728 }
729
730 print_stack_trace(thisAgent, options.test(PRINT_STATES), options.test(PRINT_OPERATORS));
731 return true;
732 }
733
734 // Cache the flags since it makes function calls huge
735 bool intern = options.test(PRINT_INTERNAL);
736 bool tree = options.test(PRINT_TREE);
737 bool filename = options.test(PRINT_FILENAME);
738 bool full = options.test(PRINT_FULL) || intern; // internal implies full
739 bool exact = options.test(PRINT_EXACT);
740
741 if (pArg)
742 {
743 // Default with arg is full print
744 full = !options.test(PRINT_NAME);
745
746 // Watch out, this case handles all args identifier/pattern/timetag/production_name
747 m_VarPrint = options.test(PRINT_VARPRINT); // This is a member because it affects the print callback.
748 print_symbol(thisAgent, pArg->c_str(), filename, intern, tree, full, depth, exact);
749 m_VarPrint = false;
750 return true;
751 }
752
753 // Print all productions if there are no other production flags set
754 if (options.test(PRINT_ALL) ||
755 (!options.test(PRINT_CHUNKS) &&
756 !options.test(PRINT_DEFAULTS) &&
757 !options.test(PRINT_JUSTIFICATIONS) &&
758 !options.test(PRINT_USER) &&
759 !options.test(PRINT_RL) &&
760 !options.test(PRINT_TEMPLATE)))
761 {
762 options.set(PRINT_CHUNKS);
763 options.set(PRINT_DEFAULTS);
764 options.set(PRINT_JUSTIFICATIONS);
765 options.set(PRINT_USER);
766 //options.set(PRINT_RL); // these aren't really a different "type", it's just extra data
767 options.set(PRINT_TEMPLATE);
768 }
769
770 if (options.test(PRINT_CHUNKS))

Callers 1

ParseMethod · 0.45

Calls 5

print_symbolFunction · 0.85
print_rl_rulesFunction · 0.85
print_stack_traceFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected