⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tool.h

📁 在SCO UNIX制定界面程序 可根据文件配制菜单,而不必修改源程序,非常方便
💻 H
字号:

/*
 * 周国祥  2001/04/13
 *
 * modify "SUCCESS" to "SUCC",
 *	in macro_def.h "SUCCESS" is one of the reps_code
 */

/* 
**	屏幕编辑头文件
*/
#ifndef TOOL
#define TOOL


/* PROMPT() 入口字段特性 */
#define	REVERSE		1	/* 反显 */
#define	BOLD		2	/* 粗体 */
#define NOWAIT		0	/* 显示 */
#define WAIT		1	/* 确认后请理 */


/* YORN(), SELECT1_3() 入口字段特性 */
#define	FIRST		0
#define SECOND		1
#define THIRD		2
#define NOST		1
#define SHORTCUT	0


/* 录入控制键 */
#define CTRL_A	1
#define CTRL_C	3		/* Clears all columns in the current table */
#define CTRL_D	4		/* Clears to the end of the field */
#define CTRL_L	12		/* 整理屏幕 */
#define CTRL_N	14		/* 下一屏幕 */
/* add by dongyi */
#define CTRL_P  16
/* add end */
#define CTRL_U	21		/* 退出屏幕 */
#define CTRL_W	23		/* Display help message */
#define CTRL_X	24		/* Detetes a character */
#define BS	8		/* Backup key */
#define ENTER	10		/* 回车键 */
#define	CR 	13		/* 回车	*/
#define ESCAPE	27
#define SPACE	32		/* 空格键 */
#define	UP	265
#define	DOWN	266
#define	RIGHT	267
#define LEFT	268
#define	END	270
#define	PGDN	271
#define	HOME	272
#define	PGUP	273
#define	INS	274

#define	NORMAL		0
#define	NOEDIT		1
#define	HIDE		2
#define	NOEMPTY		4
#define SKIP		8
#define DIGITAL		16
#define FULL		32

#define	NOENTER		0
#define	WAITENTER	1

/* 返回码 */
#define SUCC	0		/* 操作成功 */
#define FAIL    -1		/* 失败 */

#define PROMPT_ON       1
#define PROMPT_OFF      0

#define Item_Attr		A_UNDERLINE

/* option 含义 */
#define FLD_CHK			0x000010		/* 空值检查 */
#define MV_CHK(x)		((x&FLD_CHK)>>4)	/* 是否允许空值 */

#define FLD_VIEW		0x000020
#define MV_VIEW(x)		((x&FLD_VIEW)>>5)

#define FLD_EXCEL		0x000040
#define MV_EXCEL(x)		((x&FLD_EXCEL)>>6)

#define FLD_DIGITAL		0x000080		/* 数字串 */
#define MV_DIGITAL(x)		((x&FLD_DIGITAL)>>7)

#define FLD_FULL		0x010000		/* 填满 */
#define MV_FULL(x)		((x&FLD_FULL)>>16)

#define FLD_BEGIN		0x008000		/* 首字段 */
#define MV_BEGIN(x)		((x&FLD_BEGIN)>>15)	/* 是否首字段 */

#define FLD_END			0x004000		/* 尾字段 */
#define MV_END(x)		((x&FLD_END)>>14)	/* 是否尾字段 */

#define PROMPT_REV		0x002000		/* 提示反显 */
#define MV_REV(x)		((x&PROMPT_REV)>>13)	/* 是否反显 */

#define FLD_FORM		0x001000		/* FORMONLY */
#define MV_FORM(x)		((x&FLD_FORM)>>12)	/* 是否FORMONLY */

#define FLD_INS			0x000800		/* 插入时不处理该字段 */
#define MV_INS(x)		((x&FLD_INS)>>11)	/* 是否 NOT INSERT */

#define FLD_UPD			0x000400		/* 修改时不处理该字段 */
#define MV_UPD(x)		((x&FLD_UPD)>>10)	/* 是否 NOT UPDATE */

#define FLD_HIDE		0x000200		/* HIDEONLY */
#define MV_HIDE(x)		((x&FLD_HIDE)>>9)	/* 是否隐含 */

#define FLD_SKIP		0x000100		/* SKIP */
#define MV_SKIP(x)		((x&FLD_SKIP)>>8)	/* 不处理的字段 */

#define FLD_TYPE		0x00000f		/* 字段类型逻辑尺 */
#define MV_TYPE(x)		(x&FLD_TYPE)		/* 是否READONLY */

#define FLD_INT			0x000001		/* 整数 */
#define FLD_LONG		0x000002		/* 长整数 */
#define FLD_MONEY		0x000003		/* 金额 */
#define FLD_FLOAT		0x000004		/* 浮点,小数点后有2位 */
#define FLD_STRING		0x000005		/* 字符串 */
#define FLD_DATE		0x000006		/* 日期 */
#define FLD_UNSIGNED  		0x000007		/* 无符号整数 */
#define FLD_FLOAT_4		0x000008		/* 浮点,小数点后有4位 */

#ifndef zgx010517_added
#define FLD_SHORT		0x000009		/* Short integer */
#endif


#define S_F		scr->fields
#define PRMT_REV	(ptr->option&PROMPT_REV)

#define TITLE_ATT	0		/* 标题属性 0 正常 1 反显示*/

#define C_W	" ^W帮助"
#define L_W	7
#define K_UP	"↑项"
#define L_UP	4
#define K_DOWN	"↓项"
#define L_DOWN	4
#define K_LEFT	"←移"
#define L_LEFT	4
#define K_RIGHT	"→移"
#define L_RIGHT	4
#define C_X	"^X删除"
#define L_X	6
#define C_D	"^D清段"
#define L_D	6
#define C_C	"^C清屏"
#define L_C	6
#define C_ESC	" ESC确认"
#define L_ESC	8
#define C_DEL	"^U取消"
#define L_DEL	6
#define C_A	"^A模式: "
#define L_A	8
#define OVER	h_prompt(23, 73, "覆盖 ",0,1);
#define INSE	h_prompt(23, 73, "插入 ",0,1);

#define UPD_STR_LEN 80		/* 修改语句长度 */
#define INS_STR_LEN 80		/* 插入语句长度 */


/* 屏幕坐标 */
struct coor_st {
	int s_row,		/* 起始点 */
		s_col,
		e_row,		/* 终止点 */
		e_col;
};

/* 字段属性 */
struct field_st {
	char *field_name;			/* 对应数据库字段名 */
	unsigned option;	
		/*	PROMPT_REV		0x0020		 提示反显
			FLD_BEGIN		0x0080		 首字段
			FLD_END			0x0040		 尾字段
			FLD_INT			0x0001		 整数
			FLD_LONG		0x0002		 长整数
			FLD_MONEY		0x0003		 金额
			FLD_FLOAT		0x0004		 浮点
			FLD_STRING		0x0005		 字符串
			FLD_DATE		0x0006		 日期 
			FLD_UNSIGNED 		0x0007       无符号整数 
			FLD_FLOAT		0x0008		 浮点4
		*/
	int e_row,e_col;			/* 字段提示行,列 */
	char *string;				/* 提示内容 */
	int f_row,f_col;			/* 字段录入域坐标 */
	int f_width;				/* 字段录入域宽度 */
	void *field;				/* 对应字段值 */
	int (*fieldcheck)();			/* 对应字段检查函数指针 */
	int (*p_func)();			/* 相关检查函数指针 */
};
typedef struct field_st * p_field_st;

/* 屏幕结构 */
struct screen_st {
	char *screen_file;
	struct coor_st coor;				/* 屏幕坐标 */
	int field_count;				/* 本屏字段个数 */
	struct field_st *fields;			/* 字段指针 */
	int box_flg;					/* 是否画框 */
	char *tablename;				/* 对应主TABLE名 */
	int (*ins_func)();				/* 插入后调用的函数 */
	int (*del_func)();				/* 删除后调用的函数 */
	int (*upd_func)();				/* 修改后调用的函数 */
	int (*sql_proc)();				/* 数据库操作函数 */
};

#define h_prompt(row,col,ss,x,stan)	h_winprompt(stdscr,row,col,ss,x,stan)

#ifdef wyz_mod_020109
#else
typedef	struct {
	char	settle_date[9];
	char	logic_date[9];
	int	result;
	char	settle_op[7];
	char	update_date[9];
	char	update_time[7];
}SETTLE_RESULT;
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -