"Fossies" - the Fresh Open Source Software Archive 
Member "mp3info-0.8.5a/win32/curses.h" (28 Nov 2002, 85675 Bytes) of package /linux/misc/old/mp3info-0.8.5a.tgz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "curses.h" see the
Fossies "Dox" file reference documentation.
1 /*
2 ***************************************************************************
3 * This file comprises part of PDCurses. PDCurses is Public Domain software.
4 * You may use this code for whatever purposes you desire. This software
5 * is provided AS IS with NO WARRANTY whatsoever.
6 * Should this software be used in another application, an acknowledgement
7 * that PDCurses code is used would be appreciated, but is not mandatory.
8 *
9 * Any changes which you make to this software which may improve or enhance
10 * it, should be forwarded to the current maintainer for the benefit of
11 * other users.
12 *
13 * The only restriction placed on this code is that no distribution of
14 * modified PDCurses code be made under the PDCurses name, by anyone
15 * other than the current maintainer.
16 *
17 * See the file maintain.er for details of the current maintainer.
18 ***************************************************************************
19 */
20 /*
21 $Id: curses.h,v 1.15 2002/11/27 11:22:46 mark Exp $
22 */
23 /*
24 *----------------------------------------------------------------------
25 * PDCurses
26 *----------------------------------------------------------------------
27 * MH
28 * 991212 2.4
29 * Key modifiers pressed by themselves are now returned as keys
30 * KEY_SHIFT_L KEY_SHIFT_R
31 * KEY_CONTROL_L KEY_CONTROL_R
32 * KEY_ALT_L KEY_ALT_R
33 * This works on Win32 and X11 ports only
34 * Added support for lcc-win32, supplied by Matthias Burian
35 * Added support for MingW32, and CygnusW32 compilers
36 * Added clipboard support for X11, Win32 and OS/2 ports
37 * Added ability to get to the input file descriptor
38 * New function for X11; Xinitscr() which allows standard X11
39 * switches to be passed to the application
40 * Added X11 shared library support
41 *
42 * MH
43 * 960920 2.3 Added more System V R4 functions
44 *
45 * Rewrote X11 port
46 *
47 * Added Win32 port - original port by Chris Szurgot
48 * some updates by Mark Hessling
49 * some updates by Gurusamy Sarathy
50 *
51 * slk() functions added by Kim Huron
52 *
53 * Support for more and newer versions of compilers
54 *
55 * Added mouse support for X11 and Win32 ports
56 *
57 * Size of chtype now long
58 *
59 * MH
60 * 950126 2.2 Added more System V R4 functions
61 *
62 * Added beta Xwindows port
63 *
64 * Changed chtype to long
65 *
66 * Incorporated panels library
67 *
68 * Support for more and newer versions of compilers
69 *
70 * MH
71 * 930531 2.1 Added support for djgpp
72 *
73 * Added beta Unix version
74 *
75 * Added OS/2 DLL support.
76 *
77 * Changed behaviour of overlay(), overwrite() and typeahead()
78 *
79 * 921120 2.0 Changed #if to #ifdef/#if defined to make it
80 * easier to add new platforms/compilers.
81 *
82 * Added System V colour support.
83 *
84 * Added OS/2 port.
85 *-------
86 * Frotz
87 * 911221 2.0 pre-beta Changed back from short to int. (int is the
88 * correct size for the default platform. Short
89 * might be too short on some platforms. This
90 * is more portable. I, also, made this mistake.)
91 *
92 * Many functions are now macros. If you want
93 * the real thing, #undef the macro. (X/Open
94 * requirement.)
95 *
96 * Merged many sources into current release.
97 *
98 * Added many X/Open routines (not quite all yet).
99 *
100 * Added internal documentation to all routines.
101 *
102 * Added a HISTORY file to the environment.
103 *
104 * Added a CONTRIB file to the environment.
105 *-------
106 * bl 900114 1.4 Window origin mod in overlay() and overwrite(), on
107 * public (and very reasonable) request. Swapped
108 * #define'd values of OK and ERR; OK now 1, and
109 * ERR is 0/NULL. Conforms better to UNIX
110 * versions. borderchars[] removed from WINDOW
111 * struct since the border() functions were
112 * redefined. Use of short wherever possible.
113 * Portability improvements, mispelled name of
114 * [w]setscrreg().
115 *
116 * 881005 1.3 All modules lint-checked with MSC '-W3' and
117 * turbo'C' '-w -w-pro' switches. Support for
118 * border(), wborder() functions.
119 *
120 * 881002 1.2 Rcsid[] string in all modules, for maintenance.
121 *
122 * 880306 1.1 'Raw' output routines, revision info in curses.h.
123 *
124 * 870515 1.0 Initial Release.
125 *
126 *----------------------------------------------------------------------
127 */
128 #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
129 extern "C"
130 {
131 # define bool _bool
132 #endif
133
134 #ifndef __PDCURSES__
135 #define __PDCURSES__ 1
136
137 /*man-start*********************************************************************
138
139 All defines are "defined" here. All compiler and environment
140 specific definitions are defined into generic class defines.
141 These defines are to be given values so that the code can
142 rely on #if, rather than a complicated set of #if defined() or
143 #ifdefs...
144
145 PDCurses definitions list: (Only define those needed)
146
147 REGISTERWINDOWS True for auto window update registery.
148 FAST_VIDEO True if display is memory mapped, or
149 we can utilize the fast video update routines.
150 DOS True if compiling for DOS.
151 OS2 True if compiling for OS/2.
152 WIN32 True if compiling for Windoze 95 or Windoze NT
153 FLEXOS True if compiling for Flexos.
154 HC True if using a Metaware compiler.
155 TC True if using a Borland compiler.
156 MSC True if using a Microsoft compiler.
157 HAVE_PROTO True if the compiler supports ANSI prototypes.
158 CPLUSPLUS True if the compiler supports C++.
159 PDC_BUILD???? Defines API build version.
160
161 PDCurses portable platform definitions list:
162
163 PDCURSES Enables access to PDCurses-only routines.
164 XOPEN Always true.
165 SYSVcurses True if you are compiling for SYSV portability.
166 BSDcurses True if you are compiling for BSD portability.
167 PDCURSES_WCLR Makes behaviour of wclrtoeol() and wclrtoeof()
168 unique to PDCurses. By default Unix behavior is set.
169 See notes in wclrtoeol() and wclrtoeof().
170 **man-end**********************************************************************/
171
172 #define PDC_BUILD 2601
173 #define PDCURSES 1 /* PDCurses-only routines */
174 #define XOPEN 1 /* X/Open Curses routines */
175 #define SYSVcurses 1 /* System V Curses routines */
176 #define BSDcurses 1 /* BSD Curses routines */
177 #define CHTYPE_LONG 1 /* size of chtype; long */
178
179 #define PDC_CDECL /* default define this as empty */
180
181 /*----------------------------------------
182 * BORLAND COMPILERS Turbo C[++], Borland C[++]
183 *
184 * Borland definitions:
185 * TC
186 * DOS
187 * OS2
188 * CPLUSPLUS
189 *
190 * __TURBOC__, __MSDOS__,
191 * __OS2__ and __WIN32__
192 * are predefined by compiler.
193 */
194 #ifdef __TURBOC__ /* Borland gives defines this as a value*/
195 # define TC __TURBOC__ /* Define a value for TC */
196 # ifndef HAVE_PROTO
197 # define HAVE_PROTO 1 /* Borland supports ANSI C prototypes */
198 # endif
199 # ifdef __MSDOS__
200 # define DOS 6 /* Major release of DOS supported */
201 # include <bios.h>
202 # include <dos.h>
203 # endif
204 # ifdef __OS2__
205 # define OS2 3 /* Major release of OS/2 supported */
206 # define INCL_VIO
207 # define INCL_KBD
208 # include <os2.h>
209 # endif
210 # ifdef __WIN32__
211 # ifdef INCLUDE_WINDOWS_H /* only include for WIN32 files */
212 # include <windows.h>
213 # ifdef MOUSE_MOVED /* get rid of Windows #define */
214 # undef MOUSE_MOVED
215 # endif
216 # endif
217 # ifndef WIN32
218 # define WIN32 1
219 # endif
220 # endif
221 # if __TURBOC__ >= 0x290
222 # ifdef __BCPLUSPLUS__
223 # define CPLUSPLUS 1 /* Define that we are compiling C++. */
224 # endif
225 # ifdef __TCPLUSPLUS__
226 # define CPLUSPLUS 1 /* Define that we are compiling C++. */
227 # endif
228 # ifdef __CPLUSPLUS__
229 # define CPLUSPLUS 1 /* Define that we are compiling C++. */
230 # endif
231 # endif
232 # ifndef HAVE_LIMITS_H
233 # define HAVE_LIMITS_H /* have <limits.h> */
234 # endif
235 # ifndef HAVE_MEMORY_H
236 # define HAVE_MEMORY_H /* have <memory.h> */
237 # endif
238 # ifndef HAVE_STDARG_H
239 # define HAVE_STDARG_H /* have <stdarg.h> */
240 # endif
241 # ifndef HAVE_MEMMOVE
242 # define HAVE_MEMMOVE /* have memmove() */
243 # endif
244 # ifndef HAVE_VSSCANF
245 # define HAVE_VSSCANF /* have vsscanf() */
246 # endif
247 #endif
248
249
250 /*----------------------------------------
251 * METAWARE COMPILERS High C
252 *
253 * Metaware definitions:
254 * HC
255 * DOS
256 * FLEXOS
257 */
258 #ifdef __HIGHC__
259 # define HC 1
260 # pragma off(prototype_override_warnings)
261 # ifndef HAVE_PROTO
262 # define HAVE_PROTO 1 /* Metaware supports ANSI C prototypes */
263 # endif
264 # ifdef __MSDOS__
265 # define DOS 6 /* Major release of DOS supported */
266 # include <bios.h>
267 # include <dos.h>
268 # endif
269 # ifdef __FLEXOS__ /* define this on the command line */
270 # define FLEXOS 2 /* or latest major release value. */
271 # endif
272 #endif
273
274 /*----------------------------------------
275 * MICROSOFT COMPILERS MSC
276 *
277 * Microsoft definitions:
278 * MSC
279 * DOS || OS2
280 */
281 #ifdef _MSC_VER /* defined by compiler */
282 # define MSC 1
283 # ifndef HAVE_PROTO
284 # define HAVE_PROTO 1 /* Microsoft supports ANSI C prototypes */
285 # endif
286 # ifdef __OS2__ /* You will have to define in makefile */
287 # define USE_OS2_H 1 /* Use the os2.h for the compiler */
288 # define OS2 3 /* Major release of OS/2 supported */
289 # define INCL_VIO
290 # define INCL_KBD
291 # include <os2.h>
292 # define FARKeyword far
293 # define APIRET USHORT
294 # else /* no __OS2__ define, so assume DOS */
295 # ifdef _WIN32
296 # ifndef WIN32
297 # define WIN32
298 # endif
299 # ifdef INCLUDE_WINDOWS_H /* only include for WIN32 files */
300 # include <windows.h>
301 # ifdef MOUSE_MOVED /* get rid of Windows #define */
302 # undef MOUSE_MOVED
303 # endif
304 # endif
305 # ifndef HAVE_MEMORY_H
306 # define HAVE_MEMORY_H /* have <memory.h> */
307 # endif
308 # ifndef HAVE_STDARG_H
309 # define HAVE_STDARG_H /* have <stdarg.h> */
310 # endif
311 # else
312 # define DOS 6 /* Major release of DOS supported */
313 # include <bios.h>
314 # include <dos.h>
315 # undef HAVE_VSSCANF /* vsscanf() function NOT in library */
316 # endif
317 # endif
318 # ifndef HAVE_LIMITS_H
319 # define HAVE_LIMITS_H /* have <limits.h> */
320 # endif
321 # ifndef HAVE_MEMMOVE
322 # define HAVE_MEMMOVE /* have memmove() */
323 # endif
324 #endif
325
326 /*----------------------------------------
327 * MICROSOFT QUICK C COMPILERS QC
328 *
329 */
330 #ifdef _QC /* defined by compiler */
331 # define MSC 1
332 # ifndef HAVE_PROTO
333 # define HAVE_PROTO 1 /* QuickC supports ANSI C prototypes */
334 # endif
335 # define DOS 6 /* Major release of DOS supported */
336 # include <bios.h>
337 # include <dos.h>
338 # undef HAVE_VSSCANF /* vsscanf() function NOT in library */
339 # ifndef HAVE_LIMITS_H
340 # define HAVE_LIMITS_H /* have <limits.h> */
341 # endif
342 #endif
343
344 /*----------------------------------------
345 * TOPSPEED compilers TSC
346 *
347 * TOPSPEED definitions:
348 * TSC
349 * DOS || OS2
350 */
351 #ifdef __TSC__ /* You may have to define in makefile */
352 # define TSC 1
353 # ifndef HAVE_PROTO
354 # define HAVE_PROTO 1 /* TopSpeed supports ANSI C prototypes */
355 # endif
356 # ifdef __OS2__
357 # define OS2 3 /* Major release of OS/2 supported */
358 # define INCL_VIO
359 # define INCL_KBD
360 # include <os2.h>
361 # endif
362 # ifndef HAVE_LIMITS_H
363 # define HAVE_LIMITS_H /* have <limits.h> */
364 # endif
365 #endif
366
367 /*----------------------------------------
368 * IBM C Set/2 Compiler CSET2
369 *
370 * IBM definitions:
371 * CSET2
372 * OS2
373 */
374 #ifdef __IBMC__
375 # define CSET2 1
376 # ifndef HAVE_PROTO
377 # define HAVE_PROTO 1 /* C Set/2 supports ANSI C prototypes */
378 # endif
379 # ifndef HAVE_STDARG_H
380 # define HAVE_STDARG_H /* have <stdarg.h> */
381 # endif
382 # ifndef HAVE_LIMITS_H
383 # define HAVE_LIMITS_H /* have <limits.h> */
384 # endif
385 # ifndef HAVE_MEMORY_H
386 # define HAVE_MEMORY_H /* have <memory.h> */
387 # endif
388 # ifndef HAVE_MEMMOVE
389 # define HAVE_MEMMOVE /* have memmove() */
390 # endif
391 # ifdef __OS2__
392 # define OS2 3 /* Major release of OS/2 supported */
393 # define INCL_VIO
394 # define INCL_KBD
395 # include <os2.h>
396 # endif
397 #endif
398
399 /*----------------------------------------
400 * GNU compilers emx
401 *
402 * emx definitions:
403 * EMX
404 * OS2
405 */
406 #ifdef __EMX__ /* You may have to define in makefile */
407 # define EMX 1
408 # ifndef HAVE_PROTO
409 # define HAVE_PROTO 1 /* emx supports ANSI C prototypes */
410 # endif
411 # define __OS2__ /* EMX does not define this :-( */
412 # define OS2 3 /* Major release of OS/2 supported */
413 # define CURSES__32BIT__
414 # ifndef HAVE_STDARG_H
415 # define HAVE_STDARG_H /* have <stdarg.h> */
416 # endif
417 # ifndef HAVE_LIMITS_H
418 # define HAVE_LIMITS_H /* have <limits.h> */
419 # endif
420 # ifndef HAVE_MEMORY_H
421 # define HAVE_MEMORY_H /* have <memory.h> */
422 # endif
423 # ifndef HAVE_UNISTD_H
424 # define HAVE_UNISTD_H /* have <unistd.h> */
425 # endif
426 # ifndef HAVE_MEMMOVE
427 # define HAVE_MEMMOVE /* have memmove() */
428 # endif
429 # ifndef HAVE_VSSCANF
430 # define HAVE_VSSCANF /* have vsscanf() */
431 # endif
432 # if defined(EMXVIDEO)
433 # include <stdlib.h>
434 # include <sys/video.h>
435 # else
436 # define INCL_VIO
437 # define INCL_KBD
438 # include <os2.h>
439 # endif
440 #endif
441
442 /*----------------------------------------
443 * GNU compilers djgpp
444 *
445 * djgpp definitions:
446 * GO32
447 * DOS
448 */
449 #ifdef GO32 /* You may have to define in makefile */
450 # ifndef HAVE_PROTO
451 # define HAVE_PROTO 1 /* DJGPP supports ANSI C prototypes */
452 # endif
453 # define DOS 6
454 # include <dos.h>
455 # ifdef __FLEXOS__ /* define this on the command line */
456 # define FLEXOS 2 /* or latest major release value. */
457 # endif
458 # define CURSES__32BIT__
459 # ifdef _cplusplus
460 # define CPLUSPLUS 1
461 # endif
462 # ifndef HAVE_STDARG_H
463 # define HAVE_STDARG_H /* have <stdarg.h> */
464 # endif
465 # ifndef HAVE_LIMITS_H
466 # define HAVE_LIMITS_H /* have <limits.h> */
467 # endif
468 # ifndef HAVE_MEMORY_H
469 # define HAVE_MEMORY_H /* have <memory.h> */
470 # endif
471 # ifndef HAVE_UNISTD_H
472 # define HAVE_UNISTD_H /* have <unistd.h> */
473 # endif
474 # ifndef HAVE_MEMMOVE
475 # define HAVE_MEMMOVE /* have memmove() */
476 # endif
477 # ifndef HAVE_USLEEP
478 # define HAVE_USLEEP /* have usleep() */
479 # endif
480 #endif
481
482
483 /*----------------------------------------
484 * GNU compilers Cygnus Win32
485 *
486 * cygnus definitions:
487 * WIN32
488 */
489 #ifdef __CYGWIN32__ /* You may have to define in makefile */
490 # ifndef HAVE_PROTO
491 # define HAVE_PROTO 1 /* Cygnuc GCC supports ANSI C prototypes */
492 # endif
493 # ifdef INCLUDE_WINDOWS_H
494 # include <windows.h>
495 # ifdef MOUSE_MOVED
496 # undef MOUSE_MOVED
497 # endif
498 # endif
499 # ifndef WIN32
500 # define WIN32
501 # endif
502 # ifndef INT_MAX
503 # define INT_MAX 32762
504 # endif
505 # define CURSES__32BIT__
506 # ifndef HAVE_LIMITS_H
507 # define HAVE_LIMITS_H /* have <limits.h> */
508 # endif
509 # ifndef HAVE_MEMORY_H
510 # define HAVE_MEMORY_H /* have <memory.h> */
511 # endif
512 # ifndef HAVE_STDARG_H
513 # define HAVE_STDARG_H /* have <stdarg.h> */
514 # endif
515 # ifndef HAVE_UNISTD_H
516 # define HAVE_UNISTD_H /* have <unistd.h> */
517 # endif
518 # ifndef HAVE_MEMMOVE
519 # define HAVE_MEMMOVE /* have memmove() */
520 # endif
521 # ifndef HAVE_USLEEP
522 # define HAVE_USLEEP /* have usleep() */
523 # endif
524 #endif
525
526 /*----------------------------------------
527 * GNU compilers Ming Win32
528 *
529 * Ming definitions:
530 * WIN32
531 */
532 #ifdef __MINGW32__
533 # ifndef HAVE_PROTO
534 # define HAVE_PROTO 1 /* Ming GCC supports ANSI C prototypes */
535 # endif
536 # ifdef INCLUDE_WINDOWS_H
537 # include <windows.h>
538 # ifdef MOUSE_MOVED
539 # undef MOUSE_MOVED
540 # endif
541 # endif
542 # ifndef WIN32
543 # define WIN32
544 # endif
545 # define CURSES__32BIT__
546 # ifndef HAVE_LIMITS_H
547 # define HAVE_LIMITS_H /* have <limits.h> */
548 # endif
549 # ifndef HAVE_MEMORY_H
550 # define HAVE_MEMORY_H /* have <memory.h> */
551 # endif
552 # ifndef HAVE_STDARG_H
553 # define HAVE_STDARG_H /* have <stdarg.h> */
554 # endif
555 # ifndef HAVE_UNISTD_H
556 # define HAVE_UNISTD_H /* have <unistd.h> */
557 # endif
558 # ifndef HAVE_MEMMOVE
559 # define HAVE_MEMMOVE /* have memmove() */
560 # endif
561 #endif
562
563 /*----------------------------------------
564 * LCC WIN32
565 *
566 */
567 #ifdef __LCC__ /* should already be defined by the compiler */
568 # ifndef HAVE_PROTO
569 # define HAVE_PROTO 1 /* LCC-Win32 supports ANSI C prototypes */
570 # endif
571 # ifdef INCLUDE_WINDOWS_H
572 # include <windows.h>
573 # ifdef MOUSE_MOVED
574 # undef MOUSE_MOVED
575 # endif
576 # endif
577 # ifndef WIN32
578 # define WIN32
579 # endif
580 # ifndef INT_MAX
581 # define INT_MAX 32762
582 # endif
583 # ifndef HAVE_LIMITS_H
584 # define HAVE_LIMITS_H /* have <limits.h> */
585 # endif
586 # ifndef HAVE_MEMORY_H
587 # define HAVE_MEMORY_H /* have <memory.h> */
588 # endif
589 # ifndef HAVE_STDARG_H
590 # define HAVE_STDARG_H /* have <stdarg.h> */
591 # endif
592 # ifndef HAVE_MEMMOVE
593 # define HAVE_MEMMOVE /* have memmove() */
594 # endif
595 #endif
596
597 /*----------------------------------------
598 * Watcom C/C++ 10.6 compiler
599 *
600 * WATCOM definitions:
601 * WATCOMC
602 * OS2
603 * WIN32
604 */
605 #ifdef __WATCOMC__
606 # define WATCOMC 1
607 # ifndef HAVE_PROTO
608 # define HAVE_PROTO 1 /* Watcom C supports ANSI C prototypes */
609 # endif
610 # define CURSES__32BIT__
611 # if defined( __DOS__ ) || defined( __DOS4G__ )
612 # define DOS 7 /* Major release of DOS supported */
613 # include <bios.h>
614 # include <dos.h>
615 # include <i86.h>
616 # ifdef __386__
617 # define int86 int386
618 # define int86x int386x
619 # endif
620 # endif
621 # if defined( __OS2__ ) || defined( __OS2V2__ )
622 # define OS2 3 /* Major release of OS/2 supported */
623 # define CURSES__32BIT__
624 # define INCL_VIO
625 # define INCL_KBD
626 # include <os2.h>
627 # endif
628 # ifdef __NT__ /* This specifies WIN32 target */
629 # ifdef INCLUDE_WINDOWS_H
630 # include <windows.h>
631 # ifdef MOUSE_MOVED
632 # undef MOUSE_MOVED
633 # endif
634 # endif
635 # ifndef WIN32
636 # define WIN32
637 # endif
638
639 /*
640 # ifdef PDC_CDECL
641 # undef PDC_CDECL
642 # define PDC_CDECL cdecl
643 # endif
644 */
645
646 # endif
647 # ifndef HAVE_LIMITS_H
648 # define HAVE_LIMITS_H /* have <limits.h> */
649 # endif
650 # ifndef HAVE_MEMORY_H
651 # define HAVE_MEMORY_H /* have <memory.h> */
652 # endif
653 # ifndef HAVE_STDARG_H
654 # define HAVE_STDARG_H /* have <stdarg.h> */
655 # endif
656 # ifndef HAVE_MEMMOVE
657 # define HAVE_MEMMOVE /* have memmove() */
658 # endif
659 # ifndef HAVE_VSSCANF
660 # define HAVE_VSSCANF /* have vsscanf() */
661 # endif
662 #endif
663
664 #if 0
665 /*----------------------------------------
666 * gcc under UNIX
667 *
668 * GNU definitions:
669 * UNIX
670 */
671 #ifdef UNIX
672 # define HAVE_PROTO 1 /* GNU C supports ANSI C prototypes */
673 # ifdef SUNOS
674 # define NO_VSSCANF
675 # define NO_MEMMOVE
676 # undef BSD
677 # endif
678 # ifdef linux
679 # undef BSD
680 # endif
681 #endif
682 #endif
683
684 /*----------------------------------------
685 * MicroWay NDP C/C++ 386 4.2.0 compiler
686 */
687 #ifdef MX386
688 # define HAVE_PROTO 1
689 # define NDP 1
690 # include <bios.h>
691 # ifdef DOS
692 # define MK_FP(seg,ofs) ( (((int) (seg)) << 4) + ((int) (ofs)) )
693 # ifdef __i860
694 typedef void _int;
695 # else
696 typedef int _int;
697 # endif
698 # endif
699 # undef NO_VSSCANF /* vsscanf() function NOT in library */
700 # ifndef HAVE_LIMITS_H
701 # define HAVE_LIMITS_H /* have <limits.h> */
702 # endif
703 #endif
704
705 /*---------------------------------------------------------------------*/
706 #include <stdio.h> /* Required by X/Open usage below */
707 /*----------------------------------------------------------------------
708 *
709 * PDCurses Manifest Constants
710 *
711 */
712 #ifndef FALSE /* booleans */
713 # define FALSE 0
714 #endif
715 #ifndef TRUE /* booleans */
716 # define TRUE !FALSE
717 #endif
718 #ifndef NULL
719 # define NULL 0 /* Null pointer */
720 #endif
721 #ifndef ERR
722 # define ERR 0 /* general error flag */
723 #endif
724 #ifndef OK
725 # define OK 1 /* general OK flag */
726 #endif
727
728
729 /*----------------------------------------------------------------------
730 *
731 * PDCurses Type Declarations
732 *
733 */
734 typedef unsigned char bool; /* PDCurses Boolean type */
735
736 #ifdef CHTYPE_LONG
737 typedef unsigned long chtype; /* 16-bit attr + 16-bit char */
738 #else
739 typedef unsigned short chtype; /* 8-bit attr + 8-bit char */
740 #endif
741
742 /*----------------------------------------------------------------------
743 * This defines a new type for attributes.
744 *
745 */
746 typedef chtype attr_t;
747
748 /*----------------------------------------------------------------------
749 * Define our mouse interface - same as SYSVR4 (with extensions)
750 */
751
752 typedef struct
753 {
754 int x; /* absolute column, 0 based, measured in characters */
755 int y; /* absolute row, 0 based, measured in characters */
756 short button[3]; /* state of each button */
757 int changes; /* flags indicating what has changed with the mouse */
758 } MOUSE_STATUS;
759
760
761 #define BUTTON_RELEASED 0000
762 #define BUTTON_PRESSED 0001
763 #define BUTTON_CLICKED 0002
764 #define BUTTON_DOUBLE_CLICKED 0003
765 #define BUTTON_TRIPLE_CLICKED 0004
766 #define BUTTON_MOVED 0005 /* PDCurses enhancement */
767 #define BUTTON_ACTION_MASK 0007 /* PDCurses enhancement */
768 #define BUTTON_SHIFT 0010 /* PDCurses enhancement */
769 #define BUTTON_CONTROL 0020 /* PDCurses enhancement */
770 #define BUTTON_ALT 0040 /* PDCurses enhancement */
771 #define BUTTON_MODIFIER_MASK 0070 /* PDCurses enhancement */
772
773 #define MOUSE_X_POS (Mouse_status.x)
774 #define MOUSE_Y_POS (Mouse_status.y)
775 #define A_BUTTON_CHANGED (Mouse_status.changes & 7)
776 #define MOUSE_MOVED (Mouse_status.changes & 8)
777 #define MOUSE_POS_REPORT (Mouse_status.changes & 16)
778 #define BUTTON_CHANGED(x) (Mouse_status.changes & (1 << ((x) - 1)))
779 #define BUTTON_STATUS(x) (Mouse_status.button[(x)-1])
780
781 /* mouse bit-masks */
782 #define BUTTON1_RELEASED 000000000001L
783 #define BUTTON1_PRESSED 000000000002L
784 #define BUTTON1_CLICKED 000000000004L
785 #define BUTTON1_DOUBLE_CLICKED 000000000010L
786 #define BUTTON1_TRIPLE_CLICKED 000000000020L
787 #define BUTTON1_MOVED 000000000020L /* PDCurses enhancement */
788 #define BUTTON2_RELEASED 000000000040L
789 #define BUTTON2_PRESSED 000000000100L
790 #define BUTTON2_CLICKED 000000000200L
791 #define BUTTON2_DOUBLE_CLICKED 000000000400L
792 #define BUTTON2_TRIPLE_CLICKED 000000001000L
793 #define BUTTON2_MOVED 000000001000L /* PDCurses enhancement */
794 #define BUTTON3_RELEASED 000000002000L
795 #define BUTTON3_PRESSED 000000004000L
796 #define BUTTON3_CLICKED 000000010000L
797 #define BUTTON3_DOUBLE_CLICKED 000000020000L
798 #define BUTTON3_TRIPLE_CLICKED 000000040000L
799 #define BUTTON3_MOVED 000000040000L /* PDCurses enhancement */
800 #define BUTTON_MODIFIER_SHIFT 000000100000L /* PDCurses enhancement */
801 #define BUTTON_MODIFIER_CONTROL 000000200000L /* PDCurses enhancement */
802 #define BUTTON_MODIFIER_ALT 000000400000L /* PDCurses enhancement */
803 #define ALL_MOUSE_EVENTS 000000777777L
804 #define REPORT_MOUSE_POSITION 000001000000L
805
806 /*----------------------------------------------------------------------
807 *
808 * PDCurses Structure Definitions:
809 *
810 */
811 typedef struct _win /* definition of a window. */
812 {
813 int _cury; /* current pseudo-cursor */
814 int _curx;
815 int _maxy; /* max window coordinates */
816 int _maxx;
817 int _pmaxy; /* max physical size */
818 int _pmaxx;
819 int _begy; /* origin on screen */
820 int _begx;
821 int _lastpy; /* last y coordinate of upper left pad display area */
822 int _lastpx; /* last x coordinate of upper left pad display area */
823 int _lastsy1; /* last upper y coordinate of screen window for pad */
824 int _lastsx1; /* last upper x coordinate of screen window for pad */
825 int _lastsy2; /* last lower y coordinate of screen window for pad */
826 int _lastsx2; /* last lower x coordinate of screen window for pad */
827 int _flags; /* window properties */
828 attr_t _attrs; /* standard A_STANDOUT attributes and colors */
829 chtype _bkgd; /* wrs(4/6/93) background, normally blank */
830 int _tabsize; /* tab character size */
831 bool _clear; /* causes clear at next refresh */
832 bool _leaveit; /* leaves cursor where it is */
833 bool _scroll; /* allows window scrolling */
834 bool _nodelay; /* input character wait flag */
835 bool _immed; /* immediate update flag */
836 bool _sync; /* synchronise window ancestors */
837 bool _use_keypad; /* flags keypad key mode active */
838 bool _use_idl; /* True if Ins/Del line can be used*/
839 bool _use_idc; /* True if Ins/Del character can be used*/
840 chtype**_y; /* pointer to line pointer array */
841 int* _firstch; /* first changed character in line */
842 int* _lastch; /* last changed character in line */
843 int _tmarg; /* top of scrolling region */
844 int _bmarg; /* bottom of scrolling region */
845 char* _title; /* window title */
846 char _title_ofs; /* window title offset from left */
847 attr_t _title_attr; /* window title attributes */
848 chtype _blank; /* window's blank character */
849 int _parx, _pary; /* coords relative to parent (0,0) */
850 struct _win* _parent; /* subwin's pointer to parent win */
851 } WINDOW;
852
853
854
855 /*----------------------------------------------------------------------
856 *
857 * Private structures that are necessary for correct
858 * macro construction.
859 *
860 */
861
862 #ifdef REGISTERWINDOWS
863 typedef struct _ref /* Refresh Window Structure */
864 {
865 WINDOW* win;
866 struct _ref* next;
867 struct _ref* tail;
868 } ACTIVE;
869
870 typedef struct _wins
871 {
872 WINDOW* w; /* pointer to a visible window */
873 struct _wins* next; /* Next visible window pointer */
874 struct _wins* prev; /* Next visible window pointer */
875 struct _wins* tail; /* Last visible window pointer */
876 /* Only head window (stdscr) has */
877 /* a valid tail pointer. */
878 } WINDS;
879 #endif
880
881 typedef struct /* structure for ripped off lines */
882 {
883 int line;
884 int (*init)();
885 } RIPPEDOFFLINE;
886
887
888 typedef struct
889 {
890 bool alive; /* if initscr() called */
891 bool autocr; /* if lf -> crlf */
892 bool cbreak; /* if terminal unbuffered */
893 bool echo; /* if terminal echo */
894 bool raw_inp; /* raw input mode (v. cooked input) */
895 bool raw_out; /* raw output mode (7 v. 8 bits) */
896 bool refrbrk; /* if premature refresh brk allowed */
897 bool orgcbr; /* original MSDOS ^-BREAK setting */
898 bool visible_cursor; /* TRUE if cursor is visible */
899 bool audible; /* FALSE if the bell is visual */
900 bool full_redraw; /* TRUE for bad performance */
901 bool direct_video; /* Allow Direct Screen Memory writes*/
902 bool mono; /* TRUE if current screen is mono. */
903 bool sizeable; /* TRUE if adapter is resizeable. */
904 bool resized; /* TRUE if TERM has been resized */
905 bool bogus_adapter; /* TRUE if adapter has insane values*/
906 bool shell; /* TRUE if reset_prog_mode() needs */
907 /* to be called. */
908 chtype blank; /* Background character */
909 attr_t orig_attr; /* Original screen attributes */
910 int cursrow; /* position of physical cursor */
911 int curscol; /* position of physical cursor */
912 int cursor; /* Current Cursor definition */
913 int visibility; /* Visibility of cursor */
914 int video_page; /* Current PC video page */
915 int orig_emulation; /* Original cursor emulation value */
916 int orig_cursor; /* Original cursor size */
917 int font; /* default font size */
918 int orig_font; /* Original font size */
919 int lines; /* New value for LINES */
920 int cols; /* New value for COLS */
921 unsigned long _trap_mbe; /* trap these mouse button events */
922 unsigned long _map_mbe_to_key; /* map mouse buttons to slk */
923 int slklines; /* Lines in use by slk_init() */
924 WINDOW * slk_winptr; /* window for slk */
925 int linesrippedoff; /* Lines ripped off via ripoffline() */
926 int linesrippedoffontop; /* Lines ripped off on top via ripoffline() */
927 int delaytenths; /* 1/10ths second to wait block getch() for */
928 bool _preserve; /* TRUE if screen background to be preserved */
929 bool _restore; /* TRUE if screen background to be restored */
930 bool save_key_modifiers; /* TRUE if each key modifiers saved with each key press */
931 bool return_key_modifiers; /* TRUE if modifier keys are returned as "real" keys */
932
933 #ifdef OS2
934 # ifdef EMXVIDEO /* nop if using EMX builtins */
935 int tahead; /* Type-ahead value */
936 int adapter; /* Screen type */
937 # else
938 VIOMODEINFO scrnmode; /* default screen mode */
939 VIOCONFIGINFO adapter; /* Screen type */
940 KBDINFO kbdinfo; /* keyboard info */
941 # endif
942 #else
943 int adapter; /* Screen type */
944 #endif
945
946 #if defined(DOS) || defined(WIN32)
947 int scrnmode; /* default screen mode */
948 unsigned video_seg; /* video base segment */
949 unsigned video_ofs; /* video base offset */
950 #endif
951
952 #if defined(OS2) || defined(WIN32)
953 int num_mouse_buttons; /* number of mouse buttons */
954 #endif
955
956 #if defined (XCURSES)
957 int XcurscrSize; /* size of Xcurscr shared memory block */
958 bool sb_on;
959 int sb_viewport_y;
960 int sb_viewport_x;
961 int sb_total_y;
962 int sb_total_x;
963 int sb_cur_y;
964 int sb_cur_x;
965 #endif
966
967 #ifdef REGISTERWINDOWS
968 WINDS* visible; /* List of visible windows */
969 bool refreshall; /* Refresh all registered windows? */
970 #endif
971
972 short line_color; /* Color of line attributes - default white */
973
974 } SCREEN;
975
976
977 /* external variables */
978 #if !defined(PDC_STATIC_BUILD) && defined(_MSC_VER) && defined(WIN32) && !defined(CURSES_LIBRARY)
979 __declspec(dllimport) int LINES; /* terminal height */
980 __declspec(dllimport) int COLS; /* terminal width */
981 __declspec(dllimport) WINDOW* stdscr; /* the default screen window */
982 __declspec(dllimport) WINDOW* curscr; /* the current screen image */
983 __declspec(dllimport) SCREEN *SP; /* curses variables */
984 __declspec(dllimport) int use_emalloc; /* set to true to use your own malloc,etc */
985 __declspec(dllimport) MOUSE_STATUS Mouse_status;
986 __declspec(dllimport) int COLORS;
987 __declspec(dllimport) int COLOR_PAIRS;
988 #else
989 # if !defined(PDC_STATIC_BUILD) && defined(_MSC_VER) && defined(WIN32)
990 __declspec(dllexport) extern int LINES; /* terminal height */
991 __declspec(dllexport) extern int COLS; /* terminal width */
992 __declspec(dllexport) extern WINDOW* stdscr; /* the default screen window */
993 __declspec(dllexport) extern WINDOW* curscr; /* the current screen image */
994 __declspec(dllexport) extern SCREEN *SP; /* curses variables */
995 __declspec(dllexport) extern int use_emalloc; /* set to true to use your own malloc,etc */
996 __declspec(dllexport) extern MOUSE_STATUS Mouse_status;
997 __declspec(dllexport) extern int COLORS;
998 __declspec(dllexport) extern int COLOR_PAIRS;
999 # else
1000 extern int LINES; /* terminal height */
1001 extern int COLS; /* terminal width */
1002 extern WINDOW* stdscr; /* the default screen window */
1003 extern WINDOW* curscr; /* the current screen image */
1004 extern SCREEN *SP; /* curses variables */
1005 extern int use_emalloc; /* set to true to use your own malloc,etc */
1006 extern MOUSE_STATUS Mouse_status;
1007 extern int COLORS,COLOR_PAIRS;
1008 # endif
1009 #endif
1010
1011 #if defined (CURSES_LIBRARY)
1012 extern int _default_lines; /* For presetting maximum lines */
1013 #endif
1014
1015 #ifdef REGISTERWINDOWS
1016 extern ACTIVE* CurWins; /* Currently Visible Windows */
1017 #endif
1018
1019
1020
1021
1022 /*man-start*********************************************************************
1023
1024 PDCurses Text Attributes:
1025
1026 To include colour in PDCurses, a number of things had to be sacrificed
1027 from the strict Unix and System V support.
1028 The main problem is fitting all character attributes and colour into
1029 an unsigned char (all 8 bits!). On System V, chtype is a long on
1030 PDCurses it is a short int.
1031
1032 The following is the structure of a win->_attrs chtype:
1033
1034 -------------------------------------------------------------------------------------------------
1035 |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
1036 -------------------------------------------------------------------------------------------------
1037 colour number | modifiers | character eg 'a' (potential for DBCS)
1038
1039 The available attribute modifiers are bold, underline, invisible, protect, reverse
1040 and blink.
1041
1042 **man-end**********************************************************************/
1043
1044 /* Video attribute definitions. */
1045 #ifdef CHTYPE_LONG
1046 # define A_NORMAL 0x00000000L
1047 # define A_UNDERLINE 0x00100000L
1048 # define A_REVERSE 0x00200000L
1049 # define A_BLINK 0x00400000L
1050 # define A_BOLD 0x00800000L
1051 # define A_RIGHTLINE 0x00010000L
1052 # define A_DIM 0x00020000L
1053 # define A_ALTCHARSET 0x00040000L
1054 # define A_INVIS 0x00080000L
1055 # define A_ATTRIBUTES 0xFFFF0000L
1056 # define A_CHARTEXT 0x0000FFFFL
1057 # define A_COLOR 0xFF000000L
1058
1059 # define A_LEFTLINE A_DIM
1060 # define A_ITALIC A_INVIS
1061 # define A_STANDOUT ( A_BOLD | A_REVERSE )
1062 # define A_PROTECT ( A_UNDERLINE | A_LEFTLINE | A_RIGHTLINE )
1063
1064 #else
1065
1066 # define A_NORMAL (chtype)0x0000 /* System V */
1067 # define A_ALTCHARSET (chtype)0x0000 /* X/Open */
1068 # define A_BLINK (chtype)0x0400 /* X/Open */
1069 # define A_BLANK (chtype)0x0000 /* X/Open */
1070 # define A_BOLD (chtype)0x0100 /* X/Open */
1071 # define A_DIM (chtype)0x0000 /* X/Open */
1072 # define A_PROTECT (chtype)0x0000 /* X/Open */
1073 # define A_REVERSE (chtype)0x0200 /* X/Open */
1074 # define A_STANDOUT ((chtype)(A_REVERSE | A_BOLD)) /* X/Open */
1075 # define A_UNDERLINE (chtype)0x0000 /* X/Open */
1076 # define A_COLOR (chtype)0xF800 /* System V */
1077 # define A_CHARTEXT (chtype)(0xFF) /* X/Open */
1078 # define A_ATTRIBUTES (chtype)(~A_CHARTEXT) /* X/Open */
1079 #endif
1080
1081 #define CHR_MSK A_CHARTEXT /* Obsolete */
1082 #define ATR_MSK A_ATTRIBUTES /* Obsolete */
1083 #define ATR_NRM A_NORMAL /* Obsolete */
1084
1085 #ifdef XCURSES
1086 extern chtype *acs_map;
1087
1088 # define ACS_BSSB (acs_map['l'])
1089 # define ACS_SSBB (acs_map['m'])
1090 # define ACS_BBSS (acs_map['k'])
1091 # define ACS_SBBS (acs_map['j'])
1092 # define ACS_SBSS (acs_map['u'])
1093 # define ACS_SSSB (acs_map['t'])
1094 # define ACS_SSBS (acs_map['v'])
1095 # define ACS_BSSS (acs_map['w'])
1096 # define ACS_BSBS (acs_map['q'])
1097 # define ACS_SBSB (acs_map['x'])
1098 # define ACS_SSSS (acs_map['n'])
1099
1100 # define ACS_ULCORNER ACS_BSSB
1101 # define ACS_LLCORNER ACS_SSBB
1102 # define ACS_URCORNER ACS_BBSS
1103 # define ACS_LRCORNER ACS_SBBS
1104 # define ACS_RTEE ACS_SBSS
1105 # define ACS_LTEE ACS_SSSB
1106 # define ACS_BTEE ACS_SSBS
1107 # define ACS_TTEE ACS_BSSS
1108 # define ACS_HLINE ACS_BSBS
1109 # define ACS_VLINE ACS_SBSB
1110 # define ACS_PLUS ACS_SSSS
1111
1112 # define ACS_S1 (acs_map['o'])
1113 # define ACS_S9 (acs_map['s'])
1114 # define ACS_DIAMOND (acs_map['\''])
1115 # define ACS_CKBOARD (acs_map['a'])
1116 # define ACS_DEGREE (acs_map['f'])
1117 # define ACS_PLMINUS (acs_map['g'])
1118 # define ACS_BULLET (acs_map['~'])
1119 # define ACS_LARROW (acs_map[','])
1120 # define ACS_RARROW (acs_map['+'])
1121 # define ACS_DARROW (acs_map['.'])
1122 # define ACS_UARROW (acs_map['-'])
1123 # define ACS_BOARD (acs_map['h'])
1124 # define ACS_LANTERN (acs_map['i'])
1125 # define ACS_BLOCK (acs_map['0'])
1126
1127 # define ACS_S3 (acs_map['p'])
1128 # define ACS_S7 (acs_map['r'])
1129 # define ACS_LEQUAL (acs_map['y'])
1130 # define ACS_GEQUAL (acs_map['z'])
1131 # define ACS_PI (acs_map['{'])
1132 # define ACS_NEQUAL (acs_map['|'])
1133 # define ACS_STERLING (acs_map['}'])
1134 #endif
1135
1136 #if defined(DOS) || defined(OS2) || defined(WIN32)
1137 /* ALTCHARSET definitions from jshumate@wrdis01.robins.af.mil */
1138 # define ACS_ULCORNER (chtype)0xda /* SysV */
1139 # define ACS_LLCORNER (chtype)0xc0 /* SysV */
1140 # define ACS_URCORNER (chtype)0xbf /* SysV */
1141 # define ACS_LRCORNER (chtype)0xd9 /* SysV */
1142 # define ACS_RTEE (chtype)0xb4 /* SysV */
1143 # define ACS_LTEE (chtype)0xc3 /* SysV */
1144 # define ACS_BTEE (chtype)0xc1 /* SysV */
1145 # define ACS_TTEE (chtype)0xc2 /* SysV */
1146 # define ACS_HLINE (chtype)0xc4 /* SysV */
1147 # define ACS_VLINE (chtype)0xb3 /* SysV */
1148 # define ACS_PLUS (chtype)0xc5 /* SysV */
1149 # define ACS_S1 (chtype)0x2d /* SysV */
1150 # define ACS_S9 (chtype)0x5f /* SysV */
1151 # define ACS_DIAMOND (chtype)0xc5 /* SysV */
1152 # define ACS_CKBOARD (chtype)0xb2 /* SysV */
1153 # define ACS_DEGREE (chtype)0xf8 /* SysV */
1154 # define ACS_PLMINUS (chtype)0xf1 /* SysV */
1155 # define ACS_BULLET (chtype)0xf9 /* SysV */
1156 # define ACS_LARROW (chtype)0x3c /* SysV */
1157 # define ACS_RARROW (chtype)0x3e /* SysV */
1158 # define ACS_DARROW (chtype)0x76 /* SysV */
1159 # define ACS_UARROW (chtype)0x5e /* SysV */
1160 # define ACS_BOARD (chtype)0x23 /* SysV */
1161 # define ACS_LANTERN (chtype)0x23 /* SysV */
1162 # define ACS_BLOCK (chtype)0x23 /* SysV */
1163
1164 /* the following definitions can be used if you have set raw_output()
1165 or are using the PDCurses *raw*() functions */
1166 # if 0
1167 # define ACS_DIAMOND (chtype)0x04 /* SysV */
1168 # define ACS_LARROW (chtype)0x1b /* SysV */
1169 # define ACS_RARROW (chtype)0x1a /* SysV */
1170 # define ACS_DARROW (chtype)0x19 /* SysV */
1171 # define ACS_UARROW (chtype)0x18 /* SysV */
1172 # define ACS_BOARD (chtype)0xb0 /* SysV */
1173 # define ACS_LANTERN (chtype)0x0f /* SysV */
1174 # define ACS_BLOCK (chtype)0xdb /* SysV */
1175 # endif
1176 #endif
1177
1178 /* colour attributes */
1179 #if defined (XCURSES)
1180 # define COLOR_BLACK 0
1181 # define COLOR_RED 1
1182 # define COLOR_GREEN 2
1183 # define COLOR_YELLOW 3
1184 # define COLOR_BLUE 4
1185 # define COLOR_MAGENTA 5
1186 # define COLOR_CYAN 6
1187 # define COLOR_WHITE 7
1188 #endif
1189
1190 #if defined(DOS) || defined(OS2)
1191 # define COLOR_BLACK 0
1192 # define COLOR_BLUE 1
1193 # define COLOR_GREEN 2
1194 # define COLOR_CYAN 3
1195 # define COLOR_RED 4
1196 # define COLOR_MAGENTA 5
1197 # define COLOR_YELLOW 6
1198 # define COLOR_WHITE 7
1199 #endif
1200
1201 #if defined(WIN32)
1202 # define MS_MOUSE_MOVED 0x0001
1203 /*
1204 * These defines taken directly from windows.h to reduce
1205 * compilation time by only #include'ing <windows.h>
1206 * when absolutely necesssary. Cygnus-W32 #defines all of these
1207 * so we need to check for that.
1208 */
1209 # ifndef FOREGROUND_BLUE
1210 # define FOREGROUND_BLUE 0x0001
1211 # endif
1212 # ifndef FOREGROUND_GREEN
1213 # define FOREGROUND_GREEN 0x0002
1214 # endif
1215 # ifndef FOREGROUND_RED
1216 # define FOREGROUND_RED 0x0004
1217 # endif
1218 # ifndef FOREGROUND_INTENSITY
1219 # define FOREGROUND_INTENSITY 0x0008 /* BOLD */
1220 # endif
1221 # ifndef BACKGROUND_BLUE
1222 # define BACKGROUND_BLUE 0x0010
1223 # endif
1224 # ifndef BACKGROUND_GREEN
1225 # define BACKGROUND_GREEN 0x0020
1226 # endif
1227 # ifndef BACKGROUND_RED
1228 # define BACKGROUND_RED 0x0040
1229 # endif
1230 # ifndef BACKGROUND_INTENSITY
1231 # define BACKGROUND_INTENSITY 0x0080 /* BLINK */
1232 # endif
1233
1234 # define COLOR_BLACK 0
1235 # define COLOR_BLUE FOREGROUND_BLUE
1236 # define COLOR_RED FOREGROUND_RED
1237 # define COLOR_GREEN FOREGROUND_GREEN
1238 # define COLOR_CYAN FOREGROUND_BLUE | FOREGROUND_GREEN
1239 # define COLOR_MAGENTA FOREGROUND_RED | FOREGROUND_BLUE
1240 # define COLOR_YELLOW FOREGROUND_RED | FOREGROUND_GREEN
1241 # define COLOR_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
1242 #endif
1243
1244 #ifdef CHTYPE_LONG
1245 #define COLOR_PAIR(n) ((chtype)(n) << 24)
1246 #define PAIR_NUMBER(n) (((n) & A_COLOR) >> 24)
1247 #else
1248 #define COLOR_PAIR(n) (((n) << 11) & A_ATTRIBUTES)
1249 #define PAIR_NUMBER(n) (((n) & A_COLOR) >> 11)
1250 #endif
1251
1252 /*----------------------------------------------------------------------
1253 *
1254 * Function and Keypad Key Definitions.
1255 * Many are just for compatibility.
1256 *
1257 */
1258 #define KEY_MIN 0x101 /* Minimum curses key value */
1259 #define KEY_BREAK 0x101 /* Not on PC KBD */
1260 #define KEY_DOWN 0x102 /* Down arrow key */
1261 #define KEY_UP 0x103 /* Up arrow key */
1262 #define KEY_LEFT 0x104 /* Left arrow key */
1263 #define KEY_RIGHT 0x105 /* Right arrow key */
1264 #define KEY_HOME 0x106 /* home key */
1265 #define KEY_BACKSPACE 0x107 /* not on pc */
1266 #define KEY_F0 0x108 /* function keys. space for */
1267 #define KEY_F(n) (KEY_F0+(n))/* 64 keys are reserved. */
1268 #define KEY_DL 0x148 /* delete line */
1269 #define KEY_IL 0x149 /* insert line */
1270 #define KEY_DC 0x14a /* delete character */
1271 #define KEY_IC 0x14b /* insert char or enter ins mode */
1272 #define KEY_EIC 0x14c /* exit insert char mode */
1273 #define KEY_CLEAR 0x14d /* clear screen */
1274 #define KEY_EOS 0x14e /* clear to end of screen */
1275 #define KEY_EOL 0x14f /* clear to end of line */
1276 #define KEY_SF 0x150 /* scroll 1 line forward */
1277 #define KEY_SR 0x151 /* scroll 1 line back (reverse) */
1278 #define KEY_NPAGE 0x152 /* next page */
1279 #define KEY_PPAGE 0x153 /* previous page */
1280 #define KEY_STAB 0x154 /* set tab */
1281 #define KEY_CTAB 0x155 /* clear tab */
1282 #define KEY_CATAB 0x156 /* clear all tabs */
1283 #define KEY_ENTER 0x157 /* enter or send (unreliable) */
1284 #define KEY_SRESET 0x158 /* soft/reset (partial/unreliable)*/
1285 #define KEY_RESET 0x159 /* reset/hard reset (unreliable) */
1286 #define KEY_PRINT 0x15a /* print/copy */
1287 #define KEY_LL 0x15b /* home down/bottom (lower left) */
1288 #define KEY_ABORT 0x15c /* abort/terminate key (any) */
1289 #define KEY_SHELP 0x15d /* short help */
1290 #define KEY_LHELP 0x15e /* long help */
1291 #define KEY_BTAB 0x15f /* Back tab key */
1292 #define KEY_BEG 0x160 /* beg(inning) key */
1293 #define KEY_CANCEL 0x161 /* cancel key */
1294 #define KEY_CLOSE 0x162 /* close key */
1295 #define KEY_COMMAND 0x163 /* cmd (command) key */
1296 #define KEY_COPY 0x164 /* copy key */
1297 #define KEY_CREATE 0x165 /* create key */
1298 #define KEY_END 0x166 /* end key */
1299 #define KEY_EXIT 0x167 /* exit key */
1300 #define KEY_FIND 0x168 /* find key */
1301 #define KEY_HELP 0x169 /* help key */
1302 #define KEY_MARK 0x16a /* mark key */
1303 #define KEY_MESSAGE 0x16b /* message key */
1304 #define KEY_MOVE 0x16c /* move key */
1305 #define KEY_NEXT 0x16d /* next object key */
1306 #define KEY_OPEN 0x16e /* open key */
1307 #define KEY_OPTIONS 0x16f /* options key */
1308 #define KEY_PREVIOUS 0x170 /* previous object key */
1309 #define KEY_REDO 0x171 /* redo key */
1310 #define KEY_REFERENCE 0x172 /* ref(erence) key */
1311 #define KEY_REFRESH 0x173 /* refresh key */
1312 #define KEY_REPLACE 0x174 /* replace key */
1313 #define KEY_RESTART 0x175 /* restart key */
1314 #define KEY_RESUME 0x176 /* resume key */
1315 #define KEY_SAVE 0x177 /* save key */
1316 #define KEY_SBEG 0x178 /* shifted beginning key */
1317 #define KEY_SCANCEL 0x179 /* shifted cancel key */
1318 #define KEY_SCOMMAND 0x17a /* shifted command key */
1319 #define KEY_SCOPY 0x17b /* shifted copy key */
1320 #define KEY_SCREATE 0x17c /* shifted create key */
1321 #define KEY_SDC 0x17d /* shifted delete char key */
1322 #define KEY_SDL 0x17e /* shifted delete line key */
1323 #define KEY_SELECT 0x17f /* select key */
1324 #define KEY_SEND 0x180 /* shifted end key */
1325 #define KEY_SEOL 0x181 /* shifted clear line key */
1326 #define KEY_SEXIT 0x182 /* shifted exit key */
1327 #define KEY_SFIND 0x183 /* shifted find key */
1328 #define KEY_SHOME 0x184 /* shifted home key */
1329 #define KEY_SIC 0x185 /* shifted input key */
1330 #define KEY_SLEFT 0x187 /* shifted left arrow key */
1331 #define KEY_SMESSAGE 0x188 /* shifted message key */
1332 #define KEY_SMOVE 0x189 /* shifted move key */
1333 #define KEY_SNEXT 0x18a /* shifted next key */
1334 #define KEY_SOPTIONS 0x18b /* shifted options key */
1335 #define KEY_SPREVIOUS 0x18c /* shifted prev key */
1336 #define KEY_SPRINT 0x18d /* shifted print key */
1337 #define KEY_SREDO 0x18e /* shifted redo key */
1338 #define KEY_SREPLACE 0x18f /* shifted replace key */
1339 #define KEY_SRIGHT 0x190 /* shifted right arrow */
1340 #define KEY_SRSUME 0x191 /* shifted resume key */
1341 #define KEY_SSAVE 0x192 /* shifted save key */
1342 #define KEY_SSUSPEND 0x193 /* shifted suspend key */
1343 #define KEY_SUNDO 0x194 /* shifted undo key */
1344 #define KEY_SUSPEND 0x195 /* suspend key */
1345 #define KEY_UNDO 0x196 /* undo key */
1346
1347 /* PDCurses specific key definitions */
1348
1349 #define ALT_0 0x197 /* Alt-0 PC only */
1350 #define ALT_1 0x198 /* Alt-1 PC only */
1351 #define ALT_2 0x199 /* Alt-2 PC only */
1352 #define ALT_3 0x19a /* Alt-3 PC only */
1353 #define ALT_4 0x19b /* Alt-4 PC only */
1354 #define ALT_5 0x19c /* Alt-5 PC only */
1355 #define ALT_6 0x19d /* Alt-6 PC only */
1356 #define ALT_7 0x19e /* Alt-7 PC only */
1357 #define ALT_8 0x19f /* Alt-8 PC only */
1358 #define ALT_9 0x1a0 /* Alt-9 PC only */
1359 #define ALT_A 0x1a1 /* Alt-A PC only */
1360 #define ALT_B 0x1a2 /* Alt-B PC only */
1361 #define ALT_C 0x1a3 /* Alt-C PC only */
1362 #define ALT_D 0x1a4 /* Alt-D PC only */
1363 #define ALT_E 0x1a5 /* Alt-E PC only */
1364 #define ALT_F 0x1a6 /* Alt-F PC only */
1365 #define ALT_G 0x1a7 /* Alt-G PC only */
1366 #define ALT_H 0x1a8 /* Alt-H PC only */
1367 #define ALT_I 0x1a9 /* Alt-I PC only */
1368 #define ALT_J 0x1aa /* Alt-J PC only */
1369 #define ALT_K 0x1ab /* Alt-K PC only */
1370 #define ALT_L 0x1ac /* Alt-L PC only */
1371 #define ALT_M 0x1ad /* Alt-M PC only */
1372 #define ALT_N 0x1ae /* Alt-N PC only */
1373 #define ALT_O 0x1af /* Alt-O PC only */
1374 #define ALT_P 0x1b0 /* Alt-P PC only */
1375 #define ALT_Q 0x1b1 /* Alt-Q PC only */
1376 #define ALT_R 0x1b2 /* Alt-R PC only */
1377 #define ALT_S 0x1b3 /* Alt-S PC only */
1378 #define ALT_T 0x1b4 /* Alt-T PC only */
1379 #define ALT_U 0x1b5 /* Alt-U PC only */
1380 #define ALT_V 0x1b6 /* Alt-V PC only */
1381 #define ALT_W 0x1b7 /* Alt-W PC only */
1382 #define ALT_X 0x1b8 /* Alt-X PC only */
1383 #define ALT_Y 0x1b9 /* Alt-Y PC only */
1384 #define ALT_Z 0x1ba /* Alt-Z PC only */
1385 #define CTL_LEFT 0x1bb /* Control-Left-Arrow PC only */
1386 #define CTL_RIGHT 0x1bc /* Control-Right-Arrow PC only */
1387 #define CTL_PGUP 0x1bd /* Control-PgUp PC only */
1388 #define CTL_PGDN 0x1be /* Control-PgDn PC only */
1389 #define CTL_HOME 0x1bf /* Control-Home PC only */
1390 #define CTL_END 0x1c0 /* Control-End PC only */
1391
1392 #if defined(FLEXOS)
1393 # define KEY_MOUSE 0x1c1 /* "mouse" key */
1394 # define KEY_A1 KEY_HOME/* upper left on Virtual keypad */
1395 # define KEY_A2 KEY_UP /* upper middle on Virt. keypad */
1396 # define KEY_A3 KEY_PPAGE/* upper right on Vir. keypad */
1397 # define KEY_B1 KEY_LEFT/* middle left on Virt. keypad */
1398 # define KEY_B2 0x00 /* center on Virt. keypad */
1399 # define KEY_B3 KEY_RIGHT/* middle right on Vir. keypad */
1400 # define KEY_C1 KEY_LL /* lower left on Virt. keypad */
1401 # define KEY_C2 KEY_DOWN /* lower middle on Virt. keypad */
1402 # define KEY_C3 KEY_NPAGE /* lower right on Vir. keypad */
1403 # define KEY_MAX KEY_MOUSE /* Maximum curses key */
1404 #endif
1405
1406
1407 #if defined(DOS) || defined (OS2) || defined(XCURSES) || defined(WIN32)
1408 # define KEY_A1 0x1c1 /* upper left on Virtual keypad */
1409 # define KEY_A2 0x1c2 /* upper middle on Virt. keypad */
1410 # define KEY_A3 0x1c3 /* upper right on Vir. keypad */
1411 # define KEY_B1 0x1c4 /* middle left on Virt. keypad */
1412 # define KEY_B2 0x1c5 /* center on Virt. keypad */
1413 # define KEY_B3 0x1c6 /* middle right on Vir. keypad */
1414 # define KEY_C1 0x1c7 /* lower left on Virt. keypad */
1415 # define KEY_C2 0x1c8 /* lower middle on Virt. keypad */
1416 # define KEY_C3 0x1c9 /* lower right on Vir. keypad */
1417 # define PADSLASH 0x1ca /* slash on keypad */
1418 # define PADENTER 0x1cb /* enter on keypad */
1419 # define CTL_PADENTER 0x1cc /* ctl-enter on keypad */
1420 # define ALT_PADENTER 0x1cd /* alt-enter on keypad */
1421 # define PADSTOP 0x1ce /* stop on keypad */
1422 # define PADSTAR 0x1cf /* star on keypad */
1423 # define PADMINUS 0x1d0 /* minus on keypad */
1424 # define PADPLUS 0x1d1 /* plus on keypad */
1425 # define CTL_PADSTOP 0x1d2 /* ctl-stop on keypad */
1426 # define CTL_PADCENTER 0x1d3 /* ctl-enter on keypad */
1427 # define CTL_PADPLUS 0x1d4 /* ctl-plus on keypad */
1428 # define CTL_PADMINUS 0x1d5 /* ctl-minus on keypad */
1429 # define CTL_PADSLASH 0x1d6 /* ctl-slash on keypad */
1430 # define CTL_PADSTAR 0x1d7 /* ctl-star on keypad */
1431 # define ALT_PADPLUS 0x1d8 /* alt-plus on keypad */
1432 # define ALT_PADMINUS 0x1d9 /* alt-minus on keypad */
1433 # define ALT_PADSLASH 0x1da /* alt-slash on keypad */
1434 # define ALT_PADSTAR 0x1db /* alt-star on keypad */
1435 # define ALT_PADSTOP 0x1dc /* alt-stop on keypad */
1436 # define CTL_INS 0x1dd /* ctl-insert */
1437 # define ALT_DEL 0x1de /* alt-delete */
1438 # define ALT_INS 0x1df /* alt-insert */
1439 # define CTL_UP 0x1e0 /* ctl-up arrow */
1440 # define CTL_DOWN 0x1e1 /* ctl-down arrow */
1441 # define CTL_TAB 0x1e2 /* ctl-tab */
1442 # define ALT_TAB 0x1e3 /* alt-tab */
1443 # define ALT_MINUS 0x1e4 /* alt-minus */
1444 # define ALT_EQUAL 0x1e5 /* alt-equal */
1445 # define ALT_HOME 0x1e6 /* alt-home */
1446 # define ALT_PGUP 0x1e7 /* alt-pgup */
1447 # define ALT_PGDN 0x1e8 /* alt-pgdn */
1448 # define ALT_END 0x1e9 /* alt-end */
1449 # define ALT_UP 0x1ea /* alt-up arrow */
1450 # define ALT_DOWN 0x1eb /* alt-down arrow */
1451 # define ALT_RIGHT 0x1ec /* alt-right arrow */
1452 # define ALT_LEFT 0x1ed /* alt-left arrow */
1453 # define ALT_ENTER 0x1ee /* alt-enter */
1454 # define ALT_ESC 0x1ef /* alt-escape */
1455 # define ALT_BQUOTE 0x1f0 /* alt-back quote */
1456 # define ALT_LBRACKET 0x1f1 /* alt-left bracket */
1457 # define ALT_RBRACKET 0x1f2 /* alt-right bracket */
1458 # define ALT_SEMICOLON 0x1f3 /* alt-semi-colon */
1459 # define ALT_FQUOTE 0x1f4 /* alt-forward quote */
1460 # define ALT_COMMA 0x1f5 /* alt-comma */
1461 # define ALT_STOP 0x1f6 /* alt-stop */
1462 # define ALT_FSLASH 0x1f7 /* alt-forward slash */
1463 # define ALT_BKSP 0x1f8 /* alt-backspace */
1464 # define CTL_BKSP 0x1f9 /* ctl-backspace */
1465 # define PAD0 0x1fa /* ctl-keypad 0 */
1466 # define CTL_PAD0 0x1fb /* ctl-keypad 0 */
1467 # define CTL_PAD1 0x1fc /* ctl-keypad 1 */
1468 # define CTL_PAD2 0x1fd /* ctl-keypad 2 */
1469 # define CTL_PAD3 0x1fe /* ctl-keypad 3 */
1470 # define CTL_PAD4 0x1ff /* ctl-keypad 4 */
1471 # define CTL_PAD5 0x200 /* ctl-keypad 5 */
1472 # define CTL_PAD6 0x201 /* ctl-keypad 6 */
1473 # define CTL_PAD7 0x202 /* ctl-keypad 7 */
1474 # define CTL_PAD8 0x203 /* ctl-keypad 8 */
1475 # define CTL_PAD9 0x204 /* ctl-keypad 9 */
1476 # define ALT_PAD0 0x205 /* ctl-keypad 0 */
1477 # define ALT_PAD1 0x206 /* ctl-keypad 1 */
1478 # define ALT_PAD2 0x207 /* ctl-keypad 2 */
1479 # define ALT_PAD3 0x208 /* ctl-keypad 3 */
1480 # define ALT_PAD4 0x209 /* ctl-keypad 4 */
1481 # define ALT_PAD5 0x20a /* ctl-keypad 5 */
1482 # define ALT_PAD6 0x20b /* ctl-keypad 6 */
1483 # define ALT_PAD7 0x20c /* ctl-keypad 7 */
1484 # define ALT_PAD8 0x20d /* ctl-keypad 8 */
1485 # define ALT_PAD9 0x20e /* ctl-keypad 9 */
1486 # define CTL_DEL 0x20f /* clt-delete */
1487 # define ALT_BSLASH 0x210 /* alt-back slash */
1488 # define CTL_ENTER 0x211 /* ctl-enter */
1489 # define SHF_PADENTER 0x212 /* shift-enter on keypad */
1490 # define SHF_PADSLASH 0x213 /* shift-slash on keypad */
1491 # define SHF_PADSTAR 0x214 /* shift-star on keypad */
1492 # define SHF_PADPLUS 0x215 /* shift-plus on keypad */
1493 # define SHF_PADMINUS 0x216 /* shift-minus on keypad */
1494 # define SHF_UP 0x217 /* shift-up on keypad */
1495 # define SHF_DOWN 0x218 /* shift-down on keypad */
1496 # define SHF_IC 0x219 /* shift-insert on keypad */
1497 # define SHF_DC 0x21a /* shift-delete on keypad */
1498 # define KEY_MOUSE 0x21b /* "mouse" key */
1499 # define KEY_SHIFT_L 0x21c /* Left-shift */
1500 # define KEY_SHIFT_R 0x21d /* Right-shift */
1501 # define KEY_CONTROL_L 0x21e /* Left-control */
1502 # define KEY_CONTROL_R 0x21f /* Right-control */
1503 # define KEY_ALT_L 0x220 /* Left-alt */
1504 # define KEY_ALT_R 0x221 /* Right-alt */
1505 # define KEY_RESIZE 0x222 /* Window resize */
1506 # define KEY_SUP 0x223 /* Shifted up arrow */
1507 # define KEY_SDOWN 0x224 /* Shifted down arrow */
1508 # define KEY_MAX 0x224 /* Maximum curses key */
1509 #endif
1510
1511 /*----------------------------------------------------------------------
1512 * PDCurses function declarations
1513 */
1514 #ifdef HAVE_PROTO
1515 int PDC_CDECL addchnstr( chtype *, int );
1516 int PDC_CDECL baudrate( void );
1517 int PDC_CDECL beep( void );
1518 int PDC_CDECL border( chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
1519 int PDC_CDECL can_change_color ( void );
1520 int PDC_CDECL clearok( WINDOW*, bool );
1521 int PDC_CDECL color_content( short, short*, short*, short* );
1522 int PDC_CDECL copywin( WINDOW*, WINDOW*, int, int, int, int, int, int, int );
1523 int PDC_CDECL curs_set( int );
1524 int PDC_CDECL def_prog_mode( void );
1525 int PDC_CDECL def_shell_mode( void );
1526 int PDC_CDECL delay_output( int );
1527 int PDC_CDECL delwin( WINDOW* );
1528 WINDOW* PDC_CDECL derwin( WINDOW*, int, int, int, int );
1529 int PDC_CDECL doupdate( void );
1530 WINDOW* PDC_CDECL dupwin( WINDOW* );
1531 int PDC_CDECL endwin( void );
1532 int PDC_CDECL erase( void );
1533 char PDC_CDECL erasechar( void );
1534 int PDC_CDECL flash( void );
1535 int PDC_CDECL flushinp( void );
1536 int PDC_CDECL getsyx( int*, int* );
1537 int PDC_CDECL halfdelay( int );
1538 bool PDC_CDECL has_colors( void );
1539 int PDC_CDECL hline( chtype, int );
1540 int PDC_CDECL immedok( WINDOW*, bool );
1541 int PDC_CDECL inchnstr( chtype *, int );
1542 int PDC_CDECL init_color( short, short, short, short );
1543 int PDC_CDECL init_pair( short, short, short );
1544 WINDOW* PDC_CDECL initscr( void );
1545 #ifdef XCURSES
1546 WINDOW* PDC_CDECL Xinitscr( int, char ** );
1547 #endif
1548 int PDC_CDECL intrflush( WINDOW*, bool );
1549 int PDC_CDECL is_linetouched(WINDOW *,int);
1550 int PDC_CDECL is_wintouched(WINDOW *);
1551 char* PDC_CDECL keyname( int );
1552 char PDC_CDECL killchar( void );
1553 char* PDC_CDECL longname( void );
1554 int PDC_CDECL meta( WINDOW*, bool );
1555 int PDC_CDECL mvcur( int, int, int, int );
1556 int PDC_CDECL mvderwin( WINDOW*, int, int );
1557 #ifdef HAVE_STDARG_H
1558 int PDC_CDECL mvprintw( int, int, char*,... );
1559 int PDC_CDECL mvscanw( int, int, char*,... );
1560 #endif
1561 int PDC_CDECL mvwaddnstr( WINDOW*,int,int,char*,int );
1562 int PDC_CDECL mvwin( WINDOW*, int, int );
1563 int PDC_CDECL mvwinsertln( WINDOW*, int, int );
1564 #ifdef HAVE_STDARG_H
1565 int PDC_CDECL mvwprintw( WINDOW*, int, int, char*,... );
1566 int PDC_CDECL mvwscanw( WINDOW*, int, int, char*,... );
1567 #endif
1568 WINDOW* PDC_CDECL newpad( int, int );
1569 SCREEN* PDC_CDECL newterm( char*, FILE*, FILE* );
1570 WINDOW* PDC_CDECL newwin( int, int, int, int );
1571 int PDC_CDECL noraw( void );
1572 int PDC_CDECL notimeout( WINDOW *, bool );
1573 int PDC_CDECL overlay( WINDOW*, WINDOW* );
1574 int PDC_CDECL overwrite( WINDOW*, WINDOW* );
1575 int PDC_CDECL pair_content( int, short*, short* );
1576 int PDC_CDECL pechochar( WINDOW *, chtype );
1577 int PDC_CDECL pnoutrefresh( WINDOW*, int, int, int, int, int, int );
1578 int PDC_CDECL prefresh( WINDOW*, int, int, int, int, int, int );
1579 #ifdef HAVE_STDARG_H
1580 int PDC_CDECL printw( char*,... );
1581 int PDC_CDECL scanw( char*,... );
1582 #endif
1583 int PDC_CDECL raw( void );
1584 int PDC_CDECL refresh( void );
1585 int PDC_CDECL reset_prog_mode( void );
1586 int PDC_CDECL reset_shell_mode( void );
1587 int PDC_CDECL resetty( void );
1588 int PDC_CDECL ripoffline(int, int (*)(WINDOW *, int));
1589 int PDC_CDECL savetty( void );
1590 int PDC_CDECL sb_init(void);
1591 int PDC_CDECL sb_set_horz(int, int, int);
1592 int PDC_CDECL sb_set_vert(int, int, int);
1593 int PDC_CDECL sb_get_horz(int *, int *, int *);
1594 int PDC_CDECL sb_get_vert(int *, int *, int *);
1595 int PDC_CDECL sb_refresh(void);
1596 int PDC_CDECL scroll( WINDOW* );
1597 SCREEN* PDC_CDECL set_term( SCREEN* );
1598 int PDC_CDECL setsyx( int, int );
1599 int PDC_CDECL start_color( void );
1600 int PDC_CDECL slk_init(int);
1601 int PDC_CDECL slk_set(int, char *, int);
1602 int PDC_CDECL slk_refresh(void);
1603 int PDC_CDECL slk_noutrefresh(void);
1604 char* PDC_CDECL slk_label(int);
1605 int PDC_CDECL slk_clear(void);
1606 int PDC_CDECL slk_restore(void);
1607 int PDC_CDECL slk_touch(void);
1608 int PDC_CDECL slk_attron(attr_t);
1609 int PDC_CDECL slk_attrset(attr_t);
1610 int PDC_CDECL slk_attroff(attr_t);
1611 WINDOW* PDC_CDECL subpad( WINDOW*, int, int, int, int );
1612 WINDOW* PDC_CDECL subwin( WINDOW*, int, int, int, int );
1613 int PDC_CDECL syncok(WINDOW*, bool);
1614 attr_t PDC_CDECL termattrs( void );
1615 char* PDC_CDECL termname( void );
1616 int PDC_CDECL touchline( WINDOW*, int ,int );
1617 int PDC_CDECL touchwin( WINDOW* );
1618 #if !defined (CURSES_LIBRARY)
1619 void PDC_CDECL traceoff( void );
1620 void PDC_CDECL traceon( void );
1621 #endif
1622 int PDC_CDECL typeahead( int );
1623 char* PDC_CDECL unctrl( chtype );
1624 int PDC_CDECL vline( chtype, int );
1625 int PDC_CDECL waddchnstr( WINDOW*, chtype*, int );
1626 int PDC_CDECL waddnstr( WINDOW*, char*, int );
1627 int PDC_CDECL waddstr( WINDOW*, char* );
1628 int PDC_CDECL wattroff( WINDOW*, attr_t );
1629 int PDC_CDECL wattron( WINDOW*, attr_t );
1630 int PDC_CDECL wattrset( WINDOW*, attr_t );
1631 int PDC_CDECL wbkgd(WINDOW*, chtype);
1632 void PDC_CDECL wbkgdset(WINDOW*, chtype);
1633 int PDC_CDECL wborder( WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
1634 int PDC_CDECL wclear( WINDOW* );
1635 int PDC_CDECL wclrtobot( WINDOW* );
1636 int PDC_CDECL wclrtoeol( WINDOW* );
1637 void PDC_CDECL wcursyncup(WINDOW*);
1638 int PDC_CDECL wdelch( WINDOW* );
1639 int PDC_CDECL wdeleteln( WINDOW* );
1640 int PDC_CDECL werase( WINDOW* );
1641 int PDC_CDECL wgetch( WINDOW* );
1642 int PDC_CDECL wgetnstr( WINDOW*, char*, int );
1643 int PDC_CDECL wgetstr( WINDOW*, char* );
1644 int PDC_CDECL whline( WINDOW*, chtype, int );
1645 int PDC_CDECL winchnstr( WINDOW*, chtype*, int );
1646 int PDC_CDECL winnstr( WINDOW*, char*, int );
1647 int PDC_CDECL winsch( WINDOW*, chtype );
1648 int PDC_CDECL winsdelln( WINDOW*, int );
1649 int PDC_CDECL winsertln( WINDOW* );
1650 int PDC_CDECL winsnstr( WINDOW*, char*, int );
1651 int PDC_CDECL wmove( WINDOW*, int, int );
1652 int PDC_CDECL wnoutrefresh( WINDOW* );
1653 char PDC_CDECL wordchar( void );
1654 #ifdef HAVE_STDARG_H
1655 int PDC_CDECL wprintw( WINDOW*, char*,... );
1656 int PDC_CDECL wscanw( WINDOW*, char*,... );
1657 #endif
1658 int PDC_CDECL wredrawln( WINDOW*, int ,int );
1659 int PDC_CDECL wrefresh( WINDOW* );
1660 int PDC_CDECL wscrl( WINDOW*, int );
1661 int PDC_CDECL wsetscrreg( WINDOW*, int, int );
1662 int PDC_CDECL wtimeout( WINDOW *, int );
1663 int PDC_CDECL wtouchln(WINDOW *, int, int, int);
1664 void PDC_CDECL wsyncdown(WINDOW*);
1665 void PDC_CDECL wsyncup(WINDOW*);
1666 int PDC_CDECL wvline( WINDOW*, chtype, int );
1667
1668 #ifdef PDCURSES
1669 int PDC_CDECL raw_output( bool );
1670 int PDC_CDECL resize_term( int, int );
1671 WINDOW* PDC_CDECL resize_window( WINDOW*, int, int );
1672 #endif
1673
1674 #ifdef OBSOLETE_OR_TBD
1675 char PDC_CDECL breakchar( /* void */ );
1676 int PDC_CDECL cursoff( /* void */ );
1677 int PDC_CDECL curson( /* void */ );
1678 int PDC_CDECL gettmode( /* void */ );
1679 int PDC_CDECL mvaddrawch( /* int, int, chtype */ );
1680 int PDC_CDECL mvaddrawstr( /* int, int, char* */ );
1681 int PDC_CDECL mvwinsrawch( /* WINDOW*, int, int, chtype */ );
1682 int PDC_CDECL mvinsrawch( /* int, int, chtype */ );
1683 int PDC_CDECL saveoldterm( /* void */ );
1684 int PDC_CDECL tabsize( /* int */ );
1685 int PDC_CDECL waddrawstr( /* WINDOW*, char* */ );
1686 int PDC_CDECL wtabsize( /* WINDOW*, int */ );
1687 int PDC_CDECL win_print( /* WINDOW*, int */ );
1688 #endif
1689
1690 #ifdef XCURSES
1691 void XCursesExit( void );
1692 int nocbreak( void );
1693 int cbreak( void );
1694 int nocrmode( void );
1695 int crmode( void );
1696 int noecho( void );
1697 int echo( void );
1698 int nodelay( WINDOW *,bool );
1699 #endif
1700
1701 int PDC_CDECL mouse_set( unsigned long );
1702 int PDC_CDECL mouse_on( unsigned long );
1703 int PDC_CDECL mouse_off( unsigned long );
1704 int PDC_CDECL request_mouse_pos( void );
1705 int PDC_CDECL map_button( unsigned long );
1706 void PDC_CDECL wmouse_position( WINDOW *, int *, int * );
1707 unsigned long PDC_CDECL getmouse( void );
1708 unsigned long PDC_CDECL getbmap( void );
1709
1710 /*
1711 * Keep the compiler happy with our macros below...
1712 */
1713 int PDC_CDECL PDC_chadd( WINDOW*, chtype, bool, bool );
1714 int PDC_CDECL PDC_chins( WINDOW*, chtype, bool );
1715 int PDC_CDECL PDC_ungetch( int );
1716
1717 void PDC_CDECL PDC_set_title( char * );
1718
1719 int PDC_CDECL PDC_getclipboard( char **, long * );
1720 int PDC_CDECL PDC_setclipboard( char *, long );
1721 int PDC_CDECL PDC_freeclipboard( char * );
1722 int PDC_CDECL PDC_clearclipboard( void );
1723
1724 unsigned long PDC_CDECL PDC_get_input_fd( void );
1725 int PDC_CDECL PDC_curs_set( int );
1726 unsigned long PDC_CDECL PDC_get_key_modifiers( void );
1727
1728 int PDC_CDECL PDC_wunderline( WINDOW*, int, bool );
1729 int PDC_CDECL PDC_wleftline( WINDOW*, int, bool );
1730 int PDC_CDECL PDC_wrightline( WINDOW*, int, bool );
1731 int PDC_CDECL PDC_set_line_color( short );
1732
1733 #else
1734
1735 int PDC_CDECL addchnstr( /* chtype *, int */ );
1736 int PDC_CDECL baudrate( /* void */ );
1737 int PDC_CDECL beep( /* void */ );
1738 int PDC_CDECL border( /* chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype */ );
1739 int PDC_CDECL can_change_color ( /* void */ );
1740 int PDC_CDECL clearok( /* WINDOW*, bool */ );
1741 int PDC_CDECL color_content( /* int, short*, short*, short* */ );
1742 int PDC_CDECL copywin( /* WINDOW*, WINDOW*, int, int, int, int, int, int, int */ );
1743 int PDC_CDECL curs_set( /* int */ );
1744 int PDC_CDECL def_prog_mode( /* void */ );
1745 int PDC_CDECL def_shell_mode( /* void */ );
1746 int PDC_CDECL delay_output( /* int */ );
1747 int PDC_CDECL delwin( /* WINDOW* */ );
1748 WINDOW* PDC_CDECL derwin( /* WINDOW*, int, int, int, int */ );
1749 int PDC_CDECL doupdate( /* void */ );
1750 WINDOW* PDC_CDECL dupwin( /* WINDOW* */ );
1751 int PDC_CDECL endwin( /* void */ );
1752 int PDC_CDECL erase( /* void */ );
1753 char PDC_CDECL erasechar( /* void */ );
1754 int PDC_CDECL flash( /* void */ );
1755 int PDC_CDECL flushinp( /* void */ );
1756 int PDC_CDECL getsyx( /* int*, int* */ );
1757 int PDC_CDECL halfdelay( /* int */ );
1758 bool PDC_CDECL has_colors( /* void */ );
1759 int PDC_CDECL hline( /* chtype, int */ );
1760 int PDC_CDECL immedok( /* WINDOW*, bool */ );
1761 int PDC_CDECL inchnstr( /* chtype *, int */ );
1762 int PDC_CDECL init_color( /* short, short, short, short */ );
1763 int PDC_CDECL init_pair( /* short, short, short */ );
1764 WINDOW* PDC_CDECL initscr( /* void */ );
1765 #ifdef XCURSES
1766 WINDOW* PDC_CDECL Xinitscr( /* int, char ** */ );
1767 #endif
1768 int PDC_CDECL intrflush( /* WINDOW*, bool */ );
1769 int PDC_CDECL is_linetouched( /*WINDOW *,int*/ );
1770 int PDC_CDECL is_wintouched( /*WINDOW **/ );
1771 char* PDC_CDECL keyname( /* int */ );
1772 char PDC_CDECL killchar( /* void */ );
1773 char* PDC_CDECL longname( /* void */ );
1774 int PDC_CDECL meta( /* WINDOW*, bool */ );
1775 int PDC_CDECL mvcur( /* int, int, int, int */ );
1776 int PDC_CDECL mvderwin( /* WINDOW*, int, int */ );
1777 int PDC_CDECL mvprintw( /* int, int, char*,... */ );
1778 int PDC_CDECL mvscanw( /* int, int, char*,... */ );
1779 int PDC_CDECL mvwaddnstr(/* WINDOW*,int,int,char*,int */ );
1780 int PDC_CDECL mvwin( /* WINDOW*, int, int */ );
1781 int PDC_CDECL mvwinsertln( /* WINDOW*, int, int */ );
1782 int PDC_CDECL mvwprintw( /* WINDOW*, int, int, char*,... */ );
1783 int PDC_CDECL mvwscanw( /* WINDOW*, int, int, char*,... */ );
1784 WINDOW* PDC_CDECL newpad( /* int, int */ );
1785 SCREEN* PDC_CDECL newterm( /* char*, FILE*, FILE* */ );
1786 WINDOW* PDC_CDECL newwin( /* int, int, int, int */ );
1787 int PDC_CDECL noraw( /* void */ );
1788 int PDC_CDECL notimeout( /* WINDOW *, bool */ );
1789 int PDC_CDECL overlay( /* WINDOW*, WINDOW* */ );
1790 int PDC_CDECL overwrite( /* WINDOW*, WINDOW* */ );
1791 int PDC_CDECL pair_content( /* int, short*, short* */ );
1792 int PDC_CDECL pechochar( /* WINDOW *pad, chtype ch */ );
1793 int PDC_CDECL pnoutrefresh( /* WINDOW*, int, int, int, int, int, int */ );
1794 int PDC_CDECL prefresh( /* WINDOW*, int, int, int, int, int, int */ );
1795 int PDC_CDECL printw( /* char*,... */ );
1796 int PDC_CDECL raw( /* void */ );
1797 int PDC_CDECL refresh( /* void */ );
1798 int PDC_CDECL reset_prog_mode( /* void */ );
1799 int PDC_CDECL reset_shell_mode( /* void */ );
1800 int PDC_CDECL resetty( /* void */ );
1801 int PDC_CDECL ripoffline( /* int, int (*)(WINDOW *, int) */);
1802 int PDC_CDECL savetty( /* void */ );
1803 int PDC_CDECL sb_init( /* void */ );
1804 int PDC_CDECL sb_set_horz( /* int, int, int */ );
1805 int PDC_CDECL sb_set_vert( /* int, int, int */ );
1806 int PDC_CDECL sb_get_horz( /* int *, int *, int * */ );
1807 int PDC_CDECL sb_get_vert( /* int *, int *, int * */ );
1808 int PDC_CDECL sb_refresh( /* void */ );
1809 int PDC_CDECL scanw( /* char*,... */ );
1810 int PDC_CDECL scroll( /* WINDOW* */ );
1811 int PDC_CDECL setsyx( /* int, int */ );
1812 SCREEN* PDC_CDECL set_term( /* SCREEN* */ );
1813 int PDC_CDECL slk_init(/* int */);
1814 int PDC_CDECL slk_set(/* int, char *, int */);
1815 int PDC_CDECL slk_refresh(/* void */);
1816 int PDC_CDECL slk_noutrefresh(/* void */);
1817 char* PDC_CDECL slk_label(/* int */);
1818 int PDC_CDECL slk_clear(/* void */);
1819 int PDC_CDECL slk_restore(/* void */);
1820 int PDC_CDECL slk_touch(/* void */);
1821 int PDC_CDECL slk_attron(/* attr_t */);
1822 int PDC_CDECL slk_attrset(/* attr_t */);
1823 int PDC_CDECL slk_attroff(/* attr_t */);
1824 int PDC_CDECL start_color( /* void */ );
1825 WINDOW* PDC_CDECL subpad( /* WINDOW*, int, int, int, int */ );
1826 WINDOW* PDC_CDECL subwin( /* WINDOW*, int, int, int, int */ );
1827 int PDC_CDECL syncok(/* WINDOW*, bool */);
1828 attr_t PDC_CDECL termattrs( /* void */ );
1829 char* PDC_CDECL termname( /* void */ );
1830 int PDC_CDECL touchline( /* WINDOW*, int ,int */ );
1831 int PDC_CDECL touchwin( /* WINDOW* */ );
1832 #if !defined (CURSES_LIBRARY)
1833 void PDC_CDECL traceoff(/* void */);
1834 void PDC_CDECL traceon(/* void */);
1835 #endif
1836 int PDC_CDECL typeahead( /* int */ );
1837 char* PDC_CDECL unctrl( /* chtype */ );
1838 int PDC_CDECL vline( /* chtype, int */ );
1839 int PDC_CDECL waddchnstr( /* WINDOW*, chtype*, int */ );
1840 int PDC_CDECL waddnstr( /* WINDOW*, char*, int */ );
1841 int PDC_CDECL waddstr( /* WINDOW*, char* */ );
1842 int PDC_CDECL wattroff( /* WINDOW*, attr_t */ );
1843 int PDC_CDECL wattron( /* WINDOW*, attr_t */ );
1844 int PDC_CDECL wattrset( /* WINDOW*, attr_t */ );
1845 int PDC_CDECL wbkgd( /*WINDOW*, chtype*/ );
1846 void PDC_CDECL wbkgdset( /*WINDOW*, chtype*/ );
1847 int PDC_CDECL wborder( /* WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype */ );
1848 int PDC_CDECL wclear( /* WINDOW* */ );
1849 int PDC_CDECL wclrtobot( /* WINDOW* */ );
1850 int PDC_CDECL wclrtoeol( /* WINDOW* */ );
1851 void PDC_CDECL wcursyncup(/* WINDOW* */);
1852 int PDC_CDECL wdelch( /* WINDOW* */ );
1853 int PDC_CDECL wdeleteln( /* WINDOW* */ );
1854 int PDC_CDECL werase( /* WINDOW* */ );
1855 int PDC_CDECL wgetch( /* WINDOW* */ );
1856 int PDC_CDECL wgetnstr( /* WINDOW*, char*, int */ );
1857 int PDC_CDECL wgetstr( /* WINDOW*, char* */ );
1858 int PDC_CDECL whline( /* WINDOW*, chtype, int */ );
1859 int PDC_CDECL winchnstr( /* WINDOW*, chtype*, int */ );
1860 int PDC_CDECL winnstr( /* WINDOW*, char*, int */ );
1861 int PDC_CDECL winsch( /* WINDOW*, chtype */ );
1862 int PDC_CDECL winsdelln( /* WINDOW*, int */ );
1863 int PDC_CDECL winsertln( /* WINDOW* */ );
1864 int PDC_CDECL winsnstr( /* WINDOW*, char*, int */ );
1865 int PDC_CDECL wmove( /* WINDOW*, int, int */ );
1866 int PDC_CDECL wnoutrefresh( /* WINDOW* */ );
1867 char PDC_CDECL wordchar( /* void */ );
1868 int PDC_CDECL wprintw( /* WINDOW*, char*,... */ );
1869 int PDC_CDECL wredrawln( /* WINDOW*, int ,int */ );
1870 int PDC_CDECL wrefresh( /* WINDOW* */ );
1871 int PDC_CDECL wscanw( /* WINDOW*, char*,... */ );
1872 int PDC_CDECL wscrl( /* WINDOW*, int */ );
1873 int PDC_CDECL wsetscrreg( /* WINDOW*, int, int */ );
1874 int PDC_CDECL wtimeout( /* WINDOW *, int */ );
1875 int PDC_CDECL wtouchln( /*WINDOW *, int, int, int*/ );
1876 void PDC_CDECL wsyncdown(/* WINDOW* */);
1877 void PDC_CDECL wsyncup(/* WINDOW* */);
1878 int PDC_CDECL wvline( /* WINDOW*, chtype, int */ );
1879
1880 #ifdef PDCURSES
1881 int PDC_CDECL raw_output( /* bool */ );
1882 int PDC_CDECL resize_term( /* int, int */ );
1883 WINDOW* PDC_CDECL resize_window( /* WINDOW*, int, int */ );
1884 #endif
1885
1886 #ifdef OBSOLETE_OR_TBD
1887 char PDC_CDECL breakchar( /* void */ );
1888 int PDC_CDECL cursoff( /* void */ );
1889 int PDC_CDECL curson( /* void */ );
1890 int PDC_CDECL gettmode( /* void */ );
1891 int PDC_CDECL mvaddrawch( /* int, int, chtype */ );
1892 int PDC_CDECL mvaddrawstr( /* int, int, char* */ );
1893 int PDC_CDECL mvwinsrawch( /* WINDOW*, int, int, chtype */ );
1894 int PDC_CDECL mvinsrawch( /* int, int, chtype */ );
1895 int PDC_CDECL saveoldterm( /* void */ );
1896 int PDC_CDECL tabsize( /* int */ );
1897 int PDC_CDECL waddrawstr( /* WINDOW*, char* */ );
1898 int PDC_CDECL wtabsize( /* WINDOW*, int */ );
1899 int PDC_CDECL win_print( /* WINDOW*, int */ );
1900 #endif
1901
1902 #ifdef XCURSES
1903 void XCursesExit(/* void */);
1904 int nocbreak( /* void */ );
1905 int cbreak( /* void */ );
1906 int nocrmode( /* void */ );
1907 int crmode( /* void */ );
1908 int noecho( /* void */ );
1909 int echo( /* void */ );
1910 int nodelay( /* WINDOW *,bool */ );
1911 #endif
1912
1913 int PDC_CDECL mouse_set( /* long */ );
1914 int PDC_CDECL mouse_on( /* long */ );
1915 int PDC_CDECL mouse_off( /* long */ );
1916 int PDC_CDECL request_mouse_pos( /* void */ );
1917 int PDC_CDECL map_button( /* unsigned long */ );
1918 void PDC_CDECL wmouse_position( /* WINDOW *, int *, int * */ );
1919 unsigned long PDC_CDECL getmouse( /* void */ );
1920 unsigned long PDC_CDECL getbmap( /* void */ );
1921
1922 /*
1923 * Keep the compiler happy with our macros below...
1924 */
1925 int PDC_CDECL PDC_chadd( /* WINDOW*, chtype, bool, bool */ );
1926 int PDC_CDECL PDC_chins( /* WINDOW*, chtype, bool */ );
1927 int PDC_CDECL PDC_ungetch( /* int */ );
1928
1929 void PDC_CDECL PDC_set_title( /* char * */ );
1930 int PDC_CDECL PDC_getclipboard( /* char **, long * */ );
1931 int PDC_CDECL PDC_setclipboard( /* char *, long */ );
1932 int PDC_CDECL PDC_clearclipboard( /* void */ );
1933
1934 unsigned long PDC_CDECL PDC_get_input_fd( /* void */ );
1935 int PDC_CDECL PDC_curs_set( /* int */ );
1936 unsigned long PDC_CDECL PDC_get_key_modifiers( /* void */ );
1937
1938 int PDC_CDECL PDC_wunderline( /* WINDOW*, int, bool */ );
1939 int PDC_CDECL PDC_wleftline( /* WINDOW*, int, bool */ );
1940 int PDC_CDECL PDC_wrightline( /* WINDOW*, int, bool */ );
1941 int PDC_CDECL PDC_set_line_color( /* short */ );
1942
1943 #endif
1944
1945
1946 #ifndef max
1947 # define max(a,b) (((a) > (b)) ? (a) : (b))
1948 #endif
1949 #ifndef min
1950 # define min(a,b) (((a) < (b)) ? (a) : (b))
1951 #endif
1952
1953 /*
1954 * Functions defined as macros
1955 */
1956
1957 #define addch( c ) waddch( stdscr, c )
1958 #define addchstr( c ) addchnstr( c, -1 )
1959 #define addstr(str) waddstr( stdscr, str )
1960 #define addnstr(str, n) waddnstr( stdscr, str, n )
1961 #define attroff(attr) wattroff( stdscr, attr )
1962 #define attron(attr) wattron( stdscr, attr )
1963 #define attrset(attr) wattrset( stdscr, attr )
1964 #define bkgd(c) wbkgd(stdscr,c)
1965 #define bkgdset(c) wbkgdset(stdscr,c)
1966 #define border(ls,rs,ts,bs,tl,tr,bl,br) wborder(stdscr,ls,rs,ts,bs,tl,tr,bl,br)
1967 #define box( w, v, h ) wborder( w, v, v, h, h, 0, 0, 0, 0 )
1968 #define clear() wclear( stdscr )
1969 #define clrtobot() wclrtobot( stdscr )
1970 #define clrtoeol() wclrtoeol( stdscr )
1971 #define delch() wdelch( stdscr )
1972 #define deleteln() wdeleteln( stdscr )
1973 #define derwin(w,nl,nc,by,bx) subwin((w),(nl),(nc),(by+(w)->_begy),(bx+(w)->_begx))
1974 #define draino(ms) delay_output(ms)
1975 #define echochar(c) (addch((chtype)c)==ERR?ERR:refresh())
1976 #define erase() werase( stdscr )
1977 #define fixterm() reset_prog_mode()
1978 #define getbegx(w) (w)->_begx
1979 #define getbegy(w) (w)->_begy
1980 #define getbegyx(w,y,x) ( y = (w)->_begy, x = (w)->_begx )
1981 #define getbkgd(w) ((w)->_bkgd)
1982 #define getch() wgetch(stdscr)
1983 #define getmaxx(w) (w)->_maxx
1984 #define getmaxy(w) (w)->_maxy
1985 #define getmaxyx(w,y,x) ( y = (w)->_maxy, x = (w)->_maxx )
1986 #define getparx(w) (w)->_parx
1987 #define getpary(w) (w)->_pary
1988 #define getparyx(w,y,x) ( y = (w)->_pary, x = (w)->_parx )
1989 #define getstr(str) wgetstr( stdscr, str )
1990 #define getnstr(str,num) wgetnstr( stdscr, str, num )
1991 #define getsyx(y,x) { if( curscr->_leaveit) (y)=(x)=-1; else getyx(curscr,(y),(x)); }
1992 #define getyx(w,y,x) ( y = (w)->_cury, x = (w)->_curx )
1993 #define has_colors() ((SP->mono) ? FALSE : TRUE)
1994 #define idcok(w,flag) OK
1995 #define idlok(w,flag) OK
1996 #define inch() (stdscr->_y[stdscr->_cury][stdscr->_curx])
1997 #define inchstr( c ) inchnstr( c, stdscr->_maxx-stdscr->_curx )
1998 #define innstr(str,n) winnstr(stdscr,(str),(n))
1999 #define insch( c ) winsch( stdscr, c )
2000 #define insdelln(n) winsdelln(stdscr,n)
2001 #define insertln() winsertln( stdscr )
2002 #define insnstr(s,n) winsnstr(stdscr,s,n)
2003 #define insstr(s) winsnstr(stdscr,s,(-1))
2004 #define instr(str) winnstr(stdscr,(str),stdscr->_maxx)
2005 #define isendwin() ((SP->alive) ? FALSE : TRUE)
2006 #define is_termresized() (SP->resized)
2007 #define keypad(w,flag) (w->_use_keypad = flag, OK)
2008 #define leaveok(w,flag) (w->_leaveit = flag, OK)
2009 #define move(y,x) wmove( stdscr, y, x )
2010 #define mvaddch(y,x,c) (move( y, x )==ERR?ERR:addch( c ))
2011 #define mvaddchstr(y,x,c) (move( y, x )==ERR?ERR:addchnstr( c, -1 ))
2012 #define mvaddchnstr(y,x,c,n) (move( y, x )==ERR?ERR:addchnstr( c, n ))
2013 #define mvaddstr(y,x,str) (move( y, x )==ERR?ERR:addstr( str ))
2014 #define mvaddnstr(y,x,str,n) (move( y, x )==ERR?ERR:addnstr( str, n ))
2015 #define mvdelch(y,x) (move( y, x )==ERR?ERR:wdelch( stdscr ))
2016 #define mvgetch(y,x) (move( y, x )==ERR?ERR:wgetch(stdscr))
2017 #define mvgetstr(y,x,str) (move( y, x )==ERR?ERR:wgetstr( stdscr, str ))
2018 #define mvinch(y,x) (move( y, x )==ERR?ERR:(stdscr->_y[y][x]))
2019 #define mvinchstr(y,x,c) (move( y, x )==ERR?ERR:inchnstr( c, stdscr->_maxx-stdscr->_curx ))
2020 #define mvinchnstr(y,x,c,n) (move( y, x )==ERR?ERR:inchnstr( c, n ))
2021 #define mvinsch(y,x,c) (move( y, x )==ERR?ERR:winsch( stdscr, c ))
2022 #define mvinsnstr(y,x,s,n) (move( y, x )==ERR?ERR:winsnstr(stdscr,s,n))
2023 #define mvinsstr(y,x,s) (move( y, x )==ERR?ERR:winsnstr(stdscr,s,(-1)))
2024 #define mvinstr(y,x,str) (move( y, x )==ERR?ERR:winnstr(stdscr,(str),stdscr->_maxx))
2025 #define mvinnstr(y,x,str,n) (move( y, x )==ERR?ERR:winnstr(stdscr,(str),(n)))
2026 #define mvwaddch(w,y,x,c) (wmove( w, y, x )==ERR?ERR:waddch( w, c ))
2027 #define mvwaddchstr(w,y,x,c) (wmove( w, y, x )==ERR?ERR:waddchnstr( w, c, -1 ))
2028 #define mvwaddchnstr(w,y,x,c,n) (wmove( w, y, x )==ERR?ERR:waddchnstr( w, c, n ))
2029 #define mvwaddrawch(w,y,x,c) (wmove( w, y, x )==ERR?ERR:waddrawch( w, c ))
2030 #define mvwaddrawstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:waddrawstr( w, str ))
2031 #define mvwaddstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:waddstr( w, str ))
2032 #define mvwdelch(w,y,x) (wmove( w, y, x )==ERR?ERR:wdelch( w ))
2033 #define mvwgetch(w,y,x) (wmove( w, y, x )==ERR?ERR:wgetch( w ))
2034 #define mvwgetstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:wgetstr( w, str ))
2035 #define mvwinch(w,y,x) (wmove( w, y, x )==ERR?ERR:((w)->_y[y][x]))
2036 #define mvwinchstr(w,y,x,c) (wmove( w, y, x )==ERR?ERR:winchnstr( w, c, (w)->_maxx-(w)->_curx ))
2037 #define mvwinchnstr(w,y,x,c,n) (wmove( w, y, x )==ERR?ERR:winchnstr( w, c, n ))
2038 #define mvwinsch(w,y,x,c) (wmove( w, y, x )==ERR?ERR:winsch( w, c ))
2039 #define mvwinstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:winnstr(w,str,(w)->_maxx))
2040 #define mvwinnstr(w,y,x,str,n) (wmove( w, y, x )==ERR?ERR:winnstr(w,str,n))
2041 #define mvwinsnstr(w,y,x,s,n) (wmove( w, y, x )==ERR?ERR:winsnstr(w,s,n))
2042 #define mvwinsstr(w,y,x,s) (wmove( w, y, x )==ERR?ERR:winsnstr(w,s,(-1)))
2043 #define napms(ms) delay_output(ms)
2044 #define nl() (SP->autocr = TRUE)
2045 #define nonl() (SP->autocr = FALSE)
2046 #define redrawwin(w) wredrawln((w),0,(w)->_maxy)
2047 #define refresh() wrefresh( stdscr )
2048 #define resetterm() reset_shell_mode()
2049 #define saveterm() def_prog_mode()
2050 #define scrl(n) wscrl(stdscr,n)
2051 #define scroll(w) wscrl((w),1)
2052 #define scrollok(w,flag) ((w)->_scroll = flag)
2053 #define setscrreg(top, bot) wsetscrreg( stdscr, top, bot )
2054 #define setsyx(y,x) { if( (y)==-1 && (x)==-1) curscr->_leaveit=TRUE; else { curscr->_leaveit=FALSE;wmove(curscr,(y),(x));} }
2055 #define standend() wattrset(stdscr, A_NORMAL)
2056 #define standout() wattrset(stdscr, A_STANDOUT)
2057 #define timeout(n) wtimeout( stdscr, n )
2058 #define touchline(w,y,n) wtouchln((w),(y),(n),TRUE)
2059 #define touchwin(w) wtouchln((w),0,(w)->_maxy,TRUE)
2060 #if defined (CURSES_LIBRARY)
2061 # define traceoff() {trace_on = FALSE;}
2062 # define traceon() {trace_on = TRUE;}
2063 #endif
2064 #define ungetch(ch) PDC_ungetch(ch)
2065 #define untouchwin(w) wtouchln((w),0,((w)->_maxy),FALSE)
2066 #define waddch(w, c) PDC_chadd( w, (chtype)c, (bool)!(SP->raw_out), TRUE )
2067 #define waddchstr(w, c) (waddchnstr( w, c, -1 ))
2068 #define werase(w) (wmove((w),0,0), wclrtobot(w))
2069 #define wclear(w) ((w)->_clear = TRUE , werase(w))
2070 #define wechochar(w,c) (waddch(w,(chtype)c)==ERR?ERR:wrefresh(w))
2071 #define winch(w) ((w)->_y[(w)->_cury][(w)->_curx])
2072 #define winchstr(w, c) (winchnstr( w, c, (w)->_maxx-(w)->_curx ) )
2073 #define winsstr(w,str) winsnstr((w),(str),(-1))
2074 #define winstr(w,str) winnstr((w),str,(w)->_maxx)
2075 #define wstandend(w) wattrset(w, A_NORMAL)
2076 #define wstandout(w) wattrset(w, A_STANDOUT)
2077
2078 #if !defined(UNIX) && !defined(XCURSES)
2079 /* set delaytenths = 0 added - William McBrine */
2080 # define nocbreak() (SP->cbreak = FALSE, SP->delaytenths = 0)
2081 # define cbreak() (SP->cbreak = TRUE)
2082 # define nocrmode() (SP->cbreak = FALSE)
2083 # define crmode() (SP->cbreak = TRUE)
2084 # define noecho() (SP->echo = FALSE,OK)
2085 # define echo() (SP->echo = TRUE,OK)
2086 # define nodelay(w,flag) (w->_nodelay = flag)
2087 #endif
2088
2089 #if defined(PDCURSES)
2090 # define addrawch( c ) waddrawch( stdscr, c )
2091 # define addrawstr(str) waddrawstr( stdscr, str )
2092 # define insrawch( c ) winsrawch( stdscr, c )
2093 # define waddrawch(w, c) PDC_chadd( w, (chtype)c, FALSE, TRUE )
2094 # define winsrawch(w, c) PDC_chins( w, (chtype)c, FALSE )
2095 # define PDC_save_key_modifiers(flag) (SP->save_key_modifiers = flag)
2096 # define PDC_return_key_modifiers(flag) (SP->return_key_modifiers = flag)
2097
2098 /*
2099 * FYI: Need to document these functions...
2100 */
2101 # define title(s,a) wtitle( stdscr, s, (chtype)a )
2102 # define titleofs(ofs) wtitleofs( stdscr, ofs )
2103 # define wtitle(w,s,a) (w->_title = s, w->_title_attr = (chtype)a)
2104 # define wtitleofs(w,ofs) (w->_title_ofs = ofs)
2105 #endif
2106
2107 /*
2108 * return codes from PDC_getclipboard() and PDC_setclipboard() calls.
2109 */
2110 #define PDC_CLIP_SUCCESS 0
2111 #define PDC_CLIP_ACCESS_ERROR 1
2112 #define PDC_CLIP_EMPTY 2
2113 #define PDC_CLIP_MEMORY_ERROR 3
2114
2115 /*
2116 * PDCurses key modifier masks
2117 */
2118 #define PDC_KEY_MODIFIER_SHIFT (1 << 0)
2119 #define PDC_KEY_MODIFIER_CONTROL (1 << 1)
2120 #define PDC_KEY_MODIFIER_ALT (1 << 2)
2121 #define PDC_KEY_MODIFIER_NUMLOCK (1 << 3)
2122
2123 /*
2124 * Load up curspriv.h. This should be in the same place as
2125 * stdlib.h. We allow anyone who defines CURSES_LIBRARY to have
2126 * access to our internal routines. This provides quick
2127 * PC applications at the expense of portability.
2128 */
2129 #if defined(CURSES_LIBRARY)
2130 # include <curspriv.h>
2131 #endif
2132
2133 #include <stdlib.h>
2134
2135 #endif /* __PDCURSES__ */
2136
2137 #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
2138 # undef bool
2139 }
2140 #endif