file: error.cc
/*
This file contains the longer methods for the error class
declared in error.h. The methods included are:
unsigned short int operator() (filter_error err, //OVERLOAD CALL: operator: error.cc(arg_out), error.cc(error), error.cc(error), error.cc(error), filter.cc(foo), filtermain.cc(comp_String), direct.cpp(include), direct.cpp(define), direct.cpp(ifdef), direct.cpp(ifndef), direct.cpp(_else), direct.cpp(endif)
const vector<unsigned short int>& args,
unsigned short int mask) const
-error handler for filter class
Revision History:
first made: 3/4/96 by John Langford
*/
#include "error.h"
//used by stl
struct arg_out{
};
void arg_out::operator() (unsigned short int in)
{
cerr << in << " ";
}
/*
unsigned short int operator() (filter_error err, //OVERLOAD CALL: operator: error.cc(arg_out), error.cc(error), error.cc(error), error.cc(error), filter.cc(foo), filtermain.cc(comp_String), direct.cpp(include), direct.cpp(define), direct.cpp(ifdef), direct.cpp(ifndef), direct.cpp(_else), direct.cpp(endif)
const vector<unsigned short int>& args,
unsigned short int mask) const
Description: Handles the errors for the filter class.
Arguments: filter_error err -type of error
const vector<unsigned short int>& args -a vector of
unsigned short int's involved in the error
unsigned short int mask -a bitfield involved in the error
Return Value: None.
Inputs: None.
Outputs: Error messages.
Error Handling: Hah!
Algorithms: None.
Data Structures: None.
Last Modified: 3/4/97
*/
unsigned short int error::operator() (filter_error err,
const vector<unsigned short int>& args,
unsigned short int mask) const
{
switch (err){
case OVERSIZE_MASK:
{
cerr << "bitfield mask " << hex << mask << dec << "of opcode too large"
<< " for machine opcodes" << endl;
return mask & (unsigned short int)4095;
}
case OVERSIZE_FIELD:
{
cerr << "Field to large: " << mask << " greater than opcode size." <<endl;
return 0;
}
case WRONG_ARGUMENT_COUNT:
{
cerr << "wrong number of arguments to opcode " << hex << mask << dec
<< " arguments are: ";
for_each(args.begin(),args.end(),arg_out());
cerr << endl;
return mask;
}
case OVERSIZE_ARGUMENT:
{
cerr << "error, argument too large for bitfield " << hex << mask << dec
<< endl;
return 0;
}
}
cerr << "unknown error" << endl;
return 0;
}
/*
void operator() (resolution_error err, const line& in, const String& arg) //OVERLOAD CALL: operator: error.cc(arg_out), error.cc(error), error.cc(error), error.cc(error), filter.cc(foo), filtermain.cc(comp_String), direct.cpp(include), direct.cpp(define), direct.cpp(ifdef), direct.cpp(ifndef), direct.cpp(_else), direct.cpp(endif)
const
Description: Handles the errors for the resolved_line class.
Arguments: resolution_error err -type of error
line in -line which generated the error
arg -string associated with error.
Return Value: None.
Inputs: None.
Outputs: Error messages.
Error Handling: Hah!
Algorithms: None.
Data Structures: None.
Last Modified: 3/4/97
*/
void error::operator() (resolution_error err,const line& in,
const String& arg) const
{
switch (err){
case UNRESOLVABLE:
{
cerr << "unresolved symbol, " << arg << ", in ";
break;
}
case UNRESOLVABLE_ORG:
{
cerr << "org not resolvable at line ";
break;
}
case BAD_ARGUMENT_1:
{
cerr << "Bad argument 1 to EQU or label ";
break;
}
case BAD_ARGUMENT_2:
{
cerr << "Bad argument 2 to EQU ";
break;
}
case DOUBLE_IDENTIFICATION:
{
cerr << "error, identifier, " << arg << " previously defined ";
break;
}
}
in.printstate();
}
/*
void operator() (resolution_error err, const line& in1, const line& in2) //OVERLOAD CALL: operator: error.cc(arg_out), error.cc(error), error.cc(error), error.cc(error), filter.cc(foo), filtermain.cc(comp_String), direct.cpp(include), direct.cpp(define), direct.cpp(ifdef), direct.cpp(ifndef), direct.cpp(_else), direct.cpp(endif)
const
Description: Handles the errors for the object class.
Arguments: resolution_error err -type of error
line in1 -line associated with error
line in2 -another line associated with the error.
Return Value: None.
Inputs: None.
Outputs: Error messages.
Error Handling: Hah!
Algorithms: None.
Data Structures: None.
Last Modified: 3/4/97
*/
void error::operator() (object_error err,const line& in1,
const line& in2) const
{
switch (err){
case DOUBLE_MAP
{
cerr << "Two compiled lines map onto same location in object code "
break;
}
}
in1.printstate();
in2.printstate();
}
C++ to HTML Conversion by ctoohtml