#include "stackcl.h"
+static class cl_stack_error_registry stack_error_registry;
+
cl_stack_op::cl_stack_op(enum stack_op op,
t_addr iPC,
t_addr iSP_before, t_addr iSP_after):
* Stack Errors
*/
-class cl_error_class *cl_error_stack::error_stack_class;
-
cl_error_stack::cl_error_stack(void)
{
- if (NULL == error_stack_class)
- error_stack_class= new cl_error_class(err_error, "stack", classification, ERROR_OFF);
- classification= error_stack_class;
+ classification = stack_error_registry.find("stack");
}
/* Stack Tracker Errors */
-class cl_error_class *cl_error_stack_tracker::error_stack_tracker_class;
-
cl_error_stack_tracker::cl_error_stack_tracker(void)
{
-// cl_error_class *error_stack_tracker_class = new cl_error_class(err_error, "stack_tracker", error_stack_class, ERROR_OFF);
-// classification= &error_stack_tracker_class;
- if (NULL == error_stack_tracker_class)
- error_stack_tracker_class= new cl_error_class(err_error, "stack_tracker", classification);
- classification= error_stack_tracker_class;
+ classification = stack_error_registry.find("stack_tracker");
}
/* Stack Tracker: wrong handle */
-class cl_error_class *cl_error_stack_tracker_wrong_handle::error_stack_tracker_wrong_handle_class;
-
cl_error_stack_tracker_wrong_handle::cl_error_stack_tracker_wrong_handle(bool write_op):
cl_error_stack_tracker()
{
write_operation= write_op;
- if (NULL == error_stack_tracker_wrong_handle_class)
- error_stack_tracker_wrong_handle_class= new cl_error_class(err_error, "stack_tracker_wrong_handle", classification);
- classification= error_stack_tracker_wrong_handle_class;
+ classification = stack_error_registry.find("stack_tracker_wrong_handle");
}
void
/* Stack Tracker: operation on empty stack */
-class cl_error_class *cl_error_stack_tracker_empty::error_stack_tracker_empty_class;
-
cl_error_stack_tracker_empty::
cl_error_stack_tracker_empty(class cl_stack_op *op):
cl_error_stack_tracker()
{
operation= op->mk_copy();
- if (NULL == error_stack_tracker_empty_class)
- error_stack_tracker_empty_class= new cl_error_class(err_error, "operation_on_empty_stack", classification);
- classification= error_stack_tracker_empty_class;
+ classification = stack_error_registry.find("operation_on_empty_stack");
}
cl_error_stack_tracker_empty::~cl_error_stack_tracker_empty(void)
/* Stack Tracker: operation on empty stack */
-class cl_error_class *cl_error_stack_tracker_unmatch::error_stack_tracker_unmatch_class;
-
cl_error_stack_tracker_unmatch::
cl_error_stack_tracker_unmatch(class cl_stack_op *Top, class cl_stack_op *op):
cl_error_stack_tracker()
{
top= Top->mk_copy();
operation= op->mk_copy();
- if (NULL == error_stack_tracker_unmatch_class)
- error_stack_tracker_unmatch_class= new cl_error_class(err_warning, "stack_operation_unmatched_to_top_of_stack", classification);
- classification= error_stack_tracker_unmatch_class;
+ classification = stack_error_registry.find("stack_operation_unmatched_to_top_of_stack");
}
cl_error_stack_tracker_unmatch::~cl_error_stack_tracker_unmatch(void)
/* Stack Tracker: stack is inconsistent */
-class cl_error_class *cl_error_stack_tracker_inconsistent::error_stack_tracker_inconsistent_class;
-
cl_error_stack_tracker_inconsistent::
cl_error_stack_tracker_inconsistent(class cl_stack_op *op,
int the_unread_data_size)
{
operation= op->mk_copy();
unread_data_size= the_unread_data_size;
- if (NULL == error_stack_tracker_inconsistent_class)
- error_stack_tracker_inconsistent_class= new cl_error_class(err_warning, "stack_looks_corrupted", classification);
- classification= error_stack_tracker_inconsistent_class;
+ classification = stack_error_registry.find("stack_looks_corrupted");
}
cl_error_stack_tracker_inconsistent::~cl_error_stack_tracker_inconsistent(void)
unread_data_size);
}
+cl_stack_error_registry::cl_stack_error_registry(void)
+{
+ class cl_error_class *prev = stack_error_registry.find("non-classified");
+ prev = register_error(new cl_error_class(err_error, "stack", prev, ERROR_OFF));
+ prev = register_error(new cl_error_class(err_error, "stack_tracker", prev));
+ prev = register_error(new cl_error_class(err_error, "stack_tracker_wrong_handle", prev));
+ prev = register_error(new cl_error_class(err_error, "operation_on_empty_stack", prev));
+ prev = register_error(new cl_error_class(err_warning, "stack_operation_unmatched_to_top_of_stack", prev));
+ prev = register_error(new cl_error_class(err_warning, "stack_looks_corrupted", prev));
+}
+
/* End of sim.src/stack.cc */