Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 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$
22
*/
23
/*
24
*
25
*                          CURSPRIV.H
26
*
27
* Header file for definitions and declarations for the
28
* PDCurses package. These definitions should not be generally
29
* accessible to programmers, but are provided if the applications
30
* programmer decides to make the decision in favor of speed on a
31
* PC over portability.
32
*
33
* Revision History:
34
* Frotz 1.5Beta 900714  Added many levels of compiler support.
35
*                       Added mixed prototypes for all "internal" routines.
36
*                       Removed all assembly language.  Added EGA/VGA
37
*                       support.  Converted all #ifdef to #if in all
38
*                       modules except CURSES.H and CURSPRIV.H.
39
*                       Always include ASSERT.H.  Added support for an
40
*                       external malloc(), calloc() and free().
41
*                       Added support for FAST_VIDEO (direct-memory writes).
42
*                       Added various memory model support (for FAST_VIDEO).
43
*                       Added much of the December 1988 X/Open Curses
44
*                       specification.
45
* bl    1.3     881005  All modules lint-checked with MSC '-W3' and turbo'C'
46
*                       '-w -w-pro' switches.
47
* bl    1.2     881002  Support (by #ifdef UCMASM) for uppercase-only
48
*                       assembly routine names. If UCMASM if defined,
49
*                       all assembler names are #defined as upper case.
50
*                       Not needed if you do "MASM /MX. Also missing
51
*                       declaration of cursesscroll(). Fixes thanks to
52
*                       N.D. Pentcheff
53
* bl    1.1     880306  Add _chadd() for raw output routines.
54
* bl    1.0     870515  Release.
55
*
56
*/
57
 
58
#ifndef __CURSES_INTERNALS__
59
#define __CURSES_INTERNALS__
60
 
61
/* Always include... */
62
#include 
63
 
64
 
65
 
66
/*----------------------------------------------------------------------
67
*       MEMORY MODEL SUPPORT:
68
*
69
*       MODELS
70
*               TINY            cs,ds,ss all in 1 segment (not enough memory!)
71
*               SMALL           cs:1 segment,           ds:1 segment
72
*               MEDIUM          cs:many segments        ds:1 segment
73
*               COMPACT         cs:1 segment,           ds:many segments
74
*               LARGE           cs:many segments        ds:many segments
75
*               HUGE            cs:many segments        ds:segments > 64K
76
*/
77
#ifdef  __TINY__
78
#  define SMALL 1
79
#endif
80
#ifdef  __SMALL__
81
#  define SMALL 1
82
#endif
83
#ifdef  __MEDIUM__
84
#  define MEDIUM 1
85
#endif
86
#ifdef  __COMPACT__
87
#  define COMPACT 1
88
#endif
89
#ifdef  __LARGE__
90
#  define LARGE 1
91
#endif
92
#ifdef  __HUGE__
93
#  define HUGE 1
94
#endif
95
 
96
 
97
/*----------------------------------------------------------------------
98
*       OPERATING SYSTEM SUPPORT:
99
*
100
*               DOS             The one we all know and love:-}
101
*               OS/2            The new kid on the block.
102
*               FLEXOS          A Real-time, protected-mode OS from
103
*                               Digital Research, Inc.
104
*				(AKA, the 4680 from IBM...)
105
*/
106
 
107
/*----------------------------------------*/
108
 
109
 
110
/*----------------------------------------------------------------------
111
*       MALLOC DEBUGGING SUPPORT:
112
*
113
*       Set EMALLOC and EMALLOC_MAGIC in order to use your private
114
*       versions of malloc(), calloc(), and free().  This can help,
115
*       but not solve, your malloc problems when debugging...
116
*
117
*/
118
#ifndef	INTERNAL
119
#  define EMALLOC 0             /* Disable External Malloc	        */
120
#else
121
#  define EMALLOC 0             /* Enable/Disable External Malloc       */
122
#  define EMALLOC_MAGIC  0x0C0C /* Our magic indicator that we should   */
123
                                /* use our external malloc rather than  */
124
                                /* the runtime's malloc.                */
125
#endif
126
 
127
 
128
/*----------------------------------------------------------------------*/
129
/* window properties */
130
#define _SUBWIN         0x01    /* window is a subwindow            */
131
#define _ENDLINE        0x02    /* last winline is last screen line */
132
#define _FULLWIN        0x04    /* window fills screen              */
133
#define _SCROLLWIN      0x08    /* window lwr rgt is screen lwr rgt */
134
#define _PAD            0x10    /* X/Open Pad.                      */
135
#define _SUBPAD         0x20    /* X/Open subpad.                   */
136
 
137
 
138
 
139
 
140
/*----------------------------------------------------------------------*/
141
/* Miscellaneous */
142
#define _INBUFSIZ       512     /* size of terminal input buffer */
143
#define _NO_CHANGE      -1      /* flags line edge unchanged     */
144
 
145
 
146
 
147
 
148
/* @@@ THESE SHOULD BE INDIVIDUAL FUNCTIONS, NOT MACROS! */
149
#define _BCHAR          0x03    /* Break char	    (^C)         */
150
#define _ECHAR          0x08    /* Erase char	    (^H)         */
151
#define _DWCHAR         0x17    /* Delete Word char (^W)         */
152
#define _DLCHAR         0x15    /* Delete Line char (^U)         */
153
#define _GOCHAR         0x11    /* ^Q character                  */
154
#define _PRINTCHAR      0x10    /* ^P character                  */
155
#define _STOPCHAR       0x13    /* ^S character                  */
156
#define  NUNGETCH       20      /* max # chars to ungetch()      */
157
 
158
 
159
 
160
 
161
/* Setmode stuff */
162
struct cttyset
163
{
164
	bool	been_set;
165
	SCREEN	saved;
166
};
167
 
168
extern struct cttyset c_sh_tty;         /* tty modes for shell_mode */
169
extern struct cttyset c_pr_tty;         /* tty modes for prog_mode  */
170
extern struct cttyset c_save_tty;
171
extern struct cttyset c_save_trm;
172
 
173
/* Printscan stuff */
174
extern char c_printscanbuf[];           /* buffer used during I/O */
175
 
176
/* tracing flag */
177
extern bool trace_on;
178
 
179
/* Strget stuff */
180
extern char*    c_strbeg;
181
 
182
/* doupdate stuff */
183
extern WINDOW*  twin;                   /* used by many routines */
184
 
185
/* Monitor (terminal) type information */
186
#define _NONE           0x00
187
#define _MDA            0x01
188
#define _CGA            0x02
189
#define _EGACOLOR       0x04
190
#define _EGAMONO        0x05
191
#define _VGACOLOR       0x07
192
#define _VGAMONO        0x08
193
#define _MCGACOLOR      0x0a
194
#define _MCGAMONO       0x0b
195
#define _FLEXOS         0x20            /* A Flexos console */
196
#define _MDS_GENIUS     0x30
197
#define _UNIX_COLOR     0x40
198
#define _UNIX_MONO      0x41
199
 
200
/* Text-mode font size information */
201
#define _FONT8  8
202
#define _FONT14 14
203
#define _FONT15 15              /* GENIUS */
204
#define _FONT16 16
205
 
206
 
207
/*----------------------------------------------------------------------
208
*       ANSI C prototypes.  Be sure that your compiler conditional
209
*       compilation definitions above define ANSI to be non-zero
210
*       if you compiler supports prototypes.
211
*/
212
#ifdef     ANSI
213
#  ifdef  CPLUSPLUS
214
     extern "C" {
215
#  endif
216
int             PDC_backchar( WINDOW*, char*, int* );
217
bool            PDC_breakout( void );
218
int             PDC_chadd( WINDOW*, chtype, bool, bool );
219
bool            PDC_check_bios_key( void );
220
int             PDC_chg_attr( WINDOW*, chtype, int, int, int, int );
221
int             PDC_chins( WINDOW*, chtype, bool );
222
int             PDC_clr_scrn( WINDOW* );
223
int             PDC_clr_update( WINDOW* );
224
int             PDC_copy_win( WINDOW *,WINDOW *,int,int,int,int,int,int,int,int,bool );
225
int             PDC_cursor_off( void );
226
int             PDC_cursor_on( void );
227
int             PDC_fix_cursor( int );
228
int             PDC_gattr( void );
229
int             PDC_get_bios_key( void );
230
int             PDC_get_columns( void );
231
bool            PDC_get_ctrl_break( void );
232
int             PDC_get_cur_col( void );
233
int             PDC_get_cur_row( void );
234
int             PDC_get_cursor_pos( int*, int* );
235
int             PDC_get_cursor_mode( void );
236
int             PDC_get_font( void );
237
int             PDC_get_rows( void );
238
int             PDC_gotoxy( int, int );
239
int             PDC_init_atrtab(void);
240
WINDOW*         PDC_makenew( int, int, int, int );
241
int             PDC_newline( WINDOW*, int );
242
int             PDC_print( int, int, int );
243
int             PDC_putc( chtype, chtype );
244
int             PDC_putchar( chtype );
245
int             PDC_putctty( chtype, chtype );
246
int             PDC_rawgetch( void );
247
int             PDC_sanity_check( int );
248
int             PDC_scr_close( void );
249
int             PDC_scr_open( SCREEN*, bool );
250
int             PDC_scroll( int, int, int, int, int, chtype );
251
int             PDC_set_80x25( void );
252
int             PDC_set_ctrl_break( bool );
253
int             PDC_set_cursor_mode( int, int );
254
int             PDC_set_font( int );
255
int             PDC_set_rows( int );
256
int             PDC_split_plane( WINDOW*, char*, char*, int, int, int, int );
257
int             PDC_sysgetch( void );
258
bool            PDC_transform_line( int );
259
void            PDC_usleep( long );
260
int             PDC_validchar( int );
261
 
262
#if defined( OS2 ) && !defined( EMXVIDEO )
263
VIOCONFIGINFO   PDC_query_adapter_type( void );
264
VIOMODEINFO     PDC_get_scrn_mode( void );
265
int             PDC_set_scrn_mode( VIOMODEINFO );
266
bool            PDC_scrn_modes_equal (VIOMODEINFO, VIOMODEINFO);
267
#else
268
int             PDC_query_adapter_type( void );
269
int             PDC_get_scrn_mode( void );
270
int             PDC_set_scrn_mode( int );
271
bool            PDC_scrn_modes_equal (int, int);
272
#endif
273
 
274
#ifdef  FLEXOS
275
int             PDC_flexos_8bitmode( void );
276
int             PDC_flexos_16bitmode( void );
277
char*           PDC_flexos_gname( void );
278
#endif
279
 
280
#ifdef UNIX
281
int             PDC_kbhit(void);
282
int             PDC_setup_keys(void);
283
#endif
284
 
285
#if defined (XCURSES)
286
int            XCurses_redraw_curscr(void);
287
int            XCurses_display_cursor(int,int ,chtype ,int ,int ,chtype );
288
int            XCurses_rawgetch(void);
289
bool           XCurses_kbhit(void);
290
int            XCurses_instruct(int);
291
int            XCurses_transform_line(long *, int , int , int );
292
int            Xinitscr(void);
293
int            Xendwin(void);
294
#endif
295
 
296
#ifdef PDCDEBUG
297
void            PDC_debug( char*,... );
298
#endif
299
 
300
#ifdef  REGISTERWINDOWS
301
bool            PDC_inswin( WINDOW*, WINDOW* );
302
int             PDC_addtail( WINDOW* );
303
int             PDC_addwin( WINDOW*, WINDOW* );
304
int             PDC_rmwin( WINDOW* );
305
WINDS*          PDC_findwin( WINDOW* );
306
#endif
307
#  ifdef  CPLUSPLUS
308
     }
309
#  endif
310
#endif
311
 
312
#define PDC_COLOR_PAIRS  64
313
#define PDC_OFFSET        8
314
#define MAX_ATRTAB      272
315
#define chtype_attr(ch)  ((atrtab[((ch >> 8) & 0xFF)] << 8) & A_ATTRIBUTES)
316
 
317
#include
318
#include
319
 
320
#endif /* __CURSES_INTERNALS__*/