#include "printutils.h" #include #include #include #include #include #include namespace fs = boost::filesystem; #include "boosty.h" std::list print_messages_stack; OutputHandlerFunc *outputhandler = NULL; void *outputhandler_data = NULL; std::string OpenSCAD::debug(""); bool OpenSCAD::quiet = false; boost::circular_buffer lastmessages(5); void set_output_handler(OutputHandlerFunc *newhandler, void *userdata) { outputhandler = newhandler; outputhandler_data = userdata; } void print_messages_push() { print_messages_stack.push_back(std::string()); } void print_messages_pop() { std::string msg = print_messages_stack.back(); print_messages_stack.pop_back(); if (print_messages_stack.size() > 0 && !msg.empty()) { if (!print_messages_stack.back().empty()) { print_messages_stack.back() += "\n"; } print_messages_stack.back() += msg; } } void PRINT(const std::string &msg) { if (msg.empty()) return; if (print_messages_stack.size() > 0) { if (!print_messages_stack.back().empty()) { print_messages_stack.back() += "\n"; } print_messages_stack.back() += msg; } PRINT_NOCACHE(msg); } void PRINT_NOCACHE(const std::string &msg) { if (msg.empty()) return; if (boost::starts_with(msg, "WARNING") || boost::starts_with(msg, "ERROR")) { size_t i; for (i=0;i std::set printedDeprecations; void printDeprecation(const std::string &str) { if (printedDeprecations.find(str) == printedDeprecations.end()) { printedDeprecations.insert(str); std::string msg = "DEPRECATED: " + str; PRINT(msg); } } void resetPrintedDeprecations() { printedDeprecations.clear(); }