2004-08-06 08:46:59 +00:00
|
|
|
/* AMX Assembler
|
|
|
|
* Copyright (C)2004 David "BAILOPAN" Anderson
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty. In no event will the authors be held liable for any damages
|
|
|
|
* arising from the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
* including commercial applications, and to alter it and redistribute it
|
|
|
|
* freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
* claim that you wrote the original software. If you use this software
|
|
|
|
* in a product, an acknowledgment in the product documentation would be
|
|
|
|
* appreciated but is not required.
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
* misrepresented as being the original software.
|
|
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*
|
|
|
|
* Version: $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE_AMX_ERROR
|
|
|
|
#define _INCLUDE_AMX_ERROR
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
Err_None=-1,
|
|
|
|
Err_Notice,
|
|
|
|
Err_Warning,
|
|
|
|
Err_Error,
|
|
|
|
Err_Fatal,
|
|
|
|
} ErrorType;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
notices_start,
|
|
|
|
notices_end,
|
|
|
|
|
|
|
|
warnings_start,
|
|
|
|
Warning_Hex_Start,
|
|
|
|
Warning_Null_Expression,
|
2004-08-07 17:07:50 +00:00
|
|
|
Warning_Param_Count,
|
2004-08-06 08:46:59 +00:00
|
|
|
warnings_end,
|
|
|
|
|
|
|
|
errors_start,
|
|
|
|
Err_String_Terminate,
|
|
|
|
Err_String_Extra,
|
|
|
|
Err_Unexpected_Char,
|
|
|
|
Err_Invalid_Section,
|
|
|
|
Err_Wandering_Stuff,
|
|
|
|
Err_Symbol_Reuse, /* Non-fatal version of Redef */
|
|
|
|
Err_Invalid_Stor,
|
|
|
|
Err_Unknown_Symbol,
|
|
|
|
Err_Symbol_Type,
|
|
|
|
Err_Invalid_Symbol,
|
|
|
|
Err_Opcode,
|
|
|
|
Err_Unmatched_Token,
|
2004-08-07 17:07:50 +00:00
|
|
|
Err_Param_Count,
|
2004-08-09 05:23:32 +00:00
|
|
|
Err_Unknown_Define,
|
|
|
|
Err_Misplaced_Directive,
|
2004-08-09 08:43:27 +00:00
|
|
|
Err_Bad_Label,
|
2004-08-11 08:14:54 +00:00
|
|
|
Err_Bad_Not,
|
|
|
|
Err_Invalid_Operator,
|
|
|
|
Err_Invalid_Pragma,
|
2004-08-12 16:31:50 +00:00
|
|
|
Err_Invalid_Proc,
|
2004-08-06 08:46:59 +00:00
|
|
|
errors_end,
|
|
|
|
|
|
|
|
fatals_start,
|
|
|
|
Err_FileNone,
|
|
|
|
Err_FileOpen,
|
|
|
|
Err_NoMemory,
|
|
|
|
Err_PragmaStacksize,
|
|
|
|
Err_InvalidMacro,
|
|
|
|
Err_SymbolRedef,
|
|
|
|
Err_Reserved,
|
|
|
|
Err_MacroParamCount,
|
|
|
|
Err_FatalTokenError,
|
|
|
|
fatals_end,
|
|
|
|
|
|
|
|
} ErrorCode;
|
|
|
|
|
|
|
|
class ErrorMngr
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
void DefineErrors();
|
|
|
|
const char *GetError(ErrorCode id);
|
|
|
|
ErrorType GetErrorType(ErrorCode id);
|
|
|
|
private:
|
|
|
|
std::vector<const char *> List;
|
|
|
|
ErrorType HighestError;
|
|
|
|
void *Cmp;
|
|
|
|
int Totals[4];
|
2004-08-11 08:14:54 +00:00
|
|
|
int line;
|
2004-08-06 08:46:59 +00:00
|
|
|
public:
|
|
|
|
ErrorMngr();
|
|
|
|
ErrorMngr(void *c);
|
2004-08-08 10:15:08 +00:00
|
|
|
void Clear();
|
2004-08-06 08:46:59 +00:00
|
|
|
void ErrorMsg(ErrorCode error, ...);
|
|
|
|
ErrorType GetStatus() { return HighestError; }
|
2004-08-08 10:15:08 +00:00
|
|
|
void PrintReport();
|
2004-08-09 05:23:32 +00:00
|
|
|
int CurLine();
|
|
|
|
int CurCip();
|
2004-08-11 08:14:54 +00:00
|
|
|
void SetLine(int ln);
|
|
|
|
int DerefSymbol(std::string &str, int sym = 0);
|
|
|
|
bool IsSymbol(std::string &str);
|
2004-08-06 08:46:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //_INCLUDE_AMX_ERROR
|