Commit aed804ef authored by Tarun Prabhu's avatar Tarun Prabhu

Fixed some bugs in the parsers. A full features and desires test now works....

Fixed some bugs in the parsers. A full features and desires test now works. There are stil some extension support which needs to be added to ptopgen.
parent 308589d5
......@@ -36,34 +36,34 @@ class annotate_rspec : public annotate
~annotate_rspec () { ; }
// Annotates nodes and direct links in the rspec
void annotate_element(const char* v_name, const char* p_name);
virtual void annotate_element(const char* v_name, const char* p_name);
// Annotates intraswitch and interswitch links in the rspec
void annotate_element(const char* v_name,
std::list<const char*>* links);
virtual void annotate_element(const char* v_name,
std::list<const char*>* links);
// Annotate a trivial link
void annotate_element(const char* v_name);
virtual void annotate_element(const char* v_name);
// Annotates an interface element on a link
void annotate_interface (const xercesc::DOMElement* plink,
const xercesc::DOMElement* vlink,
int interface_number,
bool is_trivial_link);
virtual void annotate_interface (const xercesc::DOMElement* plink,
const xercesc::DOMElement* vlink,
int interface_number,
bool is_trivial_link);
// Annotates an interface element on a non-trivial link
void annotate_interface (const xercesc::DOMElement* plink,
const xercesc::DOMElement* vlink,
int interface_number);
virtual void annotate_interface (const xercesc::DOMElement* plink,
const xercesc::DOMElement* vlink,
int interface_number);
// Annotates an interface element on a trivial link
void annotate_interface (const xercesc::DOMElement* vlink,
int interface_number);
virtual void annotate_interface (const xercesc::DOMElement* vlink,
int interface_number);
// Creates a hop from a switch till the next end point.
// Adds the hop to the vlink
// Returns the hop element that was created
xercesc::DOMElement*
virtual xercesc::DOMElement*
create_component_hop (const xercesc::DOMElement* plink,
xercesc::DOMElement* vlink,
int endpoint_interface,
......@@ -72,40 +72,40 @@ class annotate_rspec : public annotate
// Creates a component_hop for a trivial link
// Adds the hop to the vlink
// Returns the hop element that was created
xercesc::DOMElement* create_component_hop (xercesc::DOMElement* vlink);
virtual xercesc::DOMElement* create_component_hop (xercesc::DOMElement* vlink);
// If the interface is the end point of a link/path,
// add two additional attributes to it
void set_interface_as_link_endpoint (xercesc::DOMElement* interface,
const char* virtual_node_id,
const char* virtual_interface_id);
virtual void set_interface_as_link_endpoint (xercesc::DOMElement* interface,
const char* virtual_node_id,
const char* virtual_interface_id);
// Finds the next link in the path returned by assign
xercesc::DOMElement* find_next_link_in_path
virtual xercesc::DOMElement* find_next_link_in_path
(xercesc::DOMElement *prev,
std::list<const char*>* links);
// Copies the component spec from the source to the destination
void copy_component_spec(const xercesc::DOMElement* src,
xercesc::DOMElement* dst);
virtual void copy_component_spec(const xercesc::DOMElement* src,
xercesc::DOMElement* dst);
// Copies the component hop from the auto-generated link
// to the requested link
void copy_component_hop(xercesc::DOMElement* requested_link,
xercesc::DOMElement* component_hop);
virtual void copy_component_hop(xercesc::DOMElement* requested_link,
xercesc::DOMElement* component_hop);
// Checks if the link contains an interface with
// virtual_interface_id = id
bool has_interface_with_id (std::string link_id, std::string id);
virtual bool has_interface_with_id (std::string link_id, std::string id);
// Removes all extra tags and generated elements from the XML document
void cleanup ();
virtual void cleanup ();
// Checks whether an element of type tag
// with attr_name = attr_value is a generated element
bool is_generated_element (const char* tag,
const char* attr_name,
const char* attr_value);
virtual bool is_generated_element (const char* tag,
const char* attr_name,
const char* attr_value);
};
#endif //for __ANNOTATE_RSPEC_H
......
......@@ -30,7 +30,6 @@ extern DOMElement* request_root;
extern map<string, DOMElement*>* advertisement_elements;
XERCES_CPP_NAMESPACE_USE
using namespace std;
annotate_rspec_v2 :: annotate_rspec_v2 ()
......@@ -86,7 +85,10 @@ void annotate_rspec_v2::annotate_element (const char* v_name, const char* p_name
if (vnode != NULL) {
if (!vnode->hasAttribute(XStr("generated_by_assign").x())) {
DOMElement* pnode = (this->physical_elements->find(p_name))->second;
copy_component_spec(pnode, vnode);
vnode->setAttribute(XStr("component_id").x(),
pnode->getAttribute(XStr("component_id").x()));
vnode->setAttribute(XStr("component_manager_id").x(),
pnode->getAttribute(XStr("component_manager_id").x()));
}
}
else {
......
......@@ -14,6 +14,7 @@
#define __ANNOTATE_RSPEC_V2_H
#include "annotate.h"
#include "annotate_rspec.h"
#include <list>
#include <map>
......@@ -23,7 +24,7 @@
#include <xercesc/dom/DOM.hpp>
class annotate_rspec_v2 : public annotate
class annotate_rspec_v2 : public annotate_rspec
{
private:
// Enumeration of which interface in a hop
......
......@@ -17,7 +17,7 @@ XERCES_CPP_NAMESPACE_USE
using namespace std;
using namespace rspec_emulab_extension;
emulab_operator emulab_extensions_parser::readOperator(DOMElement* tag)
emulab_operator emulab_extensions_parser::readOperator(const DOMElement* tag)
{
struct emulab_operator op = { "", NORMAL_OPERATOR };
if (this->hasAttribute(tag, "global_operator")) {
......@@ -32,10 +32,11 @@ emulab_operator emulab_extensions_parser::readOperator(DOMElement* tag)
}
vector<struct fd>
emulab_extensions_parser::readAllFeaturesDesires (DOMElement* elem)
emulab_extensions_parser::readFeaturesDesires (const DOMElement* ele, int& count)
{
DOMNodeList* fdNodes = elem->getElementsByTagName(XStr("emulab:fd").x());
vector<struct fd> fds;
DOMNodeList* fdNodes = ele->getElementsByTagName(XStr("emulab:fd").x());
count = fdNodes->getLength();
for (int i = 0; i < fdNodes->getLength(); i++) {
fds.push_back(this->readFeatureDesire
(dynamic_cast<DOMElement*>(fdNodes->item(i))));
......@@ -43,7 +44,7 @@ emulab_extensions_parser::readAllFeaturesDesires (DOMElement* elem)
return fds;
}
struct fd emulab_extensions_parser::readFeatureDesire (DOMElement* tag)
struct fd emulab_extensions_parser::readFeatureDesire (const DOMElement* tag)
{
struct fd fdObject = {
this->getAttribute(tag, "name"),
......@@ -55,8 +56,8 @@ struct fd emulab_extensions_parser::readFeatureDesire (DOMElement* tag)
return fdObject;
}
vector<struct property> emulab_extensions_parser::readAllProperties
(DOMElement* elem)
vector<struct property> emulab_extensions_parser::readProperties
(const DOMElement* elem)
{
DOMNodeList* propNodes = elem->getElementsByTagName(XStr("property").x());
vector<struct property> properties;
......@@ -67,7 +68,7 @@ vector<struct property> emulab_extensions_parser::readAllProperties
return properties;
}
struct property emulab_extensions_parser::readProperty (DOMElement* tag)
struct property emulab_extensions_parser::readProperty (const DOMElement* tag)
{
struct property propertyObject = {
this->getAttribute(tag, "property_name"),
......@@ -80,7 +81,7 @@ struct property emulab_extensions_parser::readProperty (DOMElement* tag)
return propertyObject;
}
struct hardness emulab_extensions_parser::readHardness (DOMElement* tag)
struct hardness emulab_extensions_parser::readHardness (const DOMElement* tag)
{
struct hardness hardnessObject;
if (this->hasChild(tag, "hard")) {
......@@ -97,7 +98,7 @@ struct hardness emulab_extensions_parser::readHardness (DOMElement* tag)
}
vector<struct vclass>
emulab_extensions_parser::readAllVClasses (DOMElement* elem)
emulab_extensions_parser::readAllVClasses (const DOMElement* elem)
{
DOMNodeList* vclassNodes
= elem->getElementsByTagName(XStr("emulab:vclass").x());
......@@ -110,7 +111,7 @@ emulab_extensions_parser::readAllVClasses (DOMElement* elem)
return vclasses;
}
struct vclass emulab_extensions_parser::readVClass (DOMElement* tag)
struct vclass emulab_extensions_parser::readVClass (const DOMElement* tag)
{
struct vclass vclassObject = {
this->getAttribute(tag, "name"),
......@@ -120,7 +121,7 @@ struct vclass emulab_extensions_parser::readVClass (DOMElement* tag)
return vclassObject;
}
string emulab_extensions_parser::readTypeSlots (DOMElement* tag)
string emulab_extensions_parser::readTypeSlots (const DOMElement* tag)
{
DOMNodeList* typeSlotsNodes
= tag->getElementsByTagName(XStr("emulab:node_type").x());
......@@ -131,7 +132,7 @@ string emulab_extensions_parser::readTypeSlots (DOMElement* tag)
return (this->getAttribute(typeSlotsNode, "type_slots"));
}
bool emulab_extensions_parser::readStaticType (DOMElement* tag)
bool emulab_extensions_parser::readStaticType (const DOMElement* tag)
{
DOMNodeList* typeSlotsNodes
= tag->getElementsByTagName(XStr("emulab:node_type").x());
......
......@@ -80,28 +80,28 @@ namespace rspec_emulab_extension {
class emulab_extensions_parser : public rspec_parser_helper {
private:
int type;
struct emulab_operator readOperator(xercesc::DOMElement* tag);
struct hardness readHardness (xercesc::DOMElement* tag);
struct emulab_operator readOperator(const xercesc::DOMElement* tag);
struct hardness readHardness (const xercesc::DOMElement* tag);
public:
// Constructor
emulab_extensions_parser(int type) { this->type = type; }
// Functions
std::vector<struct fd> readAllFeaturesDesires
(xercesc::DOMElement* ele);
struct fd readFeatureDesire (xercesc::DOMElement* tag);
struct node_flags readNodeFlag (xercesc::DOMElement* tag);
struct link_flags readLinkFlag (xercesc::DOMElement* tag);
std::vector<struct property> readAllProperties
(xercesc::DOMElement* elem);
struct property readProperty (xercesc::DOMElement* tag);
std::vector<struct vclass> readAllVClasses (xercesc::DOMElement*);
struct vclass readVClass (xercesc::DOMElement* tag);
std::string readAssignedTo (xercesc::DOMElement* tag);
std::string readHintTo (xercesc::DOMElement* tag);
std::string readTypeSlots (xercesc::DOMElement* tag);
bool readStaticType (xercesc::DOMElement* tag);
std::vector<struct fd> readFeaturesDesires (const xercesc::DOMElement*,
int&);
struct fd readFeatureDesire (const xercesc::DOMElement* tag);
struct node_flags readNodeFlag (const xercesc::DOMElement* tag);
struct link_flags readLinkFlag (const xercesc::DOMElement* tag);
std::vector<struct property> readProperties
(const xercesc::DOMElement* elem);
struct property readProperty (const xercesc::DOMElement* tag);
std::vector<struct vclass> readAllVClasses (const xercesc::DOMElement*);
struct vclass readVClass (const xercesc::DOMElement* tag);
std::string readAssignedTo (const xercesc::DOMElement* tag);
std::string readHintTo (const xercesc::DOMElement* tag);
std::string readTypeSlots (const xercesc::DOMElement* tag);
bool readStaticType (const xercesc::DOMElement* tag);
std::vector<struct type_limit> readTypeLimits(const xercesc::DOMElement* tag,
int& count);
};
......
......@@ -225,15 +225,7 @@ bool populate_nodes(DOMElement *root,
continue;
}
bool isAvailable;
string available = rspecParser->readAvailable(elt, isAvailable);
if (available == "false") {
unavailable.insert(componentId);
continue;
}
++availableCount;
// Maintain a list of componentId's seen so far to ensure no duplicates
// Maintain a list of componentId's seen so far to ensure no duplicates
insert_ret = advertisement_elements->insert
(pair<string, DOMElement*>(componentId, elt));
if (insert_ret.second == false)
......@@ -283,8 +275,6 @@ bool populate_nodes(DOMElement *root,
int typeSlots = type.typeSlots;
bool isStatic = type.isStatic;
cout << typeName << " " << typeSlots << " " << isStatic << endl;
// Add the type into assign's data structures
if (ptypes.find(typeName) == ptypes.end()) {
ptypes[typeName] = new tb_ptype(typeName);
......@@ -347,6 +337,45 @@ bool populate_nodes(DOMElement *root,
p->subnode_of_name = XStr(subnodeOf.c_str()).f();
}
}
// This has to be at the end becuase if we don't populate
// at least the interfaces, we get all kinds of crappy errors
bool isAvailable;
string available = rspecParser->readAvailable(elt, isAvailable);
if (available == "false") {
unavailable.insert(componentId);
continue;
}
++availableCount;
// Deal with features
int fdsCount;
vector<struct fd> fds = rspecParser->readFeaturesDesires(elt, fdsCount);
for (int i = 0; i < fdsCount; i++) {
struct fd feature = fds[i];
featuredesire::fd_type fd_type;
switch(feature.op.type) {
case LOCAL_OPERATOR:
fd_type = featuredesire::FD_TYPE_LOCAL_ADDITIVE;
break;
case GLOBAL_OPERATOR:
if (feature.op.op == "OnceOnly") {
fd_type = featuredesire::FD_TYPE_GLOBAL_ONE_IS_OKAY;
}
else {
fd_type = featuredesire::FD_TYPE_GLOBAL_MORE_THAN_ONE;
}
break;
default:
fd_type = featuredesire::FD_TYPE_NORMAL;
break;
}
tb_node_featuredesire node_fd (XStr(feature.fd_name.c_str()).f(),
feature.fd_weight,
feature.violatable,
fd_type);
(p->features).push_front(node_fd);
}
/*
* XXX: Is this really necessary?
......
......@@ -274,4 +274,11 @@ rspec_parser::readTypeLimits (const DOMElement* tag, int& count)
return vector<struct type_limit>();
}
vector<struct fd>
rspec_parser::readFeaturesDesires (const DOMElement* tag, int& count)
{
count = 0;
return vector<struct fd>();
}
#endif
......@@ -130,6 +130,9 @@ class rspec_parser : public rspec_parser_helper
virtual std::vector<struct rspec_emulab_extension::type_limit>
readTypeLimits (const xercesc::DOMElement*, int&);
virtual std::vector<struct rspec_emulab_extension::fd>
readFeaturesDesires(const xercesc::DOMElement*, int&);
};
......
......@@ -48,6 +48,7 @@ rspec_parser_v2::readLinkInterface (const DOMElement* link, int& ifaceCount)
return vector<struct link_interface>();
}
if ((this->ifacesSeen).find(destId) == (this->ifacesSeen).end()) {
cerr << "Could not find " << destId << endl;
ifaceCount = RSPEC_ERROR_UNSEEN_NODEIFACE_DST;
return vector<struct link_interface>();
}
......@@ -244,4 +245,10 @@ rspec_parser_v2::readTypeLimits (const DOMElement* tag, int& count)
return ((this->emulabExtensions)->readTypeLimits(tag, count));
}
vector<struct fd>
rspec_parser_v2::readFeaturesDesires (const DOMElement* tag, int& count)
{
return ((this->emulabExtensions)->readFeaturesDesires(tag, count));
}
#endif // #ifdef WITH_XML
......@@ -51,6 +51,9 @@ class rspec_parser_v2 : public rspec_parser
std::vector<struct rspec_emulab_extension::type_limit>
readTypeLimits(const xercesc::DOMElement* tag, int& count);
std::vector<struct rspec_emulab_extension::fd>
readFeaturesDesires(const xercesc::DOMElement* tag, int& count);
};
......
......@@ -14,9 +14,10 @@ static const char rcsid[] = "$Id: solution.cc,v 1.15 2009-10-21 20:49:26 tarunp
#include <utility>
#ifdef WITH_XML
#include "annotate_rspec.h"
#include "annotate_vtop.h"
#include "xstr.h"
#include "annotate_rspec.h"
#include "annotate_rspec_v2.h"
#include "annotate_vtop.h"
#include "xstr.h"
#endif
extern bool ptop_xml_input;
......@@ -25,6 +26,8 @@ extern bool ptop_rspec_input;
extern bool vtop_xml_input;
extern bool vtop_rspec_input;
extern int rspec_version;
bool both_inputs_rspec = false;
bool both_inputs_xml = false;
......@@ -51,14 +54,22 @@ void print_solution(const solution &s) {
tb_vnode *vn;
#ifdef WITH_XML
bool is_generated = false;
both_inputs_xml = ptop_xml_input && vtop_xml_input;
both_inputs_rspec = ptop_rspec_input && vtop_rspec_input;
if (both_inputs_rspec == true)
rspec_annotater = new annotate_rspec ();
else if (both_inputs_xml == true)
vtop_annotater = new annotate_vtop();
bool is_generated = false;
both_inputs_xml = ptop_xml_input && vtop_xml_input;
both_inputs_rspec = ptop_rspec_input && vtop_rspec_input;
if (both_inputs_rspec == true) {
switch (rspec_version) {
case 2:
rspec_annotater = new annotate_rspec_v2();
break;
default:
rspec_annotater = new annotate_rspec ();
break;
}
}
else if (both_inputs_xml == true)
vtop_annotater = new annotate_vtop();
#endif
/*
* Start by printing out all node mappings
......@@ -66,29 +77,29 @@ void print_solution(const solution &s) {
cout << "Nodes:" << endl;
tie(vit,veit) = vertices(VG);
for (;vit != veit;++vit) {
vn = get(vvertex_pmap,*vit);
if (! s.is_assigned(*vit)) {
cout << "unassigned: " << vn->name << endl;
} else {
#ifdef WITH_XML
// const char* node_name = XStr(vn -> name).c();
// const char* assigned_to = XStr (get(pvertex_pmap,s.get_assignment(*vit))->name).c() ;
// if (both_inputs_rspec == true)
// {
// rspec_annotater->annotate_element(node_name, assigned_to);
// if (rspec_annotater->is_generated_element("node", "virtual_id", node_name))
// continue;
// }
// else if (both_inputs_xml == true)
// {
// vtop_annotater->annotate_element(node_name, assigned_to);
// }
#endif
cout << vn->name << " " << get(pvertex_pmap,s.get_assignment(*vit))->name << endl;
}
vn = get(vvertex_pmap,*vit);
if (! s.is_assigned(*vit)) {
cout << "unassigned: " << vn->name << endl;
} else {
#ifdef WITH_XML
const char* node_name = XStr(vn -> name).c();
const char* assigned_to
= XStr (get(pvertex_pmap,s.get_assignment(*vit))->name).c() ;
if (both_inputs_rspec) {
// rspec_annotater->annotate_element(node_name, assigned_to);
// if (rspec_annotater->is_generated_element("node","virtual_id",node_name))
// continue;
}
else if (both_inputs_xml) {
vtop_annotater->annotate_element(node_name, assigned_to);
}
#endif
cout << vn->name << " "
<< get(pvertex_pmap,s.get_assignment(*vit))->name << endl;
}
}
cout << "End Nodes" << endl;
/*
* Next, edges
*/
......@@ -99,14 +110,14 @@ void print_solution(const solution &s) {
tb_vlink *vlink = get(vedge_pmap,*eit);
#ifdef WITH_XML
if (both_inputs_rspec == true)
{
is_generated = rspec_annotater->is_generated_element("link", "virtual_id", (vlink->name).c_str());
if (!is_generated)
cout << vlink->name;
if (both_inputs_rspec) {
// is_generated = rspec_annotater->is_generated_element
// ("link", "virtual_id", (vlink->name).c_str());
if (!is_generated)
cout << vlink->name;
}
else
cout << vlink->name;
cout << vlink->name;
#else
cout << vlink->name;
#endif
......@@ -121,16 +132,14 @@ void print_solution(const solution &s) {
// It seems that it will work because the front and back of the list will have the same node
// But it needs to be checked anyway.
#ifdef WITH_XML
if (both_inputs_rspec == true)
{
rspec_annotater->annotate_element((vlink->name).c_str(), (p->name).c_str());
if (is_generated)
continue;
}
else if (both_inputs_xml == true)
{
// annotate_vtop((vlink->name).c_str(), (p->name).c_str());
}
if (both_inputs_rspec) {
// rspec_annotater->annotate_element((vlink->name).c_str(), (p->name).c_str());
if (is_generated)
continue;
}
else if (both_inputs_xml == true) {
// annotate_vtop((vlink->name).c_str(), (p->name).c_str());
}
#endif
cout << " direct " << p->name << " (" <<
p->srcmac << "," << p->dstmac << ") " <<
......@@ -141,80 +150,78 @@ void print_solution(const solution &s) {
tb_plink *p = get(pedge_pmap,vlink->link_info.plinks.front());
tb_plink *p2 = get(pedge_pmap,vlink->link_info.plinks.back());
#ifdef WITH_XML
links.push_back((p->name).c_str());
links.push_back((p2->name).c_str());
if (both_inputs_rspec == true)
{
rspec_annotater->annotate_element((vlink->name).c_str(), &links);
if (is_generated)
continue;
}
else if (both_inputs_xml == true)
{
vtop_annotater->annotate_element((vlink->name).c_str(), &links);
}
links.push_back((p->name).c_str());
links.push_back((p2->name).c_str());
if (both_inputs_rspec) {
// rspec_annotater->annotate_element((vlink->name).c_str(), &links);
if (is_generated)
continue;
}
else if (both_inputs_xml) {
vtop_annotater->annotate_element((vlink->name).c_str(), &links);
}
#endif
cout << " intraswitch " << p->name << " (" <<
p->srcmac << "," << p->dstmac << ") " <<
p2->name << " (" << p2->srcmac << "," << p2->dstmac << ")";
p->srcmac << "," << p->dstmac << ") " <<
p2->name << " (" << p2->srcmac << "," << p2->dstmac << ")";
} else if (vlink->link_info.type_used ==
tb_link_info::LINK_INTERSWITCH) {
// Interswitch link - iterate through each intermediate link
cout << " interswitch ";
for (pedge_path::iterator it=vlink->link_info.plinks.begin(); it != vlink->link_info.plinks.end();++it) {
tb_plink *p = get(pedge_pmap,*it);
tb_link_info::LINK_INTERSWITCH) {
// Interswitch link - iterate through each intermediate link
cout << " interswitch ";
for (pedge_path::iterator it=vlink->link_info.plinks.begin();
it != vlink->link_info.plinks.end();
++it) {
tb_plink *p = get(pedge_pmap,*it);
#ifdef WITH_XML
links.push_back((p->name).c_str());
if (!is_generated)
cout << " " << p->name << " (" << p->srcmac << "," << p->dstmac << ")";
links.push_back((p->name).c_str());
if (!is_generated)
cout << " " << p->name
<< " (" << p->srcmac << "," << p->dstmac << ")";
#else
cout << " " << p->name << " (" << p->srcmac << "," << p->dstmac << ")";
cout << " " << p->name
<< " (" << p->srcmac << "," << p->dstmac << ")";
#endif
}
}
#ifdef WITH_XML
if (both_inputs_rspec == true)
{
rspec_annotater->annotate_element((vlink->name).c_str(), &links);
}
else if (both_inputs_xml == true)
{
vtop_annotater->annotate_element((vlink->name).c_str(), &links);
}
if (both_inputs_rspec) {
// rspec_annotater->annotate_element((vlink->name).c_str(), &links);
}
else if (both_inputs_xml) {
vtop_annotater->annotate_element((vlink->name).c_str(), &links);
}
#endif
} else if (vlink->link_info.type_used == tb_link_info::LINK_TRIVIAL) {
// Trivial link - we really don't have useful information to
// print, but we'll fake a bunch of output here just to make it
// consistent with other (ie. intraswitch) output
vvertex vv = vlink->src;
tb_vnode *vnode = get(vvertex_pmap,vv);
pvertex pv = vnode->assignment;
tb_pnode *pnode = get(pvertex_pmap,pv);
// Trivial link - we really don't have useful information to
// print, but we'll fake a bunch of output here just to make it
// consistent with other (ie. intraswitch) output
vvertex vv = vlink->src;
tb_vnode *vnode = get(vvertex_pmap,vv);
pvertex pv = vnode->assignment;
tb_pnode *pnode = get(pvertex_pmap,pv);
#ifdef WITH_XML
if (both_inputs_rspec == true)
{
rspec_annotater->annotate_element((vlink->name).c_str());
if (is_generated)
continue;
}
if (both_inputs_rspec) {
// rspec_annotater->annotate_element((vlink->name).c_str());
if (is_generated)
continue;
}
#endif
cout << " trivial " << pnode->name << ":loopback" <<
" (" << pnode->name << "/null,(null)) " <<
pnode->name << ":loopback" << " (" << pnode->name <<
"/null,(null)) ";
// TODO: Annotate trivial links in the rspec
cout << " trivial " << pnode->name << ":loopback" <<
" (" << pnode->name << "/null,(null)) " <<
pnode->name << ":loopback" << " (" << pnode->name <<
"/null,(null)) ";
// TODO: Annotate trivial links in the rspec
} else {
// No mapping at all
cout << " Mapping Failed";
// No mapping at all
cout << " Mapping Failed";
}
cout << endl;
}
cout << "End Edges" << endl;
cout << "End solution" << endl;
#ifdef WITH_XML
if (both_inputs_rspec == true)
{
rspec_annotater->cleanup();
}
if (both_inputs_rspec == true) {
rspec_annotater->cleanup();
}
#endif
}
......@@ -227,7 +234,7 @@ void print_solution (const solution &s, const char* output_filename)
// and the objects have been created there
if (both_inputs_rspec == true) {
cout << "Writing annotated rspec to " << output_filename << endl;
rspec_annotater->write_annotated_file (output_filename);
// rspec_annotater->write_annotated_file (output_filename);
}
else if (both_inputs_xml == true) {
cout << "Writing annotated xml to " << output_filename << endl;
......
......@@ -405,6 +405,7 @@ sub RunAssign($$)
{
my ($precheck, $prefix) = @_;
my $typelimitfile = $prefix .".limits";
my $ptopfile = $prefix . ".ptop";
my $vtopfile = $prefix . ".vtop";
my $assignexitcode = 0;
......@@ -430,6 +431,22 @@ sub RunAssign($$)
}
}
#
# Append this admission control results to ptopgen.
#
if (scalar(keys(%admission_control))) {
open(TYPELIMIT, ">$typelimitfile") or
return -1;
foreach my $typeclass (keys(%admission_control)) {
my $count = $admission_control{$typeclass};
print TYPELIMIT "$typeclass $count\n";
}
close(TYPELIMIT);
}
#