Commit 49b286c0 authored by Robert Ricci's avatar Robert Ricci

Add an EXIT_FATAL return value (-1) for bad top/ptop files, and for

internal errors.
parent 1b42ff55
......@@ -363,7 +363,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
tb_pnode *pn = get(pvertex_pmap,pv);
if (vn->vclass != NULL) {
cout << "Can not have fixed nodes be in a vclass!.\n";
exit(EXIT_UNRETRYABLE);
exit(EXIT_FATAL);
}
if (add_node(vv,pv,false,true) == 1) {
cout << "Fixed node: Could not map " << vn->name <<
......
......@@ -147,7 +147,7 @@ void read_physical_topology(char *filename)
ptopfile.open(filename);
if (!ptopfile.is_open()) {
cout << "Unable to open ptop file " << filename << endl;
exit(EXIT_UNRETRYABLE);
exit(EXIT_FATAL);
}
cout << "Physical Graph: " << parse_ptop(PG,SG,ptopfile) << endl;
......@@ -256,7 +256,7 @@ void read_virtual_topology(char *filename)
topfile.open(filename);
if (!topfile.is_open()) {
cout << "Unable to open top file " << filename << endl;
exit(EXIT_UNRETRYABLE);
exit(EXIT_FATAL);
}
cout << "Virtual Graph: " << parse_top(VG,topfile) << endl;
......@@ -334,7 +334,7 @@ void print_help()
cout << " -u - Print a summary of the solution." << endl;
cout << " -c <float> - Use the 'connected' pnode finding algorithm " <<
"<float>% of the time." << endl;
exit(EXIT_UNRETRYABLE);
exit(EXIT_FATAL);
}
// Perfrom a pre-cehck to make sure that there are enough free nodes of the
......
......@@ -17,15 +17,17 @@
#define EXIT_SUCCESS 0
// No valid solution was found, but one may exist
// No violation-free solution was found after annealing, or there was an
// internal error
// No violation-free solution was found after annealing.
#define EXIT_RETRYABLE 1
// It is not possible to map the given top file into the given ptop file,
// so there's no point in re-running assign.
// Can also occur if the top or ptop file does not exist or cannot be parsed
#define EXIT_UNRETRYABLE 2
// An internal error occured, or there was a problem with the input - for
// example, the top or ptop file does not exist or cannot be parsed
#define EXIT_FATAL -1
/*
To use these on the command line, each entry gets a
<name>=<value> pair on the command line.
......
......@@ -302,7 +302,7 @@ int parse_ptop(tb_pgraph &PG, tb_sgraph &SG, istream& i)
errors += bind_ptop_subnodes();
if (errors > 0) {exit(EXIT_UNRETRYABLE);}
if (errors > 0) {exit(EXIT_FATAL);}
return num_nodes;
}
......
......@@ -333,7 +333,7 @@ int parse_top(tb_vgraph &VG, istream& i)
errors += bind_top_subnodes();
if (errors > 0) {exit(EXIT_UNRETRYABLE);}
if (errors > 0) {exit(EXIT_FATAL);}
return num_nodes;
}
......@@ -630,7 +630,7 @@ void score_link_info(vedge ve, tb_pnode *src_pnode, tb_pnode *dst_pnode, tb_vnod
#endif
case tb_link_info::LINK_UNKNOWN:
cout << "Internal error: Should not be here either." << endl;
exit(EXIT_RETRYABLE);
exit(EXIT_FATAL);
break;
}
......@@ -1061,7 +1061,7 @@ int add_node(vvertex vv,pvertex pv, bool deterministic, bool is_fixed)
case tb_link_info::LINK_UNKNOWN:
case tb_link_info::LINK_TRIVIAL:
cerr << "Internal error: Should not be here." << endl;
exit(EXIT_RETRYABLE);
exit(EXIT_FATAL);
break;
}
if (choice < 0) break;
......@@ -1639,7 +1639,7 @@ double fd_score(tb_vnode *vnode,tb_pnode *pnode,int &fd_violated,
default:
// Global features are required to have some kind of type
cout << "Bad global feature " << (*feature_it).first << endl;
exit(EXIT_UNRETRYABLE);
exit(EXIT_FATAL);
}
} else {
desire_it = vnode->desires.find(feature_name);
......@@ -1702,7 +1702,7 @@ double add_stateful_fds(tb_vnode *vnode, tb_pnode *pnode,
default:
// Local features are required to have some kind of type
cout << "Bad local desire " << (*desire_it).first << endl;
exit(EXIT_UNRETRYABLE);
exit(EXIT_FATAL);
}
}
}
......@@ -1753,7 +1753,7 @@ double remove_stateful_fds(tb_vnode *vnode, tb_pnode *pnode,
default:
// Local features are required to have some kind of type
cout << "Bad local desire " << (*desire_it).first << endl;
exit(EXIT_UNRETRYABLE);
exit(EXIT_FATAL);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment