diff --git a/src/cpp/DSP_DOT.cpp b/src/cpp/DSP_DOT.cpp index d254c9e3d96398bd337aecc847554d1b8ea58bd0..5e7e4794389e7931b353a3e8e48e6eb46503595b 100644 --- a/src/cpp/DSP_DOT.cpp +++ b/src/cpp/DSP_DOT.cpp @@ -22,7 +22,7 @@ const vector<string> DSP::DOT_colors = #ifdef __DEBUG__ string DSP::u::Splitter::GetComponentNodeParams_DOTfile(void) { - GetComponentNodeParams_DOTfile(); + return GetComponentNodeParams_DOTfile(); } string DSP::u::Splitter::GetComponentNodeParams_DOTfile(const string &leading_space) { @@ -236,7 +236,7 @@ string DSP::Component::GetComponentNodeParams_DOTfile(void) { * -# copy string segment into output buffer. * . */ -string DSP::Component::GetHtmlNodeLabel_DOTfile(const unsigned long &no_of_inputs, const unsigned long &no_of_outputs, const string &node_name, const string &leading_space) +string DSP::Component::GetHtmlNodeLabel_DOTfile(const unsigned long &no_of_inputs, const unsigned long &no_of_outputs, const string &node_name, const string &leading_space, const unsigned int &border_width) { string tempName; unsigned int ind; @@ -264,7 +264,7 @@ string DSP::Component::GetHtmlNodeLabel_DOTfile(const unsigned long &no_of_input unsigned long no_of_columns_per_output = no_of_html_columns / tmp_no_of_outputs; // https://graphviz.org/doc/info/shapes.html - text_buffer << "label=<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\">" << std::endl; + text_buffer << "label=<<TABLE BORDER=\"" << border_width << "\" CELLBORDER=\"1\" CELLSPACING=\"0\">" << std::endl; if (no_of_inputs > 0) { @@ -358,7 +358,7 @@ string DSP::Component::GetComponentNodeParams_DOTfile(const string &leading_spac text_buffer << "["; - text_buffer << GetHtmlNodeLabel_DOTfile(tmp_no_of_inputs, tmp_no_of_outputs, GetName(), leading_space); + text_buffer << GetHtmlNodeLabel_DOTfile(tmp_no_of_inputs, tmp_no_of_outputs, GetName(), leading_space, 0); if (Convert2ClockTrigger() != NULL) { @@ -716,211 +716,42 @@ void DSP::Component::ComponentToDOTfile(std::ofstream &dot_plik, // Returns macro node parames used in DOTfile string DSP::Macro::GetMacroNodeParams_DOTfile() { - stringstream params_ss; - string tempName; - string label; - unsigned int ind; - - tempName = GetName(); - if (tempName.length() == 0) - tempName = "NONAME"; - - /* - mixed_2 [label="{{<in0> in0 | <in> in1 | DDScos | {<out0> out0 | <out1> out1}}"]; - mixed_2[shape=record,color=red]; - */ - params_ss << "[label=\"{"; - - if (NoOfInputs > 0) - { - params_ss << "{"; - for (ind =0; ind < NoOfInputs; ind++) - { - if (ind == 0) - params_ss << "<in" << ind + 1 << "> "; - else - params_ss << " | <in" << ind + 1 << "> "; - } - params_ss << "} | "; - } - // prepare label - label = ""; - for (ind = 0; ind < tempName.length(); ind++) - { - switch (tempName[ind]) - { - case '<': - label += "<"; - break; - case '>': - label += ">"; - break; - case '"': - label += """; - break; - case '&': - label += "&"; - break; - case ' ': - case '{': - case '}': - case '|': - label += '\\'; - label += tempName[ind]; - break; - default: - label += tempName[ind]; - break; - } - } - params_ss << label; + stringstream text_buffer; - if (NoOfOutputs > 0) - { - params_ss << " | {"; - for (ind =0; ind < NoOfOutputs; ind++) - { - if (ind == 0) - params_ss << "<out" << ind + 1 << "> "; - else - params_ss << " | <out" << ind + 1 << "> "; - } - params_ss << "}"; - } - params_ss << "}\",shape=record,penwidth=4.0]"; + text_buffer << "["; + + string leading_space = " "; + text_buffer << DSP::Component::GetHtmlNodeLabel_DOTfile(NoOfInputs, NoOfOutputs, GetName(), leading_space, 3); + + text_buffer << ", color=blue]"; // shape=record, penwidth=4.0]"; - return params_ss.str(); + return text_buffer.str(); } string DSP::Macro::GetMacroInputNodeParams_DOTfile() { - stringstream params_ss; - string tempName; - string label; - unsigned int ind; - - tempName = MacroInput_block->GetName(); - if (tempName.length() == 0) - tempName = "NONAME"; - - /* - mixed_2 [label="{{<in0> in0 | <in> in1 | DDScos | {<out0> out0 | <out1> out1}}"]; - mixed_2[shape=record,color=red]; - */ - params_ss << "[label=\"{"; - - // prepare label - label = ""; - for (ind = 0; ind < tempName.length(); ind++) - { - switch (tempName[ind]) - { - case '<': - label += "<"; - break; - case '>': - label += ">"; - break; - case '"': - label += """; - break; - case '&': - label += "&"; - break; - case ' ': - case '{': - case '}': - case '|': - label += '\\'; - label += tempName[ind]; - break; - default: - label += tempName[ind]; - break; - } - } - params_ss << label; + stringstream text_buffer; - //MacroInput->NoOfOutputs == NoOfInputs - if (MacroInput_block->NoOfOutputs > 0) - { - params_ss << " | {"; - for (ind =0; ind < MacroInput_block->NoOfOutputs; ind++) - { - if (ind == 0) - params_ss << "<out" << ind + 1 << "> "; - else - params_ss << " | <out" << ind + 1 << "> "; - } - params_ss << "}"; - } - params_ss << "}\",shape=record,penwidth=4.0]"; + text_buffer << "["; + + string leading_space = " "; + text_buffer << DSP::Component::GetHtmlNodeLabel_DOTfile(0, MacroInput_block->NoOfOutputs, MacroInput_block->GetName(), leading_space, 3); + + text_buffer << ", color=blue]"; // shape=record, penwidth=4.0]"; - return params_ss.str(); + return text_buffer.str(); } string DSP::Macro::GetMacroOutputNodeParams_DOTfile() { stringstream text_buffer; - string tempName; - string temp_text; - string label; - unsigned int ind; - - tempName = MacroOutput_block->GetName(); - if (tempName.length() == 0) - tempName = "NONAME"; - - /* - mixed_2 [label="{{<in0> in0 | <in> in1 | DDScos | {<out0> out0 | <out1> out1}}"]; - mixed_2[shape=record,color=red]; - */ - text_buffer << "[label=\"{"; - - // NoOfOutputs == MacroOutput->NoOfInputs - if (MacroOutput_block->NoOfInputs > 0) - { - text_buffer << "{"; - for (ind =0; ind < MacroOutput_block->NoOfInputs; ind++) - { - if (ind == 0) - text_buffer << "<in" << ind + 1 << "> "; - else - text_buffer << " | <in" << ind + 1 << "> "; - } - text_buffer << "} | "; - } - // prepare label - label = ""; - for (ind = 0; ind < tempName.length(); ind++) - { - switch (tempName[ind]) - { - case '<': - label += "<"; - break; - case '>': - label += ">"; - break; - case '"': - label += """; - break; - case '&': - label += "&"; - break; - case ' ': - case '{': - case '}': - case '|': - label += '\\'; - label += tempName[ind]; - break; - default: - label += tempName[ind]; - break; - } - } - text_buffer << label << "}\",shape=record,penwidth=4.0]"; + + text_buffer << "["; + + string leading_space = " "; + text_buffer << DSP::Component::GetHtmlNodeLabel_DOTfile(MacroOutput_block->NoOfInputs, 0, MacroOutput_block->GetName(), leading_space, 3); + + text_buffer << ", color=blue]"; // shape=record, penwidth=4.0]"; return text_buffer.str(); } @@ -1354,10 +1185,10 @@ void DSP::Component::ComponentToDOTfile(std::ofstream &dot_plik, /////////////////////////////// macro_name = GetMacroName_DOTfile(); - dot_plik << " " << macro_name << " " << GetMacroNodeParams_DOTfile() << ";" << std::endl; + dot_plik << " " << macro_name << " " << GetMacroNodeParams_DOTfile() << ";" << std::endl; /////////////////////////////// - // Zdefiniuj po��czenia wychodz�ce + // Define connections /////////////////////////////// MacroEdgesToDOTfile(dot_plik, macro_name, DrawnMacro); } @@ -1375,7 +1206,7 @@ void DSP::Component::ComponentToDOTfile(std::ofstream &dot_plik, // draw macro output component_name = MacroOutput_block->GetComponentName_DOTfile(); - dot_plik << " " << component_name << " " << GetMacroOutputNodeParams_DOTfile() << ";" << std::endl; + dot_plik << " " << component_name << " " << GetMacroOutputNodeParams_DOTfile() << ";" << std::endl; MacroOutputEdgesToDOTfile(dot_plik, component_name, DrawnMacro); } diff --git a/src/include/DSP_lib.h b/src/include/DSP_lib.h index b858e21f5cea68f41f6e0627ce2e523e1778005b..85e18e609250f6b0da10917e393977921123acb6 100644 --- a/src/include/DSP_lib.h +++ b/src/include/DSP_lib.h @@ -11,7 +11,7 @@ #define DSP_VER_MAJOR 0 #define DSP_VER_MINOR 20 -#define DSP_VER_BUILD 12 // !!! without zeroes before, else this will be treated as octal number +#define DSP_VER_BUILD 13 // !!! without zeroes before, else this will be treated as octal number #define DSP_VER_YEAR 2023 #define DSP_VER DSP_VER_MAJOR.DSP_VER_MINOR.DSP_VER_BUILD diff --git a/src/include/DSP_modules.h b/src/include/DSP_modules.h index 275877902a7c53acf783caca475ad8e90c74ea9e..2e0dd13f74a9e157058ce0e408814660ecd33183 100644 --- a/src/include/DSP_modules.h +++ b/src/include/DSP_modules.h @@ -1005,7 +1005,7 @@ class DSP::Component : public virtual DSP::name, public DSP::_connect_class /*! generates component HMTL label and shape for DOT */ - static string GetHtmlNodeLabel_DOTfile(const unsigned long &no_of_inputs, const unsigned long &no_of_outputs, const string &node_name, const string &leading_space); + static string GetHtmlNodeLabel_DOTfile(const unsigned long &no_of_inputs, const unsigned long &no_of_outputs, const string &node_name, const string &leading_space, const unsigned int &border_width); //! Returns component node parameters used in DOTfile virtual string GetComponentNodeParams_DOTfile(const string &leading_space); @@ -1759,6 +1759,8 @@ class DSP::Macro : public virtual DSP::name #ifdef __DEBUG__ friend void DSP::Component::ComponentEdgesToDOTfile(std::ofstream &, const string &, vector<bool> &, vector<DSP::Macro_ptr> &, DSP::Macro_ptr, unsigned int); + friend string DSP::Component::GetHtmlNodeLabel_DOTfile(const unsigned long &, const unsigned long &, + const string &, const string &, const unsigned int &); #endif private: