📄 curlib.h
字号:
#ifndef CURLIB_H#define CURLIB_H#define M_TERMINFO#ifndef XENIX #define UNIX#endif/* * System header files. */#include <curses.h>#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <math.h>#include <memory.h>#include <malloc.h>#include <signal.h>#include <string.h>#include <time.h>#include <varargs.h>/* * Macros define. *//*** 其 它 定 义 ***/#ifndef TRUE #define TRUE 1#endif#ifndef FALSE #define FALSE 0#endif#define DATA_LENGTH 512#ifndef NONE#define NONE 0x00#endif/*** 视 频 特 性 定 义 ***/#define EXTRA_COLOR 0x80#define COLOR_NUM 8#define COL(fg,bg) ((fg&EXTRA_COLOR)||(bg&EXTRA_COLOR))?COLOR_PAIR((fg&~EXTRA_COLOR)+(bg&~EXTRA_COLOR)*COLOR_NUM)|A_BOLD:COLOR_PAIR(fg+bg*COLOR_NUM)#define BLACK 0 /* 黑色 */#define RED 1 /* 红色 */#define GREEN 2 /* 绿色 */#define BROWN 3 /* 棕色 */#define BLUE 4 /* 蓝色 */ #define MAGENTA 5 /* 紫色 */#define CYAN 6 /* 青色 */#define WHITE 7 /* 白色 */#define GRAY BLACK|EXTRA_COLOR /* 灰色 */#define LT_RED RED|EXTRA_COLOR /* 高红色 */#define LT_GREEN GREEN|EXTRA_COLOR /* 高绿色 */#define YELLOW BROWN|EXTRA_COLOR /* 黄色 */#define LT_BLUE BLUE|EXTRA_COLOR /* 高蓝色 */ #define LT_MAGENTA MAGENTA|EXTRA_COLOR /* 高紫色 */#define LT_CYAN CYAN|EXTRA_COLOR /* 高青色 */#define HI_WHITE WHITE|EXTRA_COLOR /* 高白色 *//**** 键 盘 值 定 义 ***/#define KeyEsc 27 /* ESC KEY */#define KeyF1 77 /* F1 KEY */#define KeyTab 9 /* TAB KEY */#define KeyBkSpace 8 /* BACKSPACE KEY */#define KeyEnter 13 /* ENTER KEY */#define KeySpace 32 /* SPACE KEY */ #define KeyUp 65 /* UP KEY */#define KeyDown 66 /* DOWN KEY */#define KeyRight 67 /* RIGHT KEY */#define KeyLeft 68 /* LEFT KEY */#define KeyHome 72 /* HOME KEY */#define KeyEnd 70 /* END KEY */#define KeyPgUp 73 /* PgUp KEY */#define KeyPgDn 71 /* PgDn KEY */#define KeyIns 76 /* INSERT KEY *//* Date && time define */#define MONTH_STR "JanFebMarAprMayJunJulAugSepOctNovDec"#define WEEK_STR "SunMonTueWedThuFriSat"#define XQMB "日一二三四五六"#define YFMB "一二三四五六七八九十十一十二"#define NFMB "9091929394959697989900"#define DXSZ "零壹贰叁肆伍陆柒捌玖拾"#define DXJW "分角元拾佰仟万拾佰仟亿拾佰仟万拾佰仟亿"#define YMD 0x01 /* 991025 */#define YYMD 0x02 /* 19991025 */#define MDY 0x04 /* 102599 */#define MDYY 0x08 /* 10251999 */#define SYM_SLASH 0x10 /* 1999/10/25 */#define SYM_HYPHEN 0x20 /* 1999-10-25 */#define SYM_DOT 0x40 /* 1999.10.25 */#define SYM_COLON 0x80 /* 23:50:35 */#define SYM_CHINESE_UPPER 0x0100 /* 一九九九年十月二十五日 */#define SYM_CHINESE_LOWER 0x0200 /* 23时50分35秒 or 1999年10月25日 */#define SYM_CHINESE 0x0200 /* 23时50分35秒 or 1999年10月25日 */#define SYM_YYMD 0x0400 /* 'yymmdd' to 'yyyymmdd' *//* window style */#define WINDOW_CHINESE 0x0004#define WINDOW_ENGLISH 0x0008#define WINDOW_SHADE 0x0010#define WINDOW_NO_BOARD 0x1000/* Message box sytle */#define MSG_OK 1#define MSG_OC 2 /* OK CANCEL */#define MSG_YN 3 /* YES NO */#define MSG_YNC 4 /* YES NO CANCEL */#define MSG_RC 5 /* RETRY CANCEL */#define MSG_ARI 6 /* ABOUT RETRY IGNORE */#define MSG_AK 7 /* ANY KEY *//* Message box return value */#define ID_OK 0x01#define ID_NO 0x02#define ID_YES 0x04#define ID_CANCEL 0x08#define ID_ABORT 0x10#define ID_RETRY 0x20#define ID_IGNORE 0x40#define ID_ANYKEY 0x80/**** 菜 单 相 关 定 义 ***//* Menu's max level */#define MAX_MENU_LEVEL 10/* menu style */#define MENU_POPUP 0x0001#define MENU_PULLDOWN 0x0002#define MENU_RIGHT 0x0080#define MENU_LEFT 0x0100#define MENU_ACCEPT_NUMBER 0x0200#define MENU_DISP_NUMBER 0x0400#define MENU_DIRECT_ACCEPT 0x0800/* menu flag */#define NONE 0x00#define MF_GRAYED 0x01#define MF_ENABLED 0x02#define MF_CHECKED 0x04#define MF_UNCHECKED 0x08#define NOR 1#define REV 2/* Error code */#define ERR_OPEN_FILE -1#define ERR_READ_FILE -2#define ERR_FORMAT -3#define ERR_SYMBOL -4#define ERR_MEMORY -5#define ERR_LEVEL -6#define ERR_NO_SYMBOL -7#define ERR_NO_KEYWORD -8#define ERR_CREATE_WINDOW -9#define ERR_CREATE_MENU -10/* Keyword define */#define KEYWORD_BEGIN 0#define KEYWORD_POPUP 1#define KEYWORD_MENUITEM 2#define KEYWORD_END 3#define KEYWORD_WINDOWSTYLE 4#define KEYWORD_MENUSTYLE 5#define KEYWORD_MENUCOLOR 6#define KEYWORD_MENUSITE 7#define KEYWORD_MENUTITLE 8/* * Type define. */typedef unsigned char uchar;typedef unsigned long ulong;/* * 该结构都是基于stdscr屏幕. */typedef struct window_s { uchar sy; uchar sx; uchar row; uchar col; chtype tattr; chtype battr; chtype style; chtype *buf; /* save screen content */} window_t;/*----------------------------------------------------------------------------*//* Menu item define */typedef struct menuitem_s { int id; char *text; chtype flag; /* CHECKED, UNCHECKED, GRAYED, ENABLED */ uchar index; uchar site; /* y or x coordinate */ struct menuitem_s *next; struct menuitem_s *prev; struct menu_s *child;} menuitem_t;/* Menu windows define */typedef struct menu_s { window_t *win; menuitem_t *hitem; /* header item ptr */ menuitem_t *citem; /* current item ptr */ struct menu_s *parent;} menu_t;typedef struct { uchar tfg; /* text foreground color */ uchar tbg; /* text background color */ uchar bfg; /* board foreground color */ uchar bbg; /* board background color */ uchar mfg; /* menu client foreground color */ uchar mbg; /* menu client background color */ uchar sbg; /* Select item background color */ uchar afg; /* Alt-alp foreground color */} menucolor_t;typedef struct { menucolor_t color; uchar status; /* 0: init 1: pulldown */ uchar sy; uchar sx; uchar interval; /* only for pulldown's top menu */ menu_t *menu;} menuhead_t;/* * Extern variable decleare. */extern uchar screen_starty;/* screen 左上角 starty */extern uchar screen_startx;/* screen 左上角 startx */extern uchar screen_endy;/* screen 右下角 endy */extern uchar screen_endx;/* screen 右下角 endx */extern uchar screen_maxrow;/* screen 最大行 */extern uchar screen_maxcol;/* screen 最大列 */extern chtype title_attr;/* 标题(前景色,背景色) */extern chtype text_attr; /* 正文(前景色,背景色) */extern chtype box_attr; /* 边框(前景色,背景色) */extern chtype select_attr;/* 选项(前景色,背景色) */extern chtype screen_attr;/* 屏幕(前景色,背景色) */extern chtype shade_attr; /* 阴影(前景色,背景色) */extern chtype window_style;/* * Extern function decleare. *//****************************************************************************** * <第一章> 屏幕窗口函数(windows). * ******************************************************************************//*----------------------------------------------------------------------------* * Function: Initialize screen. * Argument: * None. * Return : * TRUE: successed. * FALSE: failured. *----------------------------------------------------------------------------*/extern int begin_work(void);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -