/*-----------------------------------------------------------------------------
HI_LIB Macro module
hi_macro.h
-----------------------------------------------------------------------------*/
#ifndef HI_MACRO
#define HI_MACRO 1
/*
* user defined type
*
*/
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
/*
* bool value
*
*/
#define FALSE (0)
#define TRUE (!FALSE)
#define OFF (0)
#define ON (!OFF)
/*
* file attribute
*
*/
#define FAnormal 0X00 /* Normal file */
#define FArdonly 0x01 /* Read only file */
#define FAhidden 0x02 /* Hidden file */
#define FAsystem 0x04 /* System file */
#define FAvolid 0x08 /* Volume ID file */
#define FAdirec 0x10 /* Subdirectory */
#define FAarch 0x20 /* Archive file*/
/*
* special character
*
*/
#define NIL 0x00
#define TAB 0x09
#define ESC 0x1B
#define CR 0x0d
#define LF 0x0a
#define SPACE 0x20
#define ZEN_SPACE1 0x81 /* 全角空白 first byte */
#define ZEN_SPACE2 0x40 /* second byte */
/*
* color code for ESCape sequence control
*
*/
#define EC_NORMAL 0
#define EC_BLACK 30 /* normal color */
#define EC_RED 31
#define EC_GREEN 32
#define EC_YELLOW 33
#define EC_BLUE 34
#define EC_MAGENTA 35
#define EC_CYAN 36
#define EC_WHITE 37
#define EC_RBLACK 40 /* reverse color */
#define EC_RRED 41
#define EC_RGREEN 42
#define EC_RYELLOW 43
#define EC_RBLUE 44
#define EC_RMAGENTA 45
#define EC_RCYAN 46
#define EC_RWHITE 47
/*
* ESCape sequense text video control
*
*/
#define M_cls() printf("¥x1b[2J")
#define M_beep() printf("¥a")
#define M_color(c) printf("¥x1b[%dm",(int)(c))
#define M_locate(x,y) printf("¥x1b[%d;%dH",(int)((y)+1),(int)((x)+1))
#define M_cursor(sw) printf("¥x1b[>5%c",(sw)?'l':'h')
#define M_function(sw) printf("¥x1b[>1%c",(sw)?'l':'h')
#define M_rollup(s,e) ¥
printf("¥x1b[s¥x1b[%d;1H¥x1b[1M¥x1b[%d;1H¥x1b[1L¥x1b[u", ¥
(int)(s)+1,(int)(e)+1)
#define M_rolldown(s,e) ¥
printf("¥x1b[s¥x1b[%d;1H¥x1b[1M¥x1b[%d;1H¥x1b[1L¥x1b[u", ¥
(int)(e)+1, (int)(s)+1)
#define M_inkey() (bdos(6,0xff,0)&0xff)
/*
* character test macro
* 0:FALSE !0:TRUE
*/
#define M_isdigit(c) ((c)>='0'&&(c)<='9')
#define M_islhex(c) ((c)>='a'&&(c)<='f')
#define M_ishhex(c) ((c)>='A'&&(c)<='F')
#define M_ishex(c) (M_islhex(c)||M_ishhex(c))
#define M_isxdigit(c) (M_isdigit(c)||M_i