source: vendor/emx/current/bsd/curses/curses.h

Last change on this file was 272, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 7.8 KB
Line 
1/*
2 * Copyright (c) 1981 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)curses.h 5.9 (Berkeley) 7/1/90
34 */
35
36#if defined (__cplusplus)
37extern "C" {
38#endif
39
40#ifndef WINDOW
41
42#include <stdio.h>
43#include <sys/ioctl.h>
44#include <sys/termio.h>
45typedef struct termio SGTTY;
46
47#define bool char
48#define reg register
49
50#define TRUE (1)
51#define FALSE (0)
52#define ERR (0)
53#define OK (1)
54
55#define _ENDLINE 001
56#define _FULLWIN 002
57#define _SCROLLWIN 004
58#define _FLUSH 010
59#define _FULLLINE 020
60#define _IDLINE 040
61#define _STANDOUT 0200
62#define _NOCHANGE -1
63
64#define _puts(s) tputs(s, 0, _putchar)
65
66/*
67 * Capabilities from termcap
68 */
69
70extern bool AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL,
71 XB, XN, XT, XS, XX;
72extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
73 *DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6,
74 *K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL,
75 *KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF,
76 *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS,
77 *VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
78 *LEFT_PARM, *RIGHT_PARM;
79extern char PC;
80
81/*
82 * From the tty modes...
83 */
84
85extern bool GT, NONL, UPPERCASE, normtty, _pfast;
86
87struct _win_st {
88 short _cury, _curx;
89 short _maxy, _maxx;
90 short _begy, _begx;
91 short _flags;
92 short _ch_off;
93 bool _clear;
94 bool _leave;
95 bool _scroll;
96 char **_y;
97 short *_firstch;
98 short *_lastch;
99 struct _win_st *_nextp, *_orig;
100};
101
102#define WINDOW struct _win_st
103
104extern bool My_term, _echoit, _rawmode, _endwin;
105extern char *Def_term, ttytype[];
106extern int LINES, COLS, _tty_ch, _res_flg;
107extern SGTTY _tty;
108extern WINDOW *stdscr, *curscr;
109
110#define VOID(x) (x)
111
112/*
113 * pseudo functions for standard screen
114 */
115#define addch(ch) VOID(waddch(stdscr, ch))
116#define getch() VOID(wgetch(stdscr))
117#define addbytes(da,co) VOID(waddbytes(stdscr, da,co))
118#define addstr(str) VOID(waddbytes(stdscr, str, strlen(str)))
119#define getstr(str) VOID(wgetstr(stdscr, str))
120#define move(y, x) VOID(wmove(stdscr, y, x))
121#define clear() VOID(wclear(stdscr))
122#define erase() VOID(werase(stdscr))
123#define clrtobot() VOID(wclrtobot(stdscr))
124#define clrtoeol() VOID(wclrtoeol(stdscr))
125#define insertln() VOID(winsertln(stdscr))
126#define deleteln() VOID(wdeleteln(stdscr))
127#define refresh() VOID(wrefresh(stdscr))
128#define inch() VOID(winch(stdscr))
129#define insch(c) VOID(winsch(stdscr,c))
130#define delch() VOID(wdelch(stdscr))
131#define standout() VOID(wstandout(stdscr))
132#define standend() VOID(wstandend(stdscr))
133
134/*
135 * mv functions
136 */
137#define mvwaddch(win,y,x,ch) VOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch))
138#define mvwgetch(win,y,x) VOID(wmove(win,y,x)==ERR?ERR:wgetch(win))
139#define mvwaddbytes(win,y,x,da,co) \
140 VOID(wmove(win,y,x)==ERR?ERR:waddbytes(win,da,co))
141#define mvwaddstr(win,y,x,str) \
142 VOID(wmove(win,y,x)==ERR?ERR:waddbytes(win,str,strlen(str)))
143#define mvwgetstr(win,y,x,str) VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
144#define mvwinch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : winch(win))
145#define mvwdelch(win,y,x) VOID(wmove(win,y,x) == ERR ? ERR : wdelch(win))
146#define mvwinsch(win,y,x,c) VOID(wmove(win,y,x) == ERR ? ERR:winsch(win,c))
147#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
148#define mvgetch(y,x) mvwgetch(stdscr,y,x)
149#define mvaddbytes(y,x,da,co) mvwaddbytes(stdscr,y,x,da,co)
150#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
151#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
152#define mvinch(y,x) mvwinch(stdscr,y,x)
153#define mvdelch(y,x) mvwdelch(stdscr,y,x)
154#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
155
156/*
157 * pseudo functions
158 */
159
160#define clearok(win,bf) (win->_clear = bf)
161#define leaveok(win,bf) (win->_leave = bf)
162#define scrollok(win,bf) (win->_scroll = bf)
163#define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
164#define getyx(win,y,x) y = win->_cury, x = win->_curx
165#define winch(win) (win->_y[win->_cury][win->_curx])
166
167#define crmode() cbreak() /* backwards compatability */
168#define nocrmode() nocbreak() /* backwards compatability */
169
170#define noraw() _setraw(0)
171#define raw() _setraw(1)
172#define nocbreak() _setraw(2)
173#define cbreak() _setraw(3)
174#define echo() _setecho(1)
175#define noecho() _setecho(0)
176#define nl() _setnl(1)
177#define nonl() _setnl(0)
178
179/*
180 * Used to be in unctrl.h.
181 */
182#define unctrl(c) _unctrl[(c) & 0377]
183extern char *_unctrl[];
184
185int baudrate (void);
186int box (WINDOW *win, int vert, int hor);
187int delwin (WINDOW *win);
188int endwin (void);
189int erasechar (void);
190char *getcap (char *name);
191int gettmode (void);
192WINDOW *initscr (void);
193int killchar (void);
194char *longname (char *bp, char *def);
195int mvcur (int ly, int lx, int y, int x);
196int mvprintw (int y, int x, const char *fmt, ...);
197int mvscanw (int y, int x, const char *fmt, ...);
198int mvwin (WINDOW *win, int by, int bx);
199int mvwprintw (WINDOW *win, int y, int x, const char *fmt, ...);
200int mvwscanw (WINDOW *win, int y, int x, const char *fmt, ...);
201WINDOW *newwin (int num_lines, int num_cols, int begy, int begx);
202int overlay (WINDOW *win1, WINDOW *win2);
203int overwrite (WINDOW *win1, WINDOW *win2);
204int printw (const char *fmt, ...);
205int resetty (void);
206int savetty (void);
207int scanw (const char *fmt, ...);
208int scroll (WINDOW *win);
209int setterm (char *type);
210WINDOW *subwin (WINDOW *orig, int num_lines, int num_cols, int begy, int begx);
211int touchline (WINDOW *win, int y, int sx, int ex);
212int touchwin (WINDOW *win);
213int waddbytes (reg WINDOW *win, reg char *bytes, reg int count);
214int waddch (WINDOW *win, int c);
215int waddstr (reg WINDOW *win, reg char *str);
216int wclear (WINDOW *win);
217int wclrtobot (WINDOW *win);
218int wclrtoeol (WINDOW *win);
219int wdelch (WINDOW *win);
220int wdeleteln (WINDOW *win);
221int werase (WINDOW *win);
222int wgetch (WINDOW *win);
223int wgetstr (WINDOW *win, char *str);
224int winsch (WINDOW *win, int c);
225int winsertln (WINDOW *win);
226int wmove (WINDOW *win, int y, int x);
227int wprintw (WINDOW *win, const char *fmt, ...);
228int wrefresh (WINDOW *win);
229int wscanw (WINDOW *win, const char *fmt, ...);
230char *wstandend (WINDOW *win);
231char *wstandout (WINDOW *win);
232char _putchar (int c);
233int _setecho (int on);
234int _setnl (int on);
235int _setraw (int on);
236
237#if defined (__cplusplus)
238}
239#endif
240
241#endif
Note: See TracBrowser for help on using the repository browser.