|
1 /* Public Domain Curses */ |
|
2 |
|
3 #include <curspriv.h> |
|
4 |
|
5 RCSID("$Id: termattr.c,v 1.54 2008/07/13 16:08:18 wmcbrine Exp $") |
|
6 |
|
7 /*man-start************************************************************** |
|
8 |
|
9 Name: termattr |
|
10 |
|
11 Synopsis: |
|
12 int baudrate(void); |
|
13 char erasechar(void); |
|
14 bool has_ic(void); |
|
15 bool has_il(void); |
|
16 char killchar(void); |
|
17 char *longname(void); |
|
18 chtype termattrs(void); |
|
19 attr_t term_attrs(void); |
|
20 char *termname(void); |
|
21 |
|
22 int erasewchar(wchar_t *ch); |
|
23 int killwchar(wchar_t *ch); |
|
24 |
|
25 char wordchar(void); |
|
26 |
|
27 Description: |
|
28 baudrate() is supposed to return the output speed of the |
|
29 terminal. In PDCurses, it simply returns INT_MAX. |
|
30 |
|
31 has_ic and has_il() return TRUE. These functions have meaning in |
|
32 some other implementations of curses. |
|
33 |
|
34 erasechar() and killchar() return ^H and ^U, respectively -- the |
|
35 ERASE and KILL characters. In other curses implementations, |
|
36 these may vary by terminal type. erasewchar() and killwchar() |
|
37 are the wide-character versions; they take a pointer to a |
|
38 location in which to store the character, and return OK or ERR. |
|
39 |
|
40 longname() returns a pointer to a static area containing a |
|
41 verbose description of the current terminal. The maximum length |
|
42 of the string is 128 characters. It is defined only after the |
|
43 call to initscr() or newterm(). |
|
44 |
|
45 termname() returns a pointer to a static area containing a |
|
46 short description of the current terminal (14 characters). |
|
47 |
|
48 termattrs() returns a logical OR of all video attributes |
|
49 supported by the terminal. |
|
50 |
|
51 wordchar() is a PDCurses extension of the concept behind the |
|
52 functions erasechar() and killchar(), returning the "delete |
|
53 word" character, ^W. |
|
54 |
|
55 Portability X/Open BSD SYS V |
|
56 baudrate Y Y Y |
|
57 erasechar Y Y Y |
|
58 has_ic Y Y Y |
|
59 has_il Y Y Y |
|
60 killchar Y Y Y |
|
61 longname Y Y Y |
|
62 termattrs Y Y Y |
|
63 termname Y Y Y |
|
64 erasewchar Y |
|
65 killwchar Y |
|
66 term_attrs Y |
|
67 wordchar - - - |
|
68 |
|
69 **man-end****************************************************************/ |
|
70 |
|
71 #include <string.h> |
|
72 #include <limits.h> |
|
73 |
|
74 int baudrate(void) |
|
75 { |
|
76 PDC_LOG(("baudrate() - called\n")); |
|
77 |
|
78 return INT_MAX; |
|
79 } |
|
80 |
|
81 char erasechar(void) |
|
82 { |
|
83 PDC_LOG(("erasechar() - called\n")); |
|
84 |
|
85 return _ECHAR; /* character delete char (^H) */ |
|
86 } |
|
87 |
|
88 bool has_ic(void) |
|
89 { |
|
90 PDC_LOG(("has_ic() - called\n")); |
|
91 |
|
92 return TRUE; |
|
93 } |
|
94 |
|
95 bool has_il(void) |
|
96 { |
|
97 PDC_LOG(("has_il() - called\n")); |
|
98 |
|
99 return TRUE; |
|
100 } |
|
101 |
|
102 char killchar(void) |
|
103 { |
|
104 PDC_LOG(("killchar() - called\n")); |
|
105 |
|
106 return _DLCHAR; /* line delete char (^U) */ |
|
107 } |
|
108 |
|
109 char *longname(void) |
|
110 { |
|
111 PDC_LOG(("longname() - called\n")); |
|
112 |
|
113 return ttytype + 9; /* skip "pdcurses|" */ |
|
114 } |
|
115 |
|
116 chtype termattrs(void) |
|
117 { |
|
118 chtype temp = A_BLINK | A_BOLD | A_INVIS | A_REVERSE | A_UNDERLINE; |
|
119 |
|
120 /* note: blink is bold background on some platforms */ |
|
121 |
|
122 PDC_LOG(("termattrs() - called\n")); |
|
123 |
|
124 if (!SP->mono) |
|
125 temp |= A_COLOR; |
|
126 |
|
127 return temp; |
|
128 } |
|
129 |
|
130 attr_t term_attrs(void) |
|
131 { |
|
132 PDC_LOG(("term_attrs() - called\n")); |
|
133 |
|
134 return WA_BLINK | WA_BOLD | WA_INVIS | WA_LEFT | WA_REVERSE | |
|
135 WA_RIGHT | WA_UNDERLINE; |
|
136 } |
|
137 |
|
138 char *termname(void) |
|
139 { |
|
140 PDC_LOG(("termname() - called\n")); |
|
141 |
|
142 return "pdcurses"; |
|
143 } |
|
144 |
|
145 char wordchar(void) |
|
146 { |
|
147 PDC_LOG(("wordchar() - called\n")); |
|
148 |
|
149 return _DWCHAR; /* word delete char */ |
|
150 } |
|
151 |
|
152 #ifdef PDC_WIDE |
|
153 int erasewchar(wchar_t *ch) |
|
154 { |
|
155 PDC_LOG(("erasewchar() - called\n")); |
|
156 |
|
157 if (!ch) |
|
158 return ERR; |
|
159 |
|
160 *ch = (wchar_t)_ECHAR; |
|
161 |
|
162 return OK; |
|
163 } |
|
164 |
|
165 int killwchar(wchar_t *ch) |
|
166 { |
|
167 PDC_LOG(("killwchar() - called\n")); |
|
168 |
|
169 if (!ch) |
|
170 return ERR; |
|
171 |
|
172 *ch = (wchar_t)_DLCHAR; |
|
173 |
|
174 return OK; |
|
175 } |
|
176 #endif |