#ifndef	_CCILIB_H
#define	_CCILIB_H

#ifndef	NULL
#	define	NULL	0
#endif
#ifndef	NORMAL
#	define	NORMAL	(0)
#endif
#ifndef	ERROR
#	define	ERROR	(-1)
#endif
#ifndef	ERR
#	define	ERR		ERROR
#endif
#ifndef	FALSE
#	define	FALSE	(0)
#endif
#ifndef	TRUE
#	define	TRUE	(1)
#endif

/*************************************************************************
*	Ｃ標準ライブラリ
*************************************************************************/
#ifndef	BUFSIZ
#	define	BUFSIZ	(512)
#endif
#ifndef	EOF
#	define	EOF		(-1)
#endif
#define	SEEK_SET	(0)
#define	SEEK_CUR	(1)
#define	SEEK_END	(2)

/*************************************************************************
*	イベント処理用
*************************************************************************/

#define	GET_EVTSBJ_PTR(sbj)	GetEvtSbjPtr(sbj)

#ifndef	EVT_CANCEL
#define	EVT_CANCEL	(-1)
#define	EVT_BREAK	(-2)
#endif

#ifndef	EVTIGN_MOUSE
#define	EVTIGN_MOUSE	(1)		/* マウスイベント禁止	*/
#define	EVTIGN_KEY		(2)		/* キーイベント禁止		*/
#endif

#ifndef	EVTYPE_KEY
#define	EVTYPE_KEY		(1)
#define	KEYEVT_ADR		(0)	/* キーアドレスが一致		*/
#define	KEYEVT_SHIFT	(1)	/* キーシフトも一致			*/
#endif

#ifndef	EVTYPE_MOUSE
#define	EVTYPE_MOUSE	(2)
#define	EVTYPE_MOS2		(3)	/* page 0 用マウスイベント	*/
#endif

#ifndef	BTN_LEFT
#define	BTN_LEFT		(1)
#define	BTN_RIGHT		(2)
#define	MOSEVT_BTN		(0x01)	/* ボタンタイプ					*/
#define	MOSEVT_NOT		(0x02)	/* ボタン反転タイプ				*/
#define	MOSEVT_NOACT	(0x03)	/* ボタン選択アクションなし		*/
#define	MOSEVT_AREA		(0x04)	/* 指定エリア					*/
#define	MOSEVT_OUTAREA	(0x05)	/* 指定エリア外					*/
#define	MOSEVT_BTNOLY	(0x06)	/* ボタンが押された場合			*/
#define	MOSEVT_MOVE		(0x07)	/* カーソルに移動があった場合	*/
#define	MOSEVT_OUTBTN	(0x08)	/* 範囲外でボタンON				*/

#define	MOSEVT_REPEAT	(0x10)	/* リピートタイプ（ボタン）		*/
#define	MOSEVT_QUICK	(0x10)	/* クイックタイプ（ﾘﾋﾟｰﾄと同じ）	*/
#endif

/*************************************************************************
*	マウス用
*************************************************************************/
#ifndef	MOS_CON
#define	MOS_CON()	MOS_curDisp(1)
#define	MOS_COFF()	MOS_curDisp(0)
#define	MOS_DEC()	MOS_curDisp(2)
#define	MOS_INC()	MOS_curDisp(3)
#endif

/*************************************************************************
*	ダイアログ用
*************************************************************************/
#ifndef	DLGPOS_MOS_SET_HOME
#define	DLGPOS_MOS_SET_HOME		(0x10010)	/* マウス位置（左上）	*/
#define	DLGPOS_MOS_SET_CENTER	(0x10020)	/* マウス位置中央		*/
#define	DLGPOS_CENTER_OF_SCN	(0x10030)	/* 画面中央				*/
#endif

#ifndef	DLGMSG_POS_CONTINUE
#define	DLGMSG_POS_CONTINUE		(-1)
#define	DLGMSG_POS_CENTERING	(-2)
#endif

/*************************************************************************
*	メニュー処理用
*************************************************************************/

#ifndef	MNU_BLK
#define	MNU_BLK	(0)
#define	MNU_MSG	(1)
#define	MNU_NOR	(2)
#define	MNU_DIG	(3)
#define	MNU_STR	(4)
#define	MNU_SEL	(5)
#define	MNU_IGN	(0x80)	/* 実行禁止	*/

#define	MNUATT_EXIT	(1)		/* EXIT ボタン付	*/
#define	MNUATT_LOOP	(2)		/* LOOP フラグ		*/
#endif

#ifndef	MENU_SURE_OK
#define	MENU_SURE_OK		(1)
#define	SELBTN_ATT_LEFT		(0)	/* 左詰め表示				*/
#define	SELBTN_ATT_CENTER	(1)	/* メッセージのセンタリング	*/
#endif

/*************************************************************************
*	ファイルダイアログ
*************************************************************************/

#define	FDL_MODE_SINGLE			(0x00000001)	/* ファイルをひとつだけ選択／指定		*/
#define	FDL_MODE_MULTI			(0x00000002)	/* 複数選択／指定						*/
#define	FDL_MODE_PATH			(0x00000003)	/* ディレクトリ選択／指定				*/
#define	FDL_MODE_BIT_DIRIGN		(0x00000080)	/* サブディレクトリの選択／指定を禁止	*/
#define	FDL_MODE_BIT_DUPIGN		(0x00000800)	/* 同一ファイル1の選択を禁止する		*/
#define	FDL_MODE_BIT_EXIST		(0x00008000)	/* 存在するファイルのみ選択可能			*/
#define	FDL_MODE_BIT_SIDEWORK	(0x00010000)	/* サイドーク							*/
#define	FDL_MODE_BIT_DOSCALL	(0x00020000)	/* DOS コマンド							*/
#define	FDL_MODE_DEFAULT	(FDL_MODE_SINGLE|FDL_MODE_BIT_DIRIGN|FDL_MODE_BIT_SIDEWORK)

#define	FDL_SORT_OFF		(0)			/* ソートなし		*/
#define	FDL_SORT_FILE		(1)			/* ファイル名		*/
#define	FDL_SORT_SUB		(2)			/* 拡張子			*/
#define	FDL_SORT_DATE		(3)			/* 日付				*/
#define	FDL_SORT_SIZE		(4)			/* サイズ			*/
#define	FDL_SORT_RVS		(0x80)		/* 昇順／降順		*/
#define	FDL_SORT_DIRBIT		(0x60)
#define	FDL_SORT_DIRTOP		(0x00)		/* ディレクトリ先頭	*/
#define	FDL_SORT_DIRLAST	(0x20)		/* ディレクトリ最後	*/
#define	FDL_SORT_DIROFF		(0x40)		/* ディレクトリ		*/

#define	FDL_ISSORT_DIRTOP(_sort)	(((_sort)&FDL_SORT_DIRBIT) == FDL_SORT_DIRTOP)
#define	FDL_ISSORT_DIRLAST(_sort)	(((_sort)&FDL_SORT_DIRBIT) == FDL_SORT_DIRLAST)
#define	FDL_ISSORT_DIROFF(_sort)	(((_sort)&FDL_SORT_DIRBIT) == FDL_SORT_DIROFF)

/*************************************************************************
*	表示／カラー
*************************************************************************/

#ifndef	C_BLACK
#define	C_BLACK		0
#define	C_BLUE		1
#define	C_RED		2
#define	C_MAGENTA	3
#define	C_GREEN		4
#define	C_CYAN		5
#define	C_YELLOW	6
#define	C_WHITE		7
#define	C_HBLACK	8
#define	C_HBLUE		9
#define	C_HRED		10
#define	C_HMAGENTA	11
#define	C_HGREEN	12
#define	C_HCYAN		13
#define	C_HYELLOW	14
#define	C_HWHITE	15

#define	C_THROUGH	0
#define	C_MBLACK	1
#endif

#define	C_GRAY		C_WHITE
#define	C_DARK		C_HBLACK
#define	C_WARNNING	C_HYELLOW
#define	C_ERROR		C_HRED
#define	C_INFO		C_HGREEN
#define	C_TIMEBOX	C_CYAN
#define	C_GRAY0		C_HBLACK
#define	C_GRAY1		C_RED
#define	C_GRAY2		C_WHITE
#define	C_GRAY3		C_MAGENTA
#define	C_METAL0	C_GREEN
#define	C_METAL1	C_CYAN
#define	C_METAL2	C_YELLOW
#define	C_DLGBASE	C_MAGENTA

#ifndef	PSET
#define	PSET	0
#define	PRESET	1
#define	OR		2
#define	AND		3
#define	XOR		4
#define	NOT		5
#define	OPAQUE	9
#endif

#ifndef	MASKSET
#define	MASKSET		13
#define	MASKRESET	14
#define	MASTNOT		15
#endif

#ifndef	COLMIX
#define	COLMIX(c1,c2)	(0x1000|(((c1)&15)<<4)|((c2)&15))
#endif

/*************************************************************************
*	IMG
*************************************************************************/

#define	IMG_ATT_PLTON	(0x00010000)

/*************************************************************************
*	ファイル複写
*************************************************************************/

#define	FCOPY_OVERWRITE_CHECK	(0x01)	/* 上書き確認する			*/
#define	FCOPY_TIME_CHECK		(0x02)	/* 日付比較					*/
#define	FCOPY_SINGLE_COPY		(0x04)	/* ファイルひとつだけ複写	*/
#define	FCOPY_LAST_MSG_IGN		(0x80)	/* 最後のメッセージ表示禁止	*/


/*************************************************************************
*	キーコード／アドレス
*************************************************************************/

#define	KA_BIT_SHIFT	(0x04)
#define	KA_BIT_CTRL		(0x10)

#define	KC_CAN		0x03	/* ｷｬﾝｾﾙ [CTRL+C]	*/
#define	KC_CR		0x0D	/* RETURN	*/
#define	KC_LF		0x0A	/* LF		*/
#define	KC_BS		0x08	/* ﾊﾞｯｸ ｽﾍﾟｰｽ	*/
#define	KC_TAB		0x09	/* TAB		*/
#define	KC_ESC		0x1B	/* ESC	*/

#define	KA_ESC		0x0100	/* [ESC]		*/
#define	KA_1		0x0200
#define	KA_2		0x0300
#define	KA_3		0x0400
#define	KA_4		0x0500
#define	KA_5		0x0600
#define	KA_6		0x0700
#define	KA_7		0x0800
#define	KA_8		0x0900
#define	KA_9		0x0A00
#define	KA_0		0x0B00
#define KA_BS		0x0F00	/* [BS]			*/
#define KA_TAB		0x1000	/* [TAB]			*/

#define	KA_Q		0x1100
#define	KA_W		0x1200
#define	KA_E		0x1300
#define	KA_R		0x1400
#define	KA_T		0x1500
#define	KA_Y		0x1600
#define	KA_U		0x1700
#define	KA_I		0x1800
#define	KA_O		0x1900
#define	KA_P		0x1A00

#define	KA_A		0x1E00
#define	KA_S		0x1F00
#define	KA_D		0x2000
#define	KA_F		0x2100
#define	KA_G		0x2200
#define	KA_H		0x2300
#define	KA_J		0x2400
#define	KA_K		0x2500
#define	KA_L		0x2600
#define	KA_SEMICOLON 0x2700	/* ; */

#define	KA_Z		0x2A00
#define	KA_X		0x2B00
#define	KA_C		0x2C00
#define	KA_V		0x2D00
#define	KA_B		0x2E00
#define	KA_N		0x2F00
#define	KA_M		0x3000

#define	KA_SPACE	0x3500
#define	KA_RETURN	0x1D00	/* [RETURN]		*/
#define	KA_DEL		0x4B00	/* Del			*/
#define	KA_INS		0x4800	/* 挿入			*/
#define	KA_LEFT		0x4F00	/* Left  [←]	*/
#define	KA_RIGHT	0x5100	/* Right [→]	*/
#define	KA_UP		0x4D00	/* Up    [↑]	*/
#define	KA_DOWN		0x5000	/* Down  [↓]	*/
#define	KA_HOME		0x4E00	/* [HOME]		*/
#define	KA_PREV		0x6E00	/* [前行]		*/
#define	KA_NEXT		0x7000	/* [次行]		*/
#define	KA_BEFORE	0x6E00	/* [前行](old)	*/

#define	KA_OASLEFT	0x6700	/* [シフト左] 親指シフトキーボード	*/
#define	KA_OASRIGHT	0x6800	/* [シフト右] 親指シフトキーボード	*/

#define	KA_KANDIC	0x6B00	/* [漢字辞書]	*/
#define	KA_KANDEL	0x6C00	/* [単語抹消]	*/
#define	KA_KANSET	0x6D00	/* [単語登録]	*/
#define	KA_KANHZ	0x7100	/* [半角全角]	*/

#define	KA_CANCEL	0x7200	/* [取消]	*/
#define	KA_EXEC		0x7300	/* [実行]	*/
#define	KA_BREAK	0x7C00	/* [BREAK]	*/
#define	KA_COPY		0x7D00	/* [COPY]	*/

#define	KA_PF1		0x5D00	/* [PF-1]	*/
#define	KA_PF2		0x5E00	/* [PF-2]	*/
#define	KA_PF3		0x5F00	/* [PF-3]	*/
#define	KA_PF4		0x6000	/* [PF-4]	*/
#define	KA_PF5		0x6100	/* [PF-5]	*/
#define	KA_PF6		0x6200	/* [PF-6]	*/
#define	KA_PF7		0x6300	/* [PF-7]	*/
#define	KA_PF8		0x6400	/* [PF-8]	*/
#define	KA_PF9		0x6500	/* [PF-9]	*/
#define	KA_PF10		0x6600	/* [PF10]	*/
#define	KA_PF11		0x6900	/* [PF11]	*/
#define	KA_PF12		0x5B00	/* [PF12]	*/
#define	KA_PF13		0x7400
#define	KA_PF14		0x7500
#define	KA_PF15		0x7600
#define	KA_PF16		0x7700
#define	KA_PF17		0x7800
#define	KA_PF18		0x7900
#define	KA_PF19		0x7A00
#define	KA_PF20		0x7B00

#endif
