Browse Source

- multiple static inline definitions added

- changes made to some constants and macros
- changes made to _curses_screen struct
- identified and removed prototypes for yet more unsupportable functions
tags/v0.9.3
Dan Lynch 18 years ago
parent
commit
e442447f37
1 changed files with 194 additions and 103 deletions
  1. 194
    103
      src/include/curses.h

+ 194
- 103
src/include/curses.h View File

11
  */
11
  */
12
 
12
 
13
 #undef  ERR
13
 #undef  ERR
14
-#define ERR	(1)
14
+#define ERR	(-1)
15
 
15
 
16
 #undef  FALSE
16
 #undef  FALSE
17
 #define FALSE	(0)
17
 #define FALSE	(0)
22
 #undef  TRUE
22
 #undef  TRUE
23
 #define TRUE	(1)
23
 #define TRUE	(1)
24
 
24
 
25
-typedef uint32_t bool;
25
+typedef short bool;
26
 typedef uint32_t chtype;
26
 typedef uint32_t chtype;
27
-typedef chtype attr_t;
27
+typedef uint32_t attr_t;
28
 
28
 
29
 /** Curses SCREEN object */
29
 /** Curses SCREEN object */
30
 typedef struct _curses_screen {
30
 typedef struct _curses_screen {
31
+	void ( *init ) ( struct _curses_screen *scr );
32
+	void ( *exit ) ( struct _curses_screen *scr );
31
 	/**
33
 	/**
32
 	 * Move cursor to position specified by x,y coords
34
 	 * Move cursor to position specified by x,y coords
33
 	 *
35
 	 *
45
 	 */
47
 	 */
46
 	void ( * putc ) ( struct _curses_screen *scr, chtype c );
48
 	void ( * putc ) ( struct _curses_screen *scr, chtype c );
47
 	/**
49
 	/**
48
-	 * Read a character
50
+	 * Pop a character from the keyboard input stream
49
 	 *
51
 	 *
50
 	 * @v scr	screen on which to operate
52
 	 * @v scr	screen on which to operate
51
-	 * @ret c	character
53
+	 * @ret c	popped character
52
 	 */
54
 	 */
53
 	int ( * getc ) ( struct _curses_screen *scr );
55
 	int ( * getc ) ( struct _curses_screen *scr );
56
+	/**
57
+	 * Checks to see whether a character is waiting in the input stream
58
+	 *
59
+	 * @v scr	screen on which to operate
60
+	 * @ret TRUE	character waiting in stream
61
+	 * @ret FALSE	no character waiting in stream
62
+	 */
63
+	bool ( *peek ) ( struct _curses_screen *scr );
54
 } SCREEN;
64
 } SCREEN;
55
 
65
 
56
 /** Curses Window struct */
66
 /** Curses Window struct */
65
 	unsigned int curs_x, curs_y;
75
 	unsigned int curs_x, curs_y;
66
 	/** window dimensions */
76
 	/** window dimensions */
67
 	unsigned int width, height;
77
 	unsigned int width, height;
68
-	/** parent/child ptrs */
69
-	struct _curses_window *parent, *child;
78
+	/** parent window */
79
+	struct _curses_window *parent;
80
+	/** windows that share the same parent as this one */
81
+	//struct list_head siblings;
82
+	/** windows der'd or sub'd from this one */
83
+	//struct list_head children;
70
 } WINDOW;
84
 } WINDOW;
71
 
85
 
72
 extern WINDOW _stdscr;
86
 extern WINDOW _stdscr;
73
 extern SCREEN _curscr;
87
 extern SCREEN _curscr;
74
 extern unsigned short _COLS;
88
 extern unsigned short _COLS;
75
 extern unsigned short _LINES;
89
 extern unsigned short _LINES;
76
-extern unsigned short _COLOURS;
77
-extern unsigned int *_COLOUR_PAIRS;
90
+extern unsigned int _COLOURS;
91
+extern unsigned int _COLOUR_PAIRS;
78
 
92
 
79
 #define stdscr ( &_stdscr )
93
 #define stdscr ( &_stdscr )
80
 #define curscr ( &_curscr )
94
 #define curscr ( &_curscr )
81
 #define COLS _COLS
95
 #define COLS _COLS
82
 #define LINES _LINES
96
 #define LINES _LINES
83
 #define COLORS _COLOURS
97
 #define COLORS _COLOURS
84
-#define COLOR_PAIRS COLOUR_PAIRS
98
+#define COLOR_PAIRS _COLOUR_PAIRS
85
 
99
 
86
 #define MUCURSES_BITS( mask, shift ) (( mask ) << (shift))
100
 #define MUCURSES_BITS( mask, shift ) (( mask ) << (shift))
87
 #define CPAIR_SHIFT	8
101
 #define CPAIR_SHIFT	8
116
 
130
 
117
 #define A_ATTRIBUTES	( MUCURSES_BITS( 1UL, ATTRS_SHIFT ) - 1UL )
131
 #define A_ATTRIBUTES	( MUCURSES_BITS( 1UL, ATTRS_SHIFT ) - 1UL )
118
 #define A_CHARTEXT	( MUCURSES_BITS( 1UL, 0 ) - 1UL )
132
 #define A_CHARTEXT	( MUCURSES_BITS( 1UL, 0 ) - 1UL )
119
-#define A_COLOR		MUCURSES_BITS( ( 1UL << 8 ) - 1UL, CPAIR_SHIFT )
133
+#define A_COLOUR	MUCURSES_BITS( ( 1UL << 8 ) - 1UL, CPAIR_SHIFT )
134
+#define A_COLOR		A_COLOUR
120
 
135
 
121
 #define ACS_ULCORNER	'+'
136
 #define ACS_ULCORNER	'+'
122
 #define ACS_LLCORNER	'+'
137
 #define ACS_LLCORNER	'+'
145
 #define ACS_BLOCK	'#'
160
 #define ACS_BLOCK	'#'
146
 
161
 
147
 #define COLOUR_BLACK	0
162
 #define COLOUR_BLACK	0
148
-#define COLOUR_BLUE	1
163
+#define COLOUR_RED	1
149
 #define COLOUR_GREEN	2
164
 #define COLOUR_GREEN	2
150
-#define COLOUR_CYAN	3
151
-#define COLOUR_RED	4
165
+#define COLOUR_YELLOW	3
166
+#define COLOUR_BLUE	4
152
 #define COLOUR_MAGENTA	5
167
 #define COLOUR_MAGENTA	5
153
-#define COLOUR_YELLOW	6
168
+#define COLOUR_CYAN	6
154
 #define COLOUR_WHITE	7
169
 #define COLOUR_WHITE	7
155
 
170
 
171
+#define COLOUR_FG	30
172
+#define COLOUR_BG	40
173
+#define COLOR_FG	COLOUR_FG
174
+#define COLOR_BG	COLOUR_BG
175
+
156
 #define COLOR_BLACK	COLOUR_BLACK
176
 #define COLOR_BLACK	COLOUR_BLACK
157
 #define COLOR_BLUE	COLOUR_BLUE
177
 #define COLOR_BLUE	COLOUR_BLUE
158
 #define COLOR_GREEN	COLOUR_GREEN
178
 #define COLOR_GREEN	COLOUR_GREEN
258
 
278
 
259
 #define KEY_MAX		0777		/* Maximum key value is 0633 */
279
 #define KEY_MAX		0777		/* Maximum key value is 0633 */
260
 
280
 
261
-/*extern int addch ( const chtype * );*/
262
-/*extern int addchnstr ( const chtype *, int );*/
263
-/*extern int addchstr ( const chtype * );*/
264
-/*extern int addnstr ( const char *, int );*/
265
-/*extern int addstr ( const char * );*/
266
-/*extern int attroff ( int );*/
267
-/*extern int attron ( int );*/
268
-/*extern int attrset ( int );*/
281
+//extern int addch ( const chtype * );
282
+//extern int addchnstr ( const chtype *, int );
283
+//extern int addchstr ( const chtype * );
284
+//extern int addnstr ( const char *, int );
285
+//extern int addstr ( const char * );
286
+//extern int attroff ( int );
287
+//extern int attron ( int );
288
+//extern int attrset ( int );
269
 extern int attr_get ( attr_t *, short *, void * );
289
 extern int attr_get ( attr_t *, short *, void * );
270
 extern int attr_off ( attr_t, void * );
290
 extern int attr_off ( attr_t, void * );
271
 extern int attr_on ( attr_t, void * );
291
 extern int attr_on ( attr_t, void * );
272
 extern int attr_set ( attr_t, short, void * );
292
 extern int attr_set ( attr_t, short, void * );
273
 extern int baudrate ( void );
293
 extern int baudrate ( void );
274
 extern int beep ( void );
294
 extern int beep ( void );
275
-/*extern void bkgdset ( chtype );*/
295
+//extern void bkgdset ( chtype );
276
 /*extern int border ( chtype, chtype, chtype, chtype, chtype, chtype, chtype,
296
 /*extern int border ( chtype, chtype, chtype, chtype, chtype, chtype, chtype,
277
   chtype );*/
297
   chtype );*/
278
 extern int box ( WINDOW *, chtype, chtype );
298
 extern int box ( WINDOW *, chtype, chtype );
279
 extern bool can_change_colour ( void );
299
 extern bool can_change_colour ( void );
280
 #define can_change_color() can_change_colour()
300
 #define can_change_color() can_change_colour()
281
 extern int cbreak ( void ); 
301
 extern int cbreak ( void ); 
282
-/*extern int clrtobot ( void );*/
283
-/*extern int clrtoeol ( void );*/
302
+//extern int clrtobot ( void );
303
+//extern int clrtoeol ( void );
284
 extern int colour_content ( short, short *, short *, short * );
304
 extern int colour_content ( short, short *, short *, short * );
285
-#define color_content( col, r, g, b ) colour_content( (col), (r), (g), (b) )
286
-/*extern int colour_set ( short, void * );*/
287
-/*#define color_set( cpno, opts ) colour_set( (cpno), (opts) )*/
305
+#define color_content( c, r, g, b ) colour_content( (c), (r), (g), (b) )
306
+//extern int colour_set ( short, void * );
307
+//#define color_set( cpno, opts ) colour_set( (cpno), (opts) )
288
 extern int copywin ( const WINDOW *, WINDOW *, int, int, int, 
308
 extern int copywin ( const WINDOW *, WINDOW *, int, int, int, 
289
 		     int, int, int, int );
309
 		     int, int, int, int );
290
 extern int curs_set ( int );
310
 extern int curs_set ( int );
291
 extern int def_prog_mode ( void );
311
 extern int def_prog_mode ( void );
292
 extern int def_shell_mode ( void );
312
 extern int def_shell_mode ( void );
293
 extern int delay_output ( int );
313
 extern int delay_output ( int );
294
-/*extern int delch ( void );*/
295
-/*extern int deleteln ( void );*/
314
+//extern int delch ( void );
315
+//extern int deleteln ( void );
296
 extern void delscreen ( SCREEN * );
316
 extern void delscreen ( SCREEN * );
297
 extern int delwin ( WINDOW * );
317
 extern int delwin ( WINDOW * );
298
 extern WINDOW *derwin ( WINDOW *, int, int, int, int );
318
 extern WINDOW *derwin ( WINDOW *, int, int, int, int );
299
-/*extern int doupdate ( void );*/
319
+//extern int doupdate ( void );
300
 extern WINDOW *dupwin ( WINDOW * );
320
 extern WINDOW *dupwin ( WINDOW * );
301
 extern int echo ( void );
321
 extern int echo ( void );
302
 extern int echochar ( const chtype );
322
 extern int echochar ( const chtype );
303
 extern int endwin ( void );
323
 extern int endwin ( void );
304
 extern char erasechar ( void );
324
 extern char erasechar ( void );
305
-extern int erase ( void );
325
+//extern int erase ( void );
306
 extern void filter ( void );
326
 extern void filter ( void );
307
 extern int flash ( void );
327
 extern int flash ( void );
308
 extern int flushinp ( void );
328
 extern int flushinp ( void );
309
 extern chtype getbkgd ( WINDOW * );
329
 extern chtype getbkgd ( WINDOW * );
310
-extern int getch ( void );
311
-extern int getnstr ( char *, int );
312
-extern int getstr ( char * );
330
+//extern int getch ( void );
331
+//extern int getnstr ( char *, int );
332
+//extern int getstr ( char * );
313
 extern int halfdelay ( int );
333
 extern int halfdelay ( int );
314
 extern bool has_colors ( void );
334
 extern bool has_colors ( void );
315
 extern bool has_ic ( void );
335
 extern bool has_ic ( void );
317
 //extern int hline ( chtype, int );
337
 //extern int hline ( chtype, int );
318
 extern void idcok ( WINDOW *, bool );
338
 extern void idcok ( WINDOW *, bool );
319
 extern int idlok ( WINDOW *, bool );
339
 extern int idlok ( WINDOW *, bool );
320
-extern void immedok ( WINDOW *, bool );
321
-/*extern chtype inch ( void );*/
322
-/*extern int inchnstr ( chtype *, int );*/
323
-/*extern int inchstr ( chtype * );*/
340
+//extern void immedok ( WINDOW *, bool );
341
+//extern chtype inch ( void );
342
+//extern int inchnstr ( chtype *, int );
343
+//extern int inchstr ( chtype * );
324
 extern WINDOW *initscr ( void );
344
 extern WINDOW *initscr ( void );
325
-extern int init_color ( short, short, short, short );
345
+extern int init_colour ( short, short, short, short );
346
+#define init_color ( c, r, g, b ) init_colour ( (c), (r), (g), (b) )
326
 extern int init_pair ( short, short, short );
347
 extern int init_pair ( short, short, short );
327
 //extern int innstr ( char *, int );
348
 //extern int innstr ( char *, int );
328
 //extern int insch ( chtype );
349
 //extern int insch ( chtype );
331
 //extern int instr ( char * );
352
 //extern int instr ( char * );
332
 extern int intrflush ( WINDOW *, bool );
353
 extern int intrflush ( WINDOW *, bool );
333
 extern bool isendwin ( void );
354
 extern bool isendwin ( void );
334
-extern bool is_linetouched ( WINDOW *, int );
335
-extern bool is_wintouched ( WINDOW * );
355
+//extern bool is_linetouched ( WINDOW *, int );
356
+//extern bool is_wintouched ( WINDOW * );
336
 extern char *keyname ( int );
357
 extern char *keyname ( int );
337
 extern int keypad ( WINDOW *, bool );
358
 extern int keypad ( WINDOW *, bool );
338
 extern char killchar ( void );
359
 extern char killchar ( void );
339
 extern int leaveok ( WINDOW *, bool );
360
 extern int leaveok ( WINDOW *, bool );
340
 extern char *longname ( void );
361
 extern char *longname ( void );
341
 extern int meta ( WINDOW *, bool );
362
 extern int meta ( WINDOW *, bool );
342
-/*extern int move ( int, int );*/
343
-/*extern int mvaddch ( int, int, const chtype );*/
344
-/*extern int mvaddchnstr ( int, int, const chtype *, int );*/
345
-/*extern int mvaddchstr ( int, int, const chtype * );*/
346
-/*extern int mvaddnstr ( int, int, const char *, int );*/
347
-/*extern int mvaddstr ( int, int, const char * );*/
363
+//extern int move ( int, int );
364
+//extern int mvaddch ( int, int, const chtype );
365
+//extern int mvaddchnstr ( int, int, const chtype *, int );
366
+//extern int mvaddchstr ( int, int, const chtype * );
367
+//extern int mvaddnstr ( int, int, const char *, int );
368
+//extern int mvaddstr ( int, int, const char * );
348
 extern int mvcur ( int, int, int, int );
369
 extern int mvcur ( int, int, int, int );
349
-/*extern int mvdelch ( int, int );*/
370
+//extern int mvdelch ( int, int );
350
 extern int mvderwin ( WINDOW *, int, int );
371
 extern int mvderwin ( WINDOW *, int, int );
351
-extern int mvgetch ( int, int );
352
-extern int mvgetnstr ( int, int, char *, int );
353
-extern int mvgetstr ( int, int, char * );
372
+//extern int mvgetch ( int, int );
373
+//extern int mvgetnstr ( int, int, char *, int );
374
+//extern int mvgetstr ( int, int, char * );
354
 //extern int mvhline ( int, int, chtype, int );
375
 //extern int mvhline ( int, int, chtype, int );
355
 //extern chtype mvinch ( int, int );
376
 //extern chtype mvinch ( int, int );
356
-/*extern int mvinchnstr ( int, int, chtype *, int );*/
357
-/*extern int mvinchstr ( int, int, chtype * );*/
358
-/*extern int mvinnstr ( int, int, char *, int );*/
377
+//extern int mvinchnstr ( int, int, chtype *, int );
378
+//extern int mvinchstr ( int, int, chtype * );
379
+//extern int mvinnstr ( int, int, char *, int );
359
 //extern int mvinsch ( int, int, chtype );
380
 //extern int mvinsch ( int, int, chtype );
360
 //extern int mvinsnstr ( int, int, const char *, int );
381
 //extern int mvinsnstr ( int, int, const char *, int );
361
 //extern int mvinsstr ( int, int, const char * );
382
 //extern int mvinsstr ( int, int, const char * );
362
 //extern int mvinstr ( int, int, char * );
383
 //extern int mvinstr ( int, int, char * );
363
 //extern int mvprintw ( int, int, char *,  ... );
384
 //extern int mvprintw ( int, int, char *,  ... );
364
-extern int mvscanw ( int, int, char *, ... );
385
+//extern int mvscanw ( int, int, char *, ... );
365
 //extern int mvvline ( int, int, chtype, int );
386
 //extern int mvvline ( int, int, chtype, int );
366
-/*extern int mvwaddch ( WINDOW *, int, int, const chtype );*/
367
-/*extern int mvwaddchnstr ( WINDOW *, int, int, const chtype *, int );*/
368
-/*extern int mvwaddchstr ( WINDOW *, int, int, const chtype * );*/
369
-/*extern int mvwaddnstr ( WINDOW *, int, int, const char *, int );*/
370
-/*extern int mvwaddstr ( WINDOW *, int, int, const char * );*/
371
-/*extern int mvwdelch ( WINDOW *, int, int );*/
372
-extern int mvwgetch ( WINDOW *, int, int );
373
-extern int mvwgetnstr ( WINDOW *, int, int, char *, int );
374
-extern int mvwgetstr ( WINDOW *, int, int, char * );
387
+//extern int mvwaddch ( WINDOW *, int, int, const chtype );
388
+//extern int mvwaddchnstr ( WINDOW *, int, int, const chtype *, int );
389
+//extern int mvwaddchstr ( WINDOW *, int, int, const chtype * );
390
+//extern int mvwaddnstr ( WINDOW *, int, int, const char *, int );
391
+//extern int mvwaddstr ( WINDOW *, int, int, const char * );
392
+//extern int mvwdelch ( WINDOW *, int, int );
393
+//extern int mvwgetch ( WINDOW *, int, int );
394
+//extern int mvwgetnstr ( WINDOW *, int, int, char *, int );
395
+//extern int mvwgetstr ( WINDOW *, int, int, char * );
375
 //extern int mvwhline ( WINDOW *, int, int, chtype, int );
396
 //extern int mvwhline ( WINDOW *, int, int, chtype, int );
376
 extern int mvwin ( WINDOW *, int, int );
397
 extern int mvwin ( WINDOW *, int, int );
377
 //extern chtype mvwinch ( WINDOW *, int, int );
398
 //extern chtype mvwinch ( WINDOW *, int, int );
383
 //extern int mvwinsstr ( WINDOW *, int, int, const char * );
404
 //extern int mvwinsstr ( WINDOW *, int, int, const char * );
384
 //extern int mvwinstr ( WINDOW *, int, int, char * );
405
 //extern int mvwinstr ( WINDOW *, int, int, char * );
385
 //extern int mvwprintw ( WINDOW *, int, int, char *, ... );
406
 //extern int mvwprintw ( WINDOW *, int, int, char *, ... );
386
-extern int mvwscanw ( WINDOW *, int, int, char *, ... );
407
+//extern int mvwscanw ( WINDOW *, int, int, char *, ... );
387
 //extern int mvwvline ( WINDOW *, int, int, chtype, int );
408
 //extern int mvwvline ( WINDOW *, int, int, chtype, int );
388
 extern int napms ( int );
409
 extern int napms ( int );
389
-extern WINDOW *newpad ( int, int );
410
+//extern WINDOW *newpad ( int, int );
390
 extern WINDOW *newwin ( int, int, int, int );
411
 extern WINDOW *newwin ( int, int, int, int );
391
 extern int nl ( void );
412
 extern int nl ( void );
392
 extern int nocbreak ( void );
413
 extern int nocbreak ( void );
400
 extern int overwrite ( const WINDOW *, WINDOW * );
421
 extern int overwrite ( const WINDOW *, WINDOW * );
401
 extern int pair_content ( short, short *, short * );
422
 extern int pair_content ( short, short *, short * );
402
 extern int PAIR_NUMBER ( int );
423
 extern int PAIR_NUMBER ( int );
403
-extern int pechochar ( WINDOW *, chtype );
404
-extern int pnoutrefresh ( WINDOW *, int, int, int, int, int, int );
405
-extern int prefresh ( WINDOW *, int, int, int, int, int, int );
424
+//extern int pechochar ( WINDOW *, chtype );
425
+//extern int pnoutrefresh ( WINDOW *, int, int, int, int, int, int );
426
+//extern int prefresh ( WINDOW *, int, int, int, int, int, int );
406
 extern int printw ( char *, ... );
427
 extern int printw ( char *, ... );
407
 extern int putp ( const char * );
428
 extern int putp ( const char * );
408
 extern void qiflush ( void );
429
 extern void qiflush ( void );
409
 extern int raw ( void );
430
 extern int raw ( void );
410
-/*extern int redrawwin ( WINDOW * );*/
411
-/*extern int refresh ( void );*/
431
+//extern int redrawwin ( WINDOW * );
432
+//extern int refresh ( void );
412
 extern int reset_prog_mode ( void );
433
 extern int reset_prog_mode ( void );
413
 extern int reset_shell_mode ( void );
434
 extern int reset_shell_mode ( void );
414
 extern int resetty ( void );
435
 extern int resetty ( void );
415
-extern int ripoffline ( int, int  ( *) ( WINDOW *, int) );
436
+extern int ripoffline ( int, int  (*) ( WINDOW *, int) );
416
 extern int savetty ( void );
437
 extern int savetty ( void );
417
-extern int scanw ( char *, ... );
418
-extern int scrl ( int );
419
-extern int scroll ( WINDOW * );
420
-extern int scrollok ( WINDOW *, bool );
421
-extern int setscrreg ( int, int );
438
+//extern int scanw ( char *, ... );
439
+//extern int scrl ( int );
440
+//extern int scroll ( WINDOW * );
441
+//extern int scrollok ( WINDOW *, bool );
442
+//extern int setscrreg ( int, int );
422
 extern SCREEN *set_term ( SCREEN * );
443
 extern SCREEN *set_term ( SCREEN * );
423
 extern int setupterm ( char *, int, int * );
444
 extern int setupterm ( char *, int, int * );
424
 extern int slk_attr_off ( const attr_t, void * );
445
 extern int slk_attr_off ( const attr_t, void * );
428
 extern int slk_attr_set ( const attr_t, short, void * );
449
 extern int slk_attr_set ( const attr_t, short, void * );
429
 extern int slk_attrset ( const chtype );
450
 extern int slk_attrset ( const chtype );
430
 extern int slk_clear ( void );
451
 extern int slk_clear ( void );
431
-extern int slk_color ( short );
452
+extern int slk_colour ( short );
453
+#define slk_color( c ) slk_colour( (c) )
432
 extern int slk_init ( int );
454
 extern int slk_init ( int );
433
 extern char *slk_label ( int );
455
 extern char *slk_label ( int );
434
 extern int slk_noutrefresh ( void );
456
 extern int slk_noutrefresh ( void );
435
-extern int slk_refresh ( void );
457
+//extern int slk_refresh ( void );
436
 extern int slk_restore ( void );
458
 extern int slk_restore ( void );
437
 extern int slk_set ( int, const char *, int );
459
 extern int slk_set ( int, const char *, int );
438
 extern int slk_touch ( void );
460
 extern int slk_touch ( void );
439
 extern int standend ( void );
461
 extern int standend ( void );
440
 extern int standout ( void );
462
 extern int standout ( void );
441
-extern int start_color ( void );
442
-extern WINDOW *subpad ( WINDOW *, int, int, int, int );
463
+extern int start_colour ( void );
464
+#define start_color() start_colour()
465
+//extern WINDOW *subpad ( WINDOW *, int, int, int, int );
443
 extern WINDOW *subwin ( WINDOW *, int, int, int, int );
466
 extern WINDOW *subwin ( WINDOW *, int, int, int, int );
444
 extern int syncok ( WINDOW *, bool );
467
 extern int syncok ( WINDOW *, bool );
445
 extern chtype termattrs ( void );
468
 extern chtype termattrs ( void );
449
 extern int tigetnum ( char * );
472
 extern int tigetnum ( char * );
450
 extern char *tigetstr ( char * );
473
 extern char *tigetstr ( char * );
451
 extern void timeout ( int );
474
 extern void timeout ( int );
452
-extern int touchline ( WINDOW *, int, int );
453
-extern int touchwin ( WINDOW * );
475
+//extern int touchline ( WINDOW *, int, int );
476
+//extern int touchwin ( WINDOW * );
454
 extern char *tparm ( char *, long, long, long, long, long, long, long, long,
477
 extern char *tparm ( char *, long, long, long, long, long, long, long, long,
455
 		   long );
478
 		   long );
456
 extern int typeahead ( int );
479
 extern int typeahead ( int );
457
-extern int ungetch ( int );
458
-extern int untouchwin ( WINDOW * );
480
+//extern int ungetch ( int );
481
+//extern int untouchwin ( WINDOW * );
459
 extern void use_env ( bool );
482
 extern void use_env ( bool );
460
 extern int vid_attr ( attr_t, short, void * );
483
 extern int vid_attr ( attr_t, short, void * );
461
 extern int vidattr ( chtype );
484
 extern int vidattr ( chtype );
464
 //extern int vline ( chtype, int );
487
 //extern int vline ( chtype, int );
465
 //extern int vwprintw ( WINDOW *, const char *, va_list );
488
 //extern int vwprintw ( WINDOW *, const char *, va_list );
466
 extern int vw_printw ( WINDOW *, const char *, va_list );
489
 extern int vw_printw ( WINDOW *, const char *, va_list );
467
-extern int vwscanw ( WINDOW *, char *, va_list );
468
-extern int vw_scanw ( WINDOW *, char *, va_list );
490
+//extern int vwscanw ( WINDOW *, char *, va_list );
491
+//extern int vw_scanw ( WINDOW *, char *, va_list );
469
 extern int waddch ( WINDOW *, const chtype );
492
 extern int waddch ( WINDOW *, const chtype );
470
 extern int waddchnstr ( WINDOW *, const chtype *, int );
493
 extern int waddchnstr ( WINDOW *, const chtype *, int );
471
-/*extern int waddchstr ( WINDOW *, const chtype * );*/
494
+//extern int waddchstr ( WINDOW *, const chtype * );
472
 extern int waddnstr ( WINDOW *, const char *, int );
495
 extern int waddnstr ( WINDOW *, const char *, int );
473
-/*extern int waddstr ( WINDOW *, const char * );*/
496
+//extern int waddstr ( WINDOW *, const char * );
474
 extern int wattroff ( WINDOW *, int );
497
 extern int wattroff ( WINDOW *, int );
475
 extern int wattron ( WINDOW *, int );
498
 extern int wattron ( WINDOW *, int );
476
 extern int wattrset ( WINDOW *, int );
499
 extern int wattrset ( WINDOW *, int );
478
 extern int wattr_off ( WINDOW *, attr_t, void * );
501
 extern int wattr_off ( WINDOW *, attr_t, void * );
479
 extern int wattr_on ( WINDOW *, attr_t, void * );
502
 extern int wattr_on ( WINDOW *, attr_t, void * );
480
 extern int wattr_set ( WINDOW *, attr_t, short, void * );
503
 extern int wattr_set ( WINDOW *, attr_t, short, void * );
481
-/*extern void wbkgdset ( WINDOW *, chtype );*/
504
+//extern void wbkgdset ( WINDOW *, chtype );
482
 extern int wborder ( WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
505
 extern int wborder ( WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype,
483
 		   chtype, chtype );
506
 		   chtype, chtype );
484
 extern int wclrtobot ( WINDOW * );
507
 extern int wclrtobot ( WINDOW * );
485
 extern int wclrtoeol ( WINDOW * );
508
 extern int wclrtoeol ( WINDOW * );
486
 extern void wcursyncup ( WINDOW * );
509
 extern void wcursyncup ( WINDOW * );
487
-/*extern int wcolor_set ( WINDOW *, short, void * );*/
510
+//extern int wcolor_set ( WINDOW *, short, void * );
488
 #define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
511
 #define wcolor_set(w,s,v) wcolour_set((w),(s),(v))
489
 extern int wdelch ( WINDOW * );
512
 extern int wdelch ( WINDOW * );
490
 extern int wdeleteln ( WINDOW * );
513
 extern int wdeleteln ( WINDOW * );
492
 extern int werase ( WINDOW * );
515
 extern int werase ( WINDOW * );
493
 extern int wgetch ( WINDOW * );
516
 extern int wgetch ( WINDOW * );
494
 extern int wgetnstr ( WINDOW *, char *, int );
517
 extern int wgetnstr ( WINDOW *, char *, int );
495
-extern int wgetstr ( WINDOW *, char * );
518
+//extern int wgetstr ( WINDOW *, char * );
496
 extern int whline ( WINDOW *, chtype, int );
519
 extern int whline ( WINDOW *, chtype, int );
497
 //extern chtype winch ( WINDOW * );
520
 //extern chtype winch ( WINDOW * );
498
 //extern int winchnstr ( WINDOW *, chtype *, int );
521
 //extern int winchnstr ( WINDOW *, chtype *, int );
503
 //extern int winsstr ( WINDOW *, const char * );
526
 //extern int winsstr ( WINDOW *, const char * );
504
 //extern int winstr ( WINDOW *, char * );
527
 //extern int winstr ( WINDOW *, char * );
505
 extern int wmove ( WINDOW *, int, int );
528
 extern int wmove ( WINDOW *, int, int );
506
-extern int wnoutrefresh ( WINDOW * );
529
+//extern int wnoutrefresh ( WINDOW * );
507
 extern int wprintw ( WINDOW *, const char *, ... );
530
 extern int wprintw ( WINDOW *, const char *, ... );
508
-/*extern int wredrawln ( WINDOW *, int, int );*/
509
-/*extern int wrefresh ( WINDOW * );*/
510
-extern int wscanw ( WINDOW *, char *, ... );
511
-/*extern int wscrl ( WINDOW *, int );*/
512
-extern int wsetscrreg ( WINDOW *, int, int );
513
-extern int wstandend ( WINDOW * );
514
-extern int wstandout ( WINDOW * );
531
+//extern int wredrawln ( WINDOW *, int, int );
532
+//extern int wrefresh ( WINDOW * );
533
+//extern int wscanw ( WINDOW *, char *, ... );
534
+//extern int wscrl ( WINDOW *, int );
535
+//extern int wsetscrreg ( WINDOW *, int, int );
536
+//extern int wstandend ( WINDOW * );
537
+//extern int wstandout ( WINDOW * );
515
 extern void wsyncup ( WINDOW * );
538
 extern void wsyncup ( WINDOW * );
516
 extern void wsyncdown ( WINDOW * );
539
 extern void wsyncdown ( WINDOW * );
517
 extern void wtimeout ( WINDOW *, int );
540
 extern void wtimeout ( WINDOW *, int );
518
-extern int wtouchln ( WINDOW *, int, int, int );
541
+//extern int wtouchln ( WINDOW *, int, int, int );
519
 extern int wvline ( WINDOW *, chtype, int );
542
 extern int wvline ( WINDOW *, chtype, int );
520
 
543
 
521
 /*
544
 /*
582
 	return wdeleteln( stdscr );
605
 	return wdeleteln( stdscr );
583
 }
606
 }
584
 
607
 
608
+static inline int erase ( void ) {
609
+	return werase ( stdscr );
610
+}
611
+
612
+static inline int getch ( void ) {
613
+	return wgetch ( stdscr );
614
+}
615
+
616
+static inline int getnstr ( char *str, int n ) {
617
+	return wgetnstr ( stdscr, str, n );
618
+}
619
+
620
+static inline int getstr ( char *str ) {
621
+	return wgetnstr ( stdscr, str, -1 );
622
+}
623
+
585
 static inline int hline ( chtype ch, int n ) {
624
 static inline int hline ( chtype ch, int n ) {
586
 	return whline ( stdscr, ch, n );
625
 	return whline ( stdscr, ch, n );
587
 }
626
 }
620
 		 ? wdelch ( stdscr ) : ERR );
659
 		 ? wdelch ( stdscr ) : ERR );
621
 }
660
 }
622
 
661
 
662
+static inline int mvgetch ( int y, int x ) {
663
+	return ( wmove ( stdscr, y, x ) == OK
664
+		 ? wgetch ( stdscr ) : ERR );
665
+}
666
+
667
+static inline int mvgetnstr ( int y, int x, char *str, int n ) {
668
+	return ( wmove ( stdscr, y, x ) == OK
669
+		 ? wgetnstr ( stdscr, str, n ) : ERR );
670
+}
671
+
672
+static inline int mvgetstr ( int y, int x, char *str ) {
673
+	return ( wmove ( stdscr, y, x ) == OK
674
+		 ? wgetnstr ( stdscr, str, -1 ) : ERR );
675
+}
676
+
623
 static inline int mvhline ( int y, int x, chtype ch, int n ) {
677
 static inline int mvhline ( int y, int x, chtype ch, int n ) {
624
 	return ( wmove ( stdscr, y, x ) == OK
678
 	return ( wmove ( stdscr, y, x ) == OK
625
 		 ? whline ( stdscr, ch, n ) : ERR );
679
 		 ? whline ( stdscr, ch, n ) : ERR );
665
 		 ? wdelch ( win ) : ERR );
719
 		 ? wdelch ( win ) : ERR );
666
 }
720
 }
667
 
721
 
722
+static inline int mvwgetch ( WINDOW *win, int y, int x ) {
723
+	return ( wmove ( win, y, x ) == OK
724
+		 ? wgetch ( win ) : ERR );
725
+}
726
+
727
+static inline int mvwgetnstr ( WINDOW *win, int y, int x, char *str, int n ) {
728
+	return ( wmove ( win, y, x ) == OK
729
+		 ? wgetnstr ( win, str, n ) : ERR );
730
+}
731
+
732
+static inline int mvwgetstr ( WINDOW *win, int y, int x, char *str ) {
733
+	return ( wmove ( win, y, x ) == OK
734
+		 ? wgetnstr ( win, str, -1 ) : ERR );
735
+}
736
+
668
 static inline int mvwhline ( WINDOW *win, int y, int x, chtype ch, int n ) {
737
 static inline int mvwhline ( WINDOW *win, int y, int x, chtype ch, int n ) {
669
 	return ( wmove ( win, y, x ) == OK
738
 	return ( wmove ( win, y, x ) == OK
670
 		 ? whline ( win, ch, n ) : ERR );
739
 		 ? whline ( win, ch, n ) : ERR );
681
 
750
 
682
 #define printw( fmt, ... ) wprintw(stdscr,(fmt), ## __VA_ARGS__ )
751
 #define printw( fmt, ... ) wprintw(stdscr,(fmt), ## __VA_ARGS__ )
683
 
752
 
753
+static inline int slk_refresh ( void ) {
754
+	if ( slk_clear() == OK )
755
+		return slk_restore();
756
+	else
757
+		return ERR;
758
+}
759
+
760
+#define standend() wstandend( stdscr )
761
+#define standout() wstandout( stdscr )
762
+
684
 static inline int vline ( chtype ch, int n ) {
763
 static inline int vline ( chtype ch, int n ) {
685
 	return wvline ( stdscr, ch, n );
764
 	return wvline ( stdscr, ch, n );
686
 }
765
 }
702
 	return wattrset( win, ch );
781
 	return wattrset( win, ch );
703
 }
782
 }
704
 
783
 
784
+static inline int wgetstr ( WINDOW *win, char *str ) {
785
+	return wgetnstr ( win, str, -1 );
786
+}
787
+
788
+static inline int wstandend ( WINDOW *win ) {
789
+	return wattrset ( win, A_DEFAULT );
790
+}
791
+
792
+static inline int wstandout ( WINDOW *win ) {
793
+	return wattrset ( win, A_STANDOUT );
794
+}
795
+
705
 #endif /* CURSES_H */
796
 #endif /* CURSES_H */

Loading…
Cancel
Save