www.pudn.com > ASM86_64.rar > error.h


#ifndef _ERROR_H_
#define _ERROR_H_

/*
 *	error.h
 *
 *	author: Mik
 *
 *	11/12/2005
 */

/*
	errno(32-bit): define the error no
*/

typedef int errno_t;


typedef struct err_struct {
	errno_t errno;			/* the error number */
	char **err_msg;			/* error message arrary */
	char *err_info;			/* error information */
	struct err_struct *next;	/* next error message */
} err_link_t;



/* operand error */

#define ERR_SLBRACKET	0x1
#define ERR_SRBRACKET	0x2
#define ERR_CAST	0x4
#define ERR_PREFIX	0x8
#define ERR_MLBRACKET	0x10
#define ERR_MRBRACKET	0x20
#define ERR_BASE	0x40
#define ERR_INDEX	0x80
#define ERR_SCALE	0x100
#define ERR_DISP	0x200
#define ERR_OPERAND	0x400
#define ERR_IMME	0x800
#define ERR_MOFFSET	0x1000
#define ERR_ADDRESS	0x2000
#define ERR_REGISTER	0x4000
#define ERR_INVALD_SIZE 	0x8000
#define ERR_ERROR	0x10000
#define ERR_CHARACTER	0x80000000


static char *ops_errmsg[] = { 
	"error: loss '('\n", 
	"error: loss ')'\n", 
	"error: invalid operand size cast\n",
	"error: illegal prefix\n",
	"error: loss '['\n",
	"error: loss ']'\n",
	"error: illegal base or index register\n",
	"error: illegal index register\n",
	"error: illegal scale value\n",
	"error: illegal displacement value\n",
	"error: illegal operand\n",
	"error: invalid immediate value\n",
	"error: illegal memory offset value\n",
	"error: illegal operand address mode\n",
	"error: illegal register value\n",
	"error: invalid operand size\n", 

	"",
	"error: illegal character\n"		// last
};



/* assemble line error */
#define ERR_LABEL	0x1
#define ERR_REPLABEL	0x2
#define ERR_INS		0x4
#define ERR_LINE	0x8

static char *line_errmsg[] = {
	"error: error at label\n",
	"error: rep define label\n",
	"error: illegel instruction\n",
	"error: error at line or cannot analyse line\n"		/* last */
};

/* analyse file error no */
#define ERR_FILE	0x1
#define ERR_ENTER 	0x2


/* generate encode error no */
//#define ERR_ERROR 	0x1



#define PRINT_ERRMSG(errno, errmsg) \
{ \
	int i;	\
	for (i = 0; i < 32; i++) \
		fprintf(stderr, (errno)&(1<