libDtSearch: Coverity 86579
[oweals/cde.git] / cde / lib / DtTerm / Term / TermBuffer.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* 
24 ** $XConsortium: TermBuffer.h /main/1 1996/04/21 19:15:26 drk $
25 */
26
27 /*                                                                      *
28  * (c) Copyright 1993, 1994 Hewlett-Packard Company                     *
29  * (c) Copyright 1993, 1994 International Business Machines Corp.       *
30  * (c) Copyright 1993, 1994 Sun Microsystems, Inc.                      *
31  * (c) Copyright 1993, 1994 Novell, Inc.                                *
32  */
33
34 #ifndef   _Dt_TermBuffer_h
35 #define   _Dt_TermBuffer_h
36 #include <TermPrimBuffer.h>
37
38 /*
39 ** Defines for video enhancements
40 */
41 #define BOLD         (1 << 5)
42 #define SECURE       (1 << 4)
43 #define HALF_BRIGHT  (1 << 3)
44 #define UNDERLINE    (1 << 2)
45 #define INVERSE      (1 << 1)
46 #define BLINK        (1 << 0)
47 #define VIDEO_MASK  (BOLD | SECURE | HALF_BRIGHT | UNDERLINE | INVERSE | BLINK)
48
49 #define IS_BOLD(flags)        ((flags) & BOLD)
50 #define IS_SECURE(flags)      ((flags) & SECURE)
51 #define IS_HALF_BRIGHT(flags) ((flags) & HALF_BRIGHT)
52 #define IS_UNDERLINE(flags)   ((flags) & UNDERLINE)
53 #define IS_INVERSE(flags)     ((flags) & INVERSE)
54 #define IS_BLINK(flags)       ((flags) & BLINK)
55
56 /*
57 ** Defines for field types
58 */
59 #define FIELD_UNPROTECT 0
60 #define FIELD_PROTECT   1
61 #define FIELD_TRANSMIT  2
62 #define FIELD_END       3
63 #define FIELD_MASK      3
64
65 #define COLOR_MASK      0x0F
66
67 /* 
68 ** Defines for font ID
69 */
70 #define FONT_NORMAL   0
71 #define FONT_LINEDRAW 1
72 #define FONT_MASK     1
73
74 typedef enum _dtEnhID
75 {
76     enhVideo = 0, enhField = 1, enhFont = 3, enhFgColor = 4, enhBgColor = 5
77 } dtEnhID;
78 #define NUM_ENHANCEMENT_FIELDS 6
79
80 /*
81 ** enumerate the different erase modes...
82 */
83 typedef enum _DtEraseMode
84 {
85     eraseFromCol0,      /* from col 0 to cursor                     */
86     eraseCharCount,     /* "count" characters from cursor           */
87     eraseLineCount,     /* "count" lines from cursor                */
88     eraseToEOL,         /* from cursor to end-of-line               */
89     eraseLine,          /* the entire line the cursor is on         */
90     eraseBuffer,        /* the entire buffer                        */
91     eraseFromRow0Col0,  /* from row 0, col 0 to the cursor          */
92     eraseToEOB          /* from the cursor to the end of the buffer */
93 } DtEraseMode;
94
95
96 /* 
97 ** This may be useful for debugging purposes.
98 */
99 #if (defined(DEBUG) | defined(__CODECENTER__))
100 typedef enum _videoFlags
101 {
102     b_i_h_u_s = 0x00, b_i_h_u_S = 0x01, b_i_h_U_s = 0x02, b_i_h_U_S = 0x03,
103     b_i_H_u_s = 0x04, b_i_H_u_S = 0x05, b_i_H_U_s = 0x06, b_i_H_U_S = 0x07,
104     b_I_h_u_s = 0x08, b_I_h_u_S = 0x09, b_I_h_U_s = 0x0A, b_I_h_U_S = 0x0B,
105     b_I_H_u_s = 0x0C, b_I_H_u_S = 0x0D, b_I_H_U_s = 0x0E, b_I_H_U_S = 0x0F,
106     B_i_h_u_s = 0x10, B_i_h_u_S = 0x11, B_i_h_U_s = 0x12, B_i_h_U_S = 0x13,
107     B_i_H_u_s = 0x14, B_i_H_u_S = 0x15, B_i_H_U_s = 0x16, B_i_H_U_S = 0x17,
108     B_I_h_u_s = 0x18, B_I_h_u_S = 0x19, B_I_h_U_s = 0x1A, B_I_h_U_S = 0x1B,
109     B_I_H_u_s = 0x1C, B_I_H_u_S = 0x1D, B_I_H_U_s = 0x1E, B_I_H_U_S = 0x1F,
110 } videoFlags;
111 #endif /* (defined(DEBUG) | defined(__CODECENTER__)) */
112
113
114 #ifdef     __cplusplus
115 extern "C" {
116 #endif  /* __cplusplus */
117
118 extern TermBuffer
119 _DtTermBufferCreateBuffer
120 (
121     const Widget  w,
122     const short   rows,
123     const short   cols,
124     const short   sizeOfBuffer,
125     const short   sizeOfLine,
126     const short   sizeOfEnh
127 );
128
129 extern void
130 _DtTermBufferFreeBuffer
131 (
132     const TermBuffer tb
133 );
134
135 /*
136 ** Delete enough characters from the specified line such that the 
137 ** width of the characters deleted equal or exceeds the desired
138 ** width.  The actual width deleted is returned in "width".
139 */
140 void
141 _DtTermBufferDelete
142 (
143     TermBuffer  tb,
144     short      *row,
145     short      *col,
146     short      *width
147 );
148
149 extern void
150 _DtTermBufferErase
151 (
152     TermBuffer  tb,
153     short       row,
154     short       col,
155     short       count,
156     DtEraseMode eraseSwitch
157 );
158
159 #ifdef  __cplusplus
160 } /* close scope of 'extern "C"'... */
161 #endif  /* __cplusplus */
162
163 #endif /* _Dt_TermBuffer_h */
164 /* DON'T ADD ANYTHING AFTER THIS #endif... */