📄 curses.h
字号:
/**************************************************************************** COPYRIGHT NOTICE ****************************************************************************** ncurses is copyright (C) 1992-1995 ** Zeyd M. Ben-Halim ** zmbenhal@netcom.com ** Eric S. Raymond ** esr@snark.thyrsus.com ** ** Permission is hereby granted to reproduce and distribute ncurses ** by any means and for any fee, whether alone or as part of a ** larger distribution, in source or in binary form, PROVIDED ** this notice is included with any such distribution, and is not ** removed from any of its header files. Mention of ncurses in any ** applications linked with it is highly appreciated. ** ** ncurses comes AS IS with no warranty, implied or expressed. ** ****************************************************************************/#ifndef __NCURSES_H#define __NCURSES_H#define CURSES 1#define CURSES_H 1#define NCURSES_VERSION "1.9.9e"#ifndef _UNCTRL_Htypedef unsigned long chtype;#endif#include "stdio.h" #include "unctrl.h"#include "stdarg.h"#ifdef _XOPEN_SOURCE_EXTENDED#include <stddef.h> /* we want wchar_t */#endif /* _XOPEN_SOURCE_EXTENDED *//* XSI and SVr4 specify that curses implements 'bool'. However, C++ may also * implement it. If so, we must use the C++ compiler's type to avoid conflict * with other interfaces. * * To simplify use with/without the configuration script, we define the symbols * CXX_BUILTIN_BOOL and CXX_TYPE_OF_BOOL; they're edited by the configure * script. */#undef TRUE#undef FALSE#define CXX_BUILTIN_BOOL 1#define CXX_TYPE_OF_BOOL char#if defined(__cplusplus) && CXX_BUILTIN_BOOL#define TRUE ((CXX_TYPE_OF_BOOL)true)#define FALSE ((CXX_TYPE_OF_BOOL)false)#elsetypedef CXX_TYPE_OF_BOOL bool;#define TRUE ((bool)1)#define FALSE ((bool)0)#endif/* * XSI attributes. In the ncurses implementation, they are identical to the * A_ attributes because attr_t is just an int. The XSI Curses attr_* and * wattr_* entry points are all mapped to attr* and wattr* entry points. */#define WA_ATTRIBUTES 0xffffff00#define WA_NORMAL 0x00000000#define WA_STANDOUT 0x00010000#define WA_UNDERLINE 0x00020000#define WA_REVERSE 0x00040000#define WA_BLINK 0x00080000#define WA_DIM 0x00100000#define WA_BOLD 0x00200000#define WA_ALTCHARSET 0x00400000#define WA_INVIS 0x00800000#define WA_PROTECT 0x01000000#define WA_HORIZONTAL 0x02000000 /* XSI Curses attr -- not yet used */#define WA_LEFT 0x04000000 /* XSI Curses attr -- not yet used */#define WA_LOW 0x08000000 /* XSI Curses attr -- not yet used */#define WA_RIGHT 0x10000000 /* XSI Curses attr -- not yet used */#define WA_TOP 0x20000000 /* XSI Curses attr -- not yet used */#define WA_VERTICAL 0x40000000 /* XSI Curses attr -- not yet used *//* colors */extern int COLORS;extern int COLOR_PAIRS;extern unsigned char *color_pairs;#define COLOR_BLACK 0#define COLOR_RED 1#define COLOR_GREEN 2#define COLOR_YELLOW 3#define COLOR_BLUE 4#define COLOR_MAGENTA 5#define COLOR_CYAN 6#define COLOR_WHITE 7/* line graphics */extern chtype acs_map[];/* VT100 symbols begin here */#define ACS_ULCORNER (acs_map['l']) /* upper left corner */#define ACS_LLCORNER (acs_map['m']) /* lower left corner */#define ACS_URCORNER (acs_map['k']) /* upper right corner */#define ACS_LRCORNER (acs_map['j']) /* lower right corner */#define ACS_LTEE (acs_map['t']) /* tee pointing right */#define ACS_RTEE (acs_map['u']) /* tee pointing left */#define ACS_BTEE (acs_map['v']) /* tee pointing up */#define ACS_TTEE (acs_map['w']) /* tee pointing down */#define ACS_HLINE (acs_map['q']) /* horizontal line */#define ACS_VLINE (acs_map['x']) /* vertical line */#define ACS_PLUS (acs_map['n']) /* large plus or crossover */#define ACS_S1 (acs_map['o']) /* scan line 1 */#define ACS_S9 (acs_map['s']) /* scan line 9 */#define ACS_DIAMOND (acs_map['`']) /* diamond */#define ACS_CKBOARD (acs_map['a']) /* checker board (stipple) */#define ACS_DEGREE (acs_map['f']) /* degree symbol */#define ACS_PLMINUS (acs_map['g']) /* plus/minus */#define ACS_BULLET (acs_map['~']) /* bullet *//* Teletype 5410v1 symbols begin here */#define ACS_LARROW (acs_map[',']) /* arrow pointing left */#define ACS_RARROW (acs_map['+']) /* arrow pointing right */#define ACS_DARROW (acs_map['.']) /* arrow pointing down */#define ACS_UARROW (acs_map['-']) /* arrow pointing up */#define ACS_BOARD (acs_map['h']) /* board of squares */#define ACS_LANTERN (acs_map['I']) /* lantern symbol */#define ACS_BLOCK (acs_map['0']) /* solid square block *//* * These aren't documented, but a lot of System Vs have them anyway * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). * The ACS_names may not match AT&T's, our source didn't know them. */#define ACS_S3 (acs_map['p']) /* scan line 3 */#define ACS_S7 (acs_map['r']) /* scan line 7 */#define ACS_LEQUAL (acs_map['y']) /* less/equal */#define ACS_GEQUAL (acs_map['z']) /* greater/equal */#define ACS_PI (acs_map['{']) /* Pi */#define ACS_NEQUAL (acs_map['|']) /* not equal */#define ACS_STERLING (acs_map['}']) /* UK pound sign *//* * Line drawing ACS names are of the form ACS_trbl, where t is the top, r * is the right, b is the bottom, and l is the left. t, r, b, and l might * be B (blank), S (single), D (double), or T (thick). The subset defined * here only uses B and S. */ #define ACS_BSSB ACS_ULCORNER#define ACS_SSBB ACS_LLCORNER#define ACS_BBSS ACS_URCORNER#define ACS_SBBS ACS_LRCORNER#define ACS_SBSS ACS_RTEE#define ACS_SSSB ACS_LTEE#define ACS_SSBS ACS_BTEE#define ACS_BSSS ACS_TTEE#define ACS_BSBS ACS_HLINE#define ACS_SBSB ACS_VLINE#define ACS_SSSS ACS_PLUS#if !defined(ERR) || ((ERR) != -1)#define ERR (-1)#endif#if !defined(OK) || ((OK) != 0)#define OK (0)#endif/* values for the _flags member */#define _SUBWIN 0x01 /* is this a sub-window? */#define _ENDLINE 0x02 /* is the window flush right? */#define _FULLWIN 0x04 /* is the window full-screen? */#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */#define _ISPAD 0x10 /* is this window a pad? */#define _HASMOVED 0x20 /* has cursor moved since last refresh? */#define _NEED_WRAP 0x40 /* cursor wrap pending *//* * this value is used in the firstchar and lastchar fields to mark * unchanged lines */#define _NOCHANGE -1/* * this value is used in the oldindex field to mark lines created by insertions * and scrolls. */#define _NEWINDEX -1typedef struct screen SCREEN;typedef struct _win_st WINDOW;typedef chtype attr_t; /* ...must be at least as wide as chtype */#ifdef _XOPEN_SOURCE_EXTENDED#ifndef _WCHAR_Ttypedef unsigned long wchar_t;#endif /* _WCHAR_T */#ifndef _WINT_Ttypedef long int wint_t;#endif /* _WINT_T */#define CCHARW_MAX 5typedef struct{ attr_t attr; wchar_t chars[CCHARW_MAX];}cchar_t;#endif /* _XOPEN_SOURCE_EXTENDED */struct _win_st { short _cury, _curx; /* current cursor position */ /* window location and size */ short _maxy, _maxx; /* maximums of x and y, NOT window size */ short _begy, _begx; /* screen coords of upper-left-hand corner */ short _flags; /* window state flags */ /* attribute tracking */ attr_t _attrs; /* current attribute for non-space character */ chtype _bkgd; /* current background char/attribute pair */ /* option values set by user */ bool _notimeout; /* no time out on function-key entry? */ bool _clear; /* consider all data in the window invalid? */ bool _leaveok; /* OK to not reset cursor on exit? */ bool _scroll; /* OK to scroll this window? */ bool _idlok; /* OK to use insert/delete line? */ bool _idcok; /* OK to use insert/delete char? */ bool _immed; /* window in immed mode? (not yet used) */ bool _sync; /* window in sync mode? */ bool _use_keypad; /* process function keys into KEY_ symbols? */ int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ /* the actual line data */ struct ldat { chtype *text; /* text of the line */ short firstchar; /* first changed character in the line */ short lastchar; /* last changed character in the line */ short oldindex; /* index of the line at last update */ } *_line; /* global screen state */ short _regtop; /* top line of scrolling region */ short _regbottom; /* bottom line of scrolling region */ /* these are used only if this is a sub-window */ int _parx; /* x coordinate of this window in parent */ int _pary; /* y coordinate of this window in parent */ WINDOW *_parent; /* pointer to parent if a sub-window */ /* these are used only if this is a pad */ struct pdat { short _pad_y, _pad_x; short _pad_top, _pad_left; short _pad_bottom, _pad_right; } _pad;};extern WINDOW *stdscr, *curscr, *newscr;extern int LINES, COLS, TABSIZE;/* * This global was an undocumented feature under AIX curses. */extern int ESCDELAY; /* ESC expire time in milliseconds */#ifdef __cplusplusextern "C" {#endifextern char ttytype[]; /* needed for backward compatibility *//* * GCC (and some other compilers) define '__attribute__'; we're using this * macro to alert the compiler to flag inconsistencies in printf/scanf-like * function calls. Just in case '__attribute__' isn't defined, make a dummy. */#if !defined(__GNUC__) && !defined(__attribute__)#define __attribute__(p) /* nothing */#endif/* * Function prototypes. This is the complete XSI Curses list of required * functions. Those marked `generated' will have sources generated from the * macro definitions later in this file, in order to satisfy XPG4.2 * requirements. */extern int addch(const chtype); /* generated */extern int addchnstr(const chtype *, int); /* generated */extern int addchstr(const chtype *); /* generated */extern int addnstr(const char *, int); /* generated */extern int addstr(const char *); /* generated */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -