#ifndef _MGC_DEBUG_H
#define _MGC_DEBUG_H
#include "mgc_struct.h"

//#define MGC_TEST_DEBUG
#define MGC_MAX_LINE_LENGTH 256

#define MGC_MAX_ASCIIIN_LEN			4096
#define MGC_MAX_ASCIIOUT_LEN		(4096*2)
#define MGC_MAX_ASCITMP_LEN			4096



#define	MGC_MONITOR_NONE				0x0000
#define	MGC_MONITOR_DEBUG				0x0001
#define	MGC_MONITOR_ERROR				0x0010
#define	MGC_MONITOR_WARN				0x0100
#define	MGC_MONITOR_INFO				0x1000
#define	MGC_MONITOR_ALL					0xffff

#ifdef MGC_TEST_DEBUG
#define MGC_DEBUG(msg...) printf("\33[37m DEBUG: [%s:%d]",__FILE__ ,__LINE__ );printf(msg);printf("\n \33[37m")
#define MGC_WARN(msg...) printf("\33[33m WARN: [%s:%d]",__FILE__ ,__LINE__ );printf(msg);printf("\n \33[37m")
#define MGC_ERROR(msg...) printf("\33[31m ERROR: [%s:%d]",__FILE__ ,__LINE__ );printf(msg);printf("\n \33[37m")
#define MGC_INFO(msg...) printf("\33[32m INFO: [%s:%d]",__FILE__ ,__LINE__ );printf(msg);printf("\n \33[37m")
#else
void MGC_DEBUG(char *msg,...);
void MGC_WARN(char *msg,...);
void MGC_ERROR(char *msg,...);
void MGC_INFO(char *msg,...);
#endif

/*
#define NONE         "\033[m"
#define RED          "\033[0;32;31m"
#define LIGHT_RED    "\033[1;31m"
#define GREEN        "\033[0;32;32m"
#define LIGHT_GREEN  "\033[1;32m"
#define BLUE         "\033[0;32;34m"
#define LIGHT_BLUE   "\033[1;34m"
#define DARY_GRAY    "\033[1;30m"
#define CYAN         "\033[0;36m"
#define LIGHT_CYAN   "\033[1;36m"
#define PURPLE       "\033[0;35m"
#define LIGHT_PURPLE "\033[1;35m"
#define BROWN        "\033[0;33m"
#define YELLOW       "\033[1;33m"
#define LIGHT_GRAY   "\033[0;37m"
#define WHITE        "\033[1;37m"
*/


BYTE		mgcAsciInBuf[MGC_MAX_ASCIIIN_LEN];
BYTE		mgcAsciOutBuf[MGC_MAX_ASCIIOUT_LEN];
BYTE		mgcAsciTempBuf[MGC_MAX_ASCITMP_LEN];
WORD		mgcMonitorFg;


void 	mgc_mon(void);
int		mgc_debug_set(void);
int		mgc_asciout_proc(BYTE *out_str);
int		mgc_hex_to_ascii(BYTE *from_hex, BYTE from_len, BYTE *to_asc);
int 	mgc_log_err(char *err_msg);
int 	mgc_log_procedure(WORD mgNo, WORD portIndex, WORD chnlIndex, char *msg);


#endif
