amxmodx/compiler/scasm/amx_error.h
David Anderson b706108ed6 Squashed commit of the following:
commit 011d9b6b07d904ad1e81ef7c747269903e2d47c4
Author: David Anderson <dvander@alliedmods.net>
Date:   Mon Jan 11 00:17:08 2010 -0600

    Initial import from Subversion (amxmodx/trunk rev 3757).
2014-02-06 23:06:54 -08:00

110 lines
2.5 KiB
C++
Executable File

/* 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: amx_error.h 835 2004-08-12 16:31:50Z dvander $
*/
#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,
Warning_Param_Count,
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,
Err_Param_Count,
Err_Unknown_Define,
Err_Misplaced_Directive,
Err_Bad_Label,
Err_Bad_Not,
Err_Invalid_Operator,
Err_Invalid_Pragma,
Err_Invalid_Proc,
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];
int line;
public:
ErrorMngr();
ErrorMngr(void *c);
void Clear();
void ErrorMsg(ErrorCode error, ...);
ErrorType GetStatus() { return HighestError; }
void PrintReport();
int CurLine();
int CurCip();
void SetLine(int ln);
int DerefSymbol(std::string &str, int sym = 0);
bool IsSymbol(std::string &str);
};
#endif //_INCLUDE_AMX_ERROR