PandA-2024.02
xml_script_command.cpp
Go to the documentation of this file.
1 /*
2  *
3  * _/_/_/ _/_/ _/ _/ _/_/_/ _/_/
4  * _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/
5  * _/_/_/ _/_/_/_/ _/ _/_/ _/ _/ _/_/_/_/
6  * _/ _/ _/ _/ _/ _/ _/ _/ _/
7  * _/ _/ _/ _/ _/ _/_/_/ _/ _/
8  *
9  * ***********************************************
10  * PandA Project
11  * URL: http://panda.dei.polimi.it
12  * Politecnico di Milano - DEIB
13  * System Architectures Group
14  * ***********************************************
15  * Copyright (C) 2004-2024 Politecnico di Milano
16  *
17  * This file is part of the PandA framework.
18  *
19  * The PandA framework is free software; you can redistribute it and/or modify
20  * it under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 3 of the License, or
22  * (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program. If not, see <http://www.gnu.org/licenses/>.
31  *
32  */
45 #include "exceptions.hpp"
46 
47 #include "DesignParameters.hpp"
48 #include <boost/algorithm/string/case_conv.hpp>
49 #include <boost/algorithm/string/trim.hpp>
50 
51 #include "xml_script_command.hpp"
52 #include <boost/algorithm/string/predicate.hpp>
53 #include <utility>
54 
56 
58 {
59  return true; // Condition ignored by default
60 }
61 
63 {
64  std::string name = element->get_name();
65  if(name == TAG_ENTRY)
66  {
67  return NODE_ENTRY;
68  }
69  else if(name == TAG_VARIABLE)
70  {
71  return NODE_VARIABLE;
72  }
73  else if(name == TAG_PARAMETER)
74  {
75  return NODE_PARAMETER;
76  }
77  else if(name == TAG_COMMAND)
78  {
79  return NODE_COMMAND;
80  }
81  else if(name == TAG_SHELL)
82  {
83  return NODE_SHELL;
84  }
85  else if(name == TAG_ITE_BLOCK)
86  {
87  return NODE_ITE_BLOCK;
88  }
89  else if(name == TAG_FOREACH)
90  {
91  return NODE_FOREACH;
92  }
93  else
94  {
95  return NODE_UNKNOWN;
96  }
97 }
98 
100 {
101  xml_script_node_t* node = nullptr;
102  std::string name = element->get_name();
103  if(name == TAG_ENTRY)
104  {
105  node = new xml_set_entry_t(element);
106  }
107  else if(name == TAG_VARIABLE)
108  {
109  node = new xml_set_variable_t(element);
110  }
111  else if(name == TAG_PARAMETER)
112  {
113  node = new xml_parameter_t(element);
114  }
115  else if(name == TAG_COMMAND)
116  {
117  node = new xml_command_t(element);
118  }
119  else if(name == TAG_SHELL)
120  {
121  node = new xml_shell_t(element);
122  }
123  else if(name == TAG_ITE_BLOCK)
124  {
125  node = new xml_ite_block_t(element);
126  }
127  else if(name == TAG_FOREACH)
128  {
129  node = new xml_foreach_t(element);
130  }
131  else
132  {
133  THROW_ERROR("Unhandled XML element named \"" + element->get_name() + "\"");
134  }
135  return node;
136 }
137 
138 bool xml_script_node_t::evaluate_condition(const std::string* condition)
139 {
140  if(!condition)
141  {
142  return false;
143  }
144 
145  if(condition->length() == 0)
146  {
147  return false;
148  }
149 
150  std::string trimmed = *condition;
151  boost::algorithm::trim(trimmed);
152 
153  if(trimmed == "\"\"")
154  {
155  return false;
156  }
157 
159  if(starts_with(trimmed, "${__"))
160  {
161  return false;
162  }
163 
164  auto length = static_cast<unsigned int>(trimmed.length());
165  if(length == 0)
166  {
167  return false;
168  }
169  try
170  {
171  if(std::stoull(trimmed) == 0)
172  {
173  return false;
174  }
175  else if(std::stoull(trimmed) == 1)
176  {
177  return true;
178  }
179  }
180  catch(const std::exception& ex)
181  {
182  } // trimmed contains no numbers
183 
184  std::string lowered = trimmed;
185  boost::algorithm::to_lower(lowered);
186  return lowered != "false";
187 }
188 
189 bool xml_script_node_t::evaluate_condition(const std::string* condition, const DesignParametersRef& dp)
190 {
191  if(!condition)
192  {
193  return true;
194  }
195  std::string trimmed = *condition;
196  boost::algorithm::trim(trimmed);
197  bool negate = false;
198  if(trimmed[0] == '!')
199  {
200  trimmed = trimmed.substr(1, trimmed.length());
201  negate = true;
202  }
203  if(trimmed[0] == '$')
204  {
205  std::string var;
206  std::string::size_type length = trimmed.length();
207  if(length > 7 && trimmed[1] == '{' && trimmed[length - 1] == '}')
208  {
209  var = trimmed.substr(4, length - 7);
210  }
211  else
212  {
213  var = trimmed.substr(3, length - 4);
214  }
215  if(var.length())
216  {
217  // Iterate trough the parameters map and compare the values
219  if(map.find(var) == map.end())
220  {
221  THROW_ERROR("variable " + var + " not configured");
222  }
223  for(const auto& it : map)
224  {
225  const std::string& name = it.first;
226  const std::string& value = it.second;
227  if(var == name)
228  {
229  return (negate ? !evaluate_condition(&value) : evaluate_condition(&value));
230  }
231  }
232  }
233  }
234 
235  // No parameters found, use basic evaluation
236  return evaluate_condition(condition);
237 }
238 
239 xml_set_entry_t::xml_set_entry_t(std::string _value, const std::string* _condition)
240  : xml_script_node_t(NODE_ENTRY), value(std::move(_value))
241 {
242  condition = _condition ? new std::string(*_condition) : nullptr;
243 }
244 
246 {
247  xml_attribute* a;
248 
249  condition = nullptr;
250 
251  a = element->get_attribute("value");
252  if(a)
253  {
254  value = a->get_value();
255  }
256  else
257  {
258  THROW_ERROR("Attribute \"value\" required for entry");
259  }
260 
261  a = element->get_attribute("condition");
262  if(a)
263  {
264  condition = new std::string(a->get_value());
265  }
266 }
267 
269 {
270  clean();
271 }
272 
274 {
275  delete condition;
276 
277  condition = nullptr;
278 }
279 
280 std::string xml_set_entry_t::get_xml_name() const
281 {
282  return TAG_ENTRY;
283 }
284 
286 {
287  auto* node = new xml_element(get_xml_name());
288  node->set_attribute("value", value);
289  if(condition)
290  {
291  node->set_attribute("condition", *condition);
292  }
293  return xml_nodeRef(node);
294 }
295 
297 {
298  return evaluate_condition(condition, dp);
299 }
300 
301 xml_set_variable_t::xml_set_variable_t(std::string _name, const std::string* _singleValue,
302  const std::string* _condition)
303  : xml_script_node_t(NODE_VARIABLE), name(std::move(_name))
304 {
305  singleValue = _singleValue ? new std::string(*_singleValue) : nullptr;
306  multiValues.clear();
307  condition = _condition ? new std::string(*_condition) : nullptr;
308 }
309 
311 {
312  xml_attribute* a;
313 
314  singleValue = nullptr;
315  multiValues.clear();
316  condition = nullptr;
317 
318  a = element->get_attribute("name");
319  if(a)
320  {
321  name = a->get_value();
322  }
323  else
324  {
325  THROW_ERROR("Attribute \"name\" must be defined");
326  }
327 
328  a = element->get_attribute("value");
329  if(a)
330  {
331  singleValue = new std::string(a->get_value());
332  }
333 
334  const xml_node::node_list& list = element->get_children();
335  for(const auto& l : list)
336  {
337  const xml_element* child = GetPointer<xml_element>(l);
338  if(child && child->get_name() == TAG_ENTRY)
339  {
341  multiValues.push_back(entry);
342  }
343  }
344  if(singleValue && !multiValues.empty())
345  {
346  THROW_ERROR("Only one between \"value\" and <entry> children can be defined");
347  }
348 
349  a = element->get_attribute("condition");
350  if(a)
351  {
352  condition = new std::string(a->get_value());
353  }
354 }
355 
357 {
358  clean();
359 }
360 
362 {
363  delete singleValue;
364  delete condition;
365 
366  singleValue = nullptr;
367  multiValues.clear();
368  condition = nullptr;
369 }
370 
372 {
373  return TAG_VARIABLE;
374 }
375 
377 {
378  auto* node = new xml_element(get_xml_name());
379  node->set_attribute("name", name);
380  if(singleValue)
381  {
382  node->set_attribute("value", *singleValue);
383  }
384  if(condition)
385  {
386  node->set_attribute("condition", *condition);
387  }
388  for(const auto& child : multiValues)
389  {
390  node->add_child_element(child->create_xml_node());
391  }
392  return xml_nodeRef(node);
393 }
394 
396 {
397  return evaluate_condition(condition, dp);
398 }
399 
400 xml_parameter_t::xml_parameter_t(const std::string* _name, const std::string* _singleValue,
401  const std::string* _condition, const std::string& _separator, bool _curlyBrackets)
402  : xml_script_node_t(NODE_PARAMETER)
403 {
404  name = name ? new std::string(*_name) : nullptr;
405  singleValue = _singleValue ? new std::string(*_singleValue) : nullptr;
406  multiValues.clear();
407  condition = _condition ? new std::string(*_condition) : nullptr;
408  separator = _separator;
409  curlyBrackets = _curlyBrackets;
410 }
411 
413 {
414  xml_attribute* a;
415 
416  name = nullptr;
417  singleValue = nullptr;
418  multiValues.clear();
419  condition = nullptr;
420  separator = " ";
421  curlyBrackets = false;
422 
423  a = element->get_attribute("name");
424  if(a)
425  {
426  name = new std::string(a->get_value());
427  }
428 
429  a = element->get_attribute("value");
430  if(a)
431  {
432  singleValue = new std::string(a->get_value());
433  }
434 
435  const xml_node::node_list& list = element->get_children();
436  for(const auto& l : list)
437  {
438  const xml_element* child = GetPointer<xml_element>(l);
439  if(child && child->get_name() == TAG_ENTRY)
440  {
442  multiValues.push_back(entry);
443  }
444  }
445  if(singleValue && !multiValues.empty())
446  {
447  THROW_ERROR("Only one between \"value\" and <entry> children can be defined");
448  }
449  if(!name && !singleValue && multiValues.empty())
450  {
451  THROW_ERROR("At least one among \"name\", \"value\" or <entry> children must be defined");
452  }
453 
454  a = element->get_attribute("condition");
455  if(a)
456  {
457  condition = new std::string(a->get_value());
458  }
459 
460  a = element->get_attribute("separator");
461  if(a)
462  {
463  separator = a->get_value();
464  }
465 
466  a = element->get_attribute("curly");
467  if(a)
468  {
469  std::string cond = a->get_value();
471  }
472 }
473 
475 {
476  clean();
477 }
478 
480 {
481  delete name;
482  delete singleValue;
483 
484  name = nullptr;
485  singleValue = nullptr;
486  multiValues.clear();
487 }
488 
489 std::string xml_parameter_t::get_xml_name() const
490 {
491  return TAG_PARAMETER;
492 }
493 
495 {
496  auto* node = new xml_element(get_xml_name());
497  if(name)
498  {
499  node->set_attribute("name", *name);
500  }
501  if(singleValue)
502  {
503  node->set_attribute("value", *singleValue);
504  }
505  if(condition)
506  {
507  node->set_attribute("condition", *condition);
508  }
509  if(curlyBrackets)
510  {
511  node->set_attribute("curly", "true");
512  }
513  for(const auto& child : multiValues)
514  {
515  node->add_child_element(child->create_xml_node());
516  }
517  return xml_nodeRef(node);
518 }
519 
521 {
522  return evaluate_condition(condition, dp);
523 }
524 
525 xml_command_t::xml_command_t(const std::string* _name, const std::string* _value, const std::string* _condition,
526  const std::string* _output)
527  : xml_script_node_t(NODE_COMMAND)
528 {
529  name = _name ? new std::string(*_name) : nullptr;
530  value = _value ? new std::string(*_value) : nullptr;
531  parameters.clear();
532  condition = _condition ? new std::string(*_condition) : nullptr;
533  output = _output ? new std::string(*_output) : nullptr;
534 }
535 
537 {
538  xml_attribute* a;
539 
540  name = nullptr;
541  value = nullptr;
542  parameters.clear();
543  condition = nullptr;
544  output = nullptr;
545 
546  a = element->get_attribute("name");
547  if(a)
548  {
549  name = new std::string(a->get_value());
550  }
551 
552  a = element->get_attribute("value");
553  if(a)
554  {
555  value = new std::string(a->get_value());
556  }
557 
558  const xml_node::node_list& list = element->get_children();
559  for(const auto& l : list)
560  {
561  const xml_element* child = GetPointer<xml_element>(l);
562  if(child && child->get_name() == TAG_PARAMETER)
563  {
565  parameters.push_back(param);
566  }
567  }
568 
569  a = element->get_attribute("condition");
570  if(a)
571  {
572  condition = new std::string(a->get_value());
573  }
574 
575  a = element->get_attribute("output");
576  if(a)
577  {
578  output = new std::string(a->get_value());
579  }
580 }
581 
583 {
584  clean();
585 }
586 
588 {
589  delete name;
590  delete value;
591  delete condition;
592  delete output;
593 
594  name = nullptr;
595  value = nullptr;
596  parameters.clear();
597  condition = nullptr;
598  output = nullptr;
599 }
600 
601 std::string xml_command_t::get_xml_name() const
602 {
603  return TAG_COMMAND;
604 }
605 
607 {
608  auto* node = new xml_element(get_xml_name());
609  if(name)
610  {
611  node->set_attribute("name", *name);
612  }
613  if(value)
614  {
615  node->set_attribute("value", *value);
616  }
617  if(condition)
618  {
619  node->set_attribute("condition", *condition);
620  }
621  if(output)
622  {
623  node->set_attribute("output", *output);
624  }
625  for(const auto& child : parameters)
626  {
627  node->add_child_element(child->create_xml_node());
628  }
629  return xml_nodeRef(node);
630 }
631 
633 {
634  return evaluate_condition(condition, dp);
635 }
636 
637 xml_shell_t::xml_shell_t(const std::string* _name, const std::string* _value, const std::string* _condition,
638  const std::string* _output)
639  : xml_script_node_t(NODE_SHELL)
640 {
641  name = _name ? new std::string(*_name) : nullptr;
642  value = _value ? new std::string(*_value) : nullptr;
643  parameters.clear();
644  condition = _condition ? new std::string(*_condition) : nullptr;
645  output = _output ? new std::string(*_output) : nullptr;
646 }
647 
649 {
650  xml_attribute* a;
651 
652  name = nullptr;
653  value = nullptr;
654  parameters.clear();
655  condition = nullptr;
656  output = nullptr;
657 
658  a = element->get_attribute("name");
659  if(a)
660  {
661  name = new std::string(a->get_value());
662  }
663 
664  a = element->get_attribute("value");
665  if(a)
666  {
667  value = new std::string(a->get_value());
668  }
669 
670  const xml_node::node_list& list = element->get_children();
671  for(const auto& l : list)
672  {
673  const xml_element* child = GetPointer<xml_element>(l);
674  if(child && child->get_name() == TAG_PARAMETER)
675  {
677  parameters.push_back(param);
678  }
679  }
680 
681  a = element->get_attribute("condition");
682  if(a)
683  {
684  condition = new std::string(a->get_value());
685  }
686 
687  a = element->get_attribute("output");
688  if(a)
689  {
690  output = new std::string(a->get_value());
691  }
692 }
693 
695 {
696  clean();
697 }
698 
700 {
701  delete name;
702  delete value;
703  delete condition;
704  delete output;
705 
706  name = nullptr;
707  value = nullptr;
708  parameters.clear();
709  condition = nullptr;
710  output = nullptr;
711 }
712 
713 std::string xml_shell_t::get_xml_name() const
714 {
715  return TAG_SHELL;
716 }
717 
718 xml_nodeRef xml_shell_t::create_xml_node() const
719 {
720  auto* node = new xml_element(get_xml_name());
721  if(name)
722  {
723  node->set_attribute("name", *name);
724  }
725  if(value)
726  {
727  node->set_attribute("value", *value);
728  }
729  if(condition)
730  {
731  node->set_attribute("condition", *condition);
732  }
733  if(output)
734  {
735  node->set_attribute("output", *output);
736  }
737  for(const auto& child : parameters)
738  {
739  node->add_child_element(child->create_xml_node());
740  }
741  return xml_nodeRef(node);
742 }
743 
745 {
746  return evaluate_condition(condition, dp);
747 }
748 
749 xml_ite_block_t::xml_ite_block_t(const std::string* _condition)
750  : xml_script_node_t(NODE_ITE_BLOCK), condition(_condition ? *_condition : "")
751 {
752  this->thenNodes.clear();
753  this->elseNodes.clear();
754 }
755 
757  : xml_script_node_t(NODE_ITE_BLOCK),
758  condition(element->get_attribute("condition") ? element->get_attribute("condition")->get_value() : "")
759 {
760  thenNodes.clear();
761  elseNodes.clear();
762 
763  bool thenFound = false, elseFound = false;
764 
765  const xml_node::node_list& list = element->get_children();
766  for(const auto& l : list)
767  {
768  const xml_element* child = GetPointer<xml_element>(l);
769  if(!child)
770  {
771  continue;
772  }
773  if(child->get_name() == "then")
774  {
775  if(!thenFound && !elseFound)
776  {
777  for(const auto& s : child->get_children())
778  {
779  const xml_element* el = GetPointer<xml_element>(s);
780  if(!el)
781  {
782  continue;
783  }
785  thenNodes.push_back(node);
786  thenFound = true;
787  }
788  }
789  else
790  {
791  THROW_ERROR("<then> already defined, or found after <else>");
792  }
793  }
794  else if(child->get_name() == "else")
795  {
796  if(!elseFound)
797  {
798  for(const auto& s : child->get_children())
799  {
800  const xml_element* el = GetPointer<xml_element>(s);
801  if(!el)
802  {
803  continue;
804  }
806  elseNodes.push_back(node);
807  elseFound = true;
808  }
809  }
810  else
811  {
812  THROW_ERROR("<else> already defined");
813  }
814  }
815  }
816 }
817 
819 {
820  clean();
821 }
822 
824 {
825  thenNodes.clear();
826  elseNodes.clear();
827 }
828 
829 std::string xml_ite_block_t::get_xml_name() const
830 {
831  return TAG_ITE_BLOCK;
832 }
833 
835 {
836  auto* node = new xml_element(get_xml_name());
837  node->set_attribute("condition", condition);
838  xml_element* thenElement = node->add_child_element("then");
839  for(const auto& child : thenNodes)
840  {
841  thenElement->add_child_element(child->create_xml_node());
842  }
843  xml_element* elseElement = node->add_child_element("else");
844  for(const auto& child : elseNodes)
845  {
846  elseElement->add_child_element(child->create_xml_node());
847  }
848  return xml_nodeRef(node);
849 }
850 
852 {
853  return evaluate_condition(&condition, dp);
854 }
855 
856 xml_foreach_t::xml_foreach_t(std::string _variable) : xml_script_node_t(NODE_FOREACH), variable(std::move(_variable))
857 {
858 }
859 
861 {
862  Nodes.clear();
863 
864  xml_attribute* a = element->get_attribute("variable");
865  THROW_ASSERT(a, "Error: the \"foreach\" block requires the definition of the variable");
866  variable = a->get_value();
867  const xml_node::node_list& list = element->get_children();
868  for(const auto& l : list)
869  {
870  const xml_element* child = GetPointer<xml_element>(l);
871  if(!child)
872  {
873  continue;
874  }
875 
876  const xml_node::node_list subscript = child->get_children();
877  for(const auto& s : subscript)
878  {
879  const xml_element* el = GetPointer<xml_element>(s);
880  if(el == nullptr)
881  {
882  continue;
883  }
884  auto nodeptr = xml_script_node_t::create(el);
885  THROW_ASSERT(nodeptr, "unexpected condition");
887  Nodes.push_back(node);
888  }
889  }
890 }
891 
893 {
894  clean();
895 }
896 
898 {
899  Nodes.clear();
900 }
901 
902 std::string xml_foreach_t::get_xml_name() const
903 {
904  return TAG_FOREACH;
905 }
906 
908 {
909  auto* node = new xml_element(get_xml_name());
911  return xml_nodeRef(node);
912 }
std::string * condition
std::string get_value() const
Get the value of this attribute.
virtual ~xml_script_node_t()
Command line parameter.
TVMValue param[3]
xml_parameter_t(const std::string *_name, const std::string *_singleValue, const std::string *_condition, const std::string &_separator, bool _curlyBrackets)
refcount< xml_set_entry_t > xml_set_entry_tRef
void clean() override
Cleans object attributes.
std::string * condition
xml_nodeRef create_xml_node() const override
Creates an XML node for polixml data structures.
std::string * value
std::string get_xml_name() const override
Gets the XML element name of this node type.
void clean() override
Cleans object attributes.
xml_set_entry_t(std::string _value, const std::string *_condition)
std::map< std::string, std::string > map_t
Parameters map type.
void clean() override
Cleans object attributes.
xml_nodeRef create_xml_node() const override
Creates an XML node for polixml data structures.
std::string get_xml_name() const override
Gets the XML element name of this node type.
std::vector< xml_parameter_tRef > parameters
~xml_command_t() override
xml_shell_t(const std::string *_name, const std::string *_value, const std::string *_condition, const std::string *_output)
xml_ite_block_t(const std::string *_condition)
exceptions managed by PandA
xml_nodeRef create_xml_node() const override
Creates an XML node for polixml data structures.
void clean() override
Cleans object attributes.
Definition of hash function for EdgeDescriptor.
Definition: graph.hpp:1321
xml_nodeRef create_xml_node() const override
Creates an XML node for polixml data structures.
~xml_foreach_t() override
std::vector< xml_script_node_tRef > Nodes
bool checkCondition(const DesignParametersRef &dp) const override
If the node has a compile-time condition, this method evaluates it.
std::string * name
std::vector< xml_script_node_tRef > elseNodes
void clean() override
Cleans object attributes.
static bool evaluate_condition(const std::string *condition)
Evaluates a string condition.
~xml_shell_t() override
void clean() override
Cleans object attributes.
#define TAG_COMMAND
If/Then/Else block, evaluated at compile-time.
bool starts_with(const std::string &str, const std::string &pattern)
map_t parameter_values
Map between the name of the parameter and the corresponding string-based value.
#define NOT_YET_IMPLEMENTED()
helper function to mark points not yet implemented
Definition: exceptions.hpp:305
xml_nodeRef create_xml_node() const override
Creates an XML node for polixml data structures.
std::string * name
~xml_set_entry_t() override
unsigned map[NUM_VERTICES]
Definition: bfs.c:12
std::string get_name() const
Get the name of this node.
Definition: xml_node.hpp:132
bool checkCondition(const DesignParametersRef &dp) const override
If the node has a compile-time condition, this method evaluates it.
This file contains the definition of the parameters for the synthesis tools.
xml_foreach_t(std::string _variable)
std::string * value
#define TAG_ITE_BLOCK
std::string get_xml_name() const override
Gets the XML element name of this node type.
bool checkCondition(const DesignParametersRef &dp) const override
If the node has a compile-time condition, this method evaluates it.
void clean() override
Cleans object attributes.
std::string * output
std::string get_xml_name() const override
Gets the XML element name of this node type.
bool checkCondition(const DesignParametersRef &dp) const override
If the node has a compile-time condition, this method evaluates it.
refcount< xml_script_node_t > xml_script_node_tRef
xml_attribute * get_attribute(const std::string &name) const
Obtain the attribute with this name.
std::list< xml_nodeRef > node_list
type for list of xml nodes
Definition: xml_node.hpp:90
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
Definition: exceptions.hpp:263
std::string * condition
static xml_script_node_t * create(const xml_element *element)
Creates a script node by parsing the XML element.
std::vector< xml_parameter_tRef > parameters
#define TAG_VARIABLE
Classes for handling configuration files.
bool checkCondition(const DesignParametersRef &dp) const override
If the node has a compile-time condition, this method evaluates it.
This is the abstract class which describes a generic synthesis script node, and some static helper me...
#define TAG_SHELL
bool checkCondition(const DesignParametersRef &dp) const override
If the node has a compile-time condition, this method evaluates it.
int el
Definition: adpcm.c:105
std::string get_xml_name() const override
Gets the XML element name of this node type.
std::string * singleValue
std::string * condition
std::string get_xml_name() const override
Gets the XML element name of this node type.
refcount< xml_parameter_t > xml_parameter_tRef
#define TAG_FOREACH
std::string value
xml_set_variable_t(std::string _name, const std::string *_singleValue, const std::string *_condition)
std::vector< xml_set_entry_tRef > multiValues
std::vector< xml_set_entry_tRef > multiValues
Variable assignment, either single value or multiple entries set.
xml_nodeRef create_xml_node() const override
Creates an XML node for polixml data structures.
xml_nodeRef create_xml_node() const override
Creates an XML node for polixml data structures.
Command line of the synthesis tool.
node_list const & get_children()
Obtain the list of child nodes.
Definition: xml_node.hpp:310
Command line of the native shell.
virtual bool checkCondition(const DesignParametersRef &dp) const
If the node has a compile-time condition, this method evaluates it.
#define TAG_PARAMETER
Foreach block, where the set of script nodes is applied to each parameter.
std::string * output
std::string get_xml_name() const override
Gets the XML element name of this node type.
xml_command_t(const std::string *_name, const std::string *_value, const std::string *_condition, const std::string *_output)
xml_element * add_child_element(const std::string &name)
Add a child element to this node.
Definition: xml_node.cpp:54
std::vector< xml_script_node_tRef > thenNodes
static xml_script_node_enum_t find_type(const xml_element *element)
Finds the type of an XML element.
String entry of a multiple values variable (set).
enum xml_script_node_enum_t { NODE_UNKNOWN=0, NODE_ENTRY=1, NODE_VARIABLE=2, NODE_PARAMETER=3, NODE_COMMAND=4, NODE_SHELL=5, NODE_ITE_BLOCK=6, NODE_FOREACH=7 } xml_script_node_enum_t
Node types.
#define TAG_ENTRY
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...
Definition: exceptions.hpp:289

Generated on Mon Feb 12 2024 13:02:56 for PandA-2024.02 by doxygen 1.8.13