|
|
1.1 root 1:
2:
3:
4: XTTY(3X) UNIX Programmer's Manual XTTY(3X)
5:
6:
7:
8: NAME
9: Xtty - routines to provide terminal emulator windows
10:
11: SYNOPSIS
12: #include <X/Xlib.h>
13: #include <X/Xtty.h>
14:
15: TTYWindow *CreateTTYWindow(cols, lines, x, y, normalFont,
16: boldFont, bwidth, reverse)
17: int cols, lines, x, y, bwidth, reverse;
18: char *normalFont, *boldFont;
19:
20: DestroyTTYWindow(t);
21: TTYWindow *t;
22:
23: TTYPutString(t, str);
24: TTYWindow *t;
25: char *str;
26:
27: TTYPutChar(t, ch);
28: TTYWindow *t;
29: char ch;
30:
31: TTYPrintf(t, format [ , arg ] ... )
32: TTYWindow *t;
33: char *format;
34:
35: char *TTYGetString(t, string, n)
36: TTYWindow *t;
37: char *string;
38: int n;
39:
40: int TTYGetChar(t)
41: TTYWindow *t;
42:
43: SetStdout(t)
44: TTYWindow *t;
45:
46: ResetStdout()
47:
48: DESCRIPTION
49: These functions allow applications to create terminal emula-
50: tor windows. The windows are managed by creating a subpro-
51: cess _x_t_e_r_m(_1) and communicating with it through a pty. The
52: _T_T_Y_W_i_n_d_o_w data structure is defined in <_X/_X_t_t_y._h>:
53:
54: typedef struct _TTYWindow {
55: Window w; /* The window id */
56: int pid; /* The pid of the subprocess xterm */
57: short file; /* The file id to read and write characters
58: characters to/from */
59: } TTYWindow;
60:
61:
62:
63: Printed 9/15/87 28 January 1985 1
64:
65:
66:
67:
68:
69:
70: XTTY(3X) UNIX Programmer's Manual XTTY(3X)
71:
72:
73:
74: _C_r_e_a_t_e_T_T_Y_W_i_n_d_o_w creates a window that is _c_o_l_s characters
75: wide and _l_i_n_e_s characters high. It is located with its
76: upper left hand corner located at the point _x, _y in the root
77: window. The border is _b_w_i_d_t_h pixels wide. Normal text is
78: displayed in _n_o_r_m_a_l_F_o_n_t and boldface text is displayed in
79: _b_o_l_d_F_o_n_t. If _b_o_l_d_F_o_n_t is NULL, the normal font is used for
80: both. If _r_e_v_e_r_s_e is non-zero, the window is created in
81: reverse-video.
82:
83: The new window is created and mapped to the screen, and emu-
84: lates a DEC VT102 terminal precisely as well as _x_t_e_r_m(_1)
85: does.
86:
87: _D_e_s_t_r_o_y_T_T_Y_W_i_n_d_o_w destroys the window described by its argu-
88: ment. The window is also destroyed if the creating process
89: terminates or is killed. See the BUGS section, below.
90:
91: _T_T_Y_P_u_t_S_t_r_i_n_g prints its string in its window. An applica-
92: tion may instead wish to use the _f_i_l_e field of the _T_T_Y_W_i_n_d_o_w
93: directly.
94:
95: _T_T_Y_P_u_t_C_h_a_r is similar to _T_e_x_t_P_u_t_S_t_r_i_n_g but only prints a
96: single character.
97:
98: _T_T_Y_P_r_i_n_t_f is similar to the standard function _p_r_i_n_t_f except
99: that it prints its result in the specified window. The
100: resulting string is passed to _T_T_Y_P_u_t_S_t_r_i_n_g. See also the
101: BUGS section, below.
102:
103: _T_T_Y_G_e_t_S_t_r_i_n_g fills the array _s_t_r_i_n_g with at most _n charac-
104: ters. _T_T_Y_G_e_t_S_t_r_i_n_g will also return before _n characters are
105: read if a newline (\n) is encountered. An application may
106: instead wish to use the _f_i_l_e field of the _T_T_Y_W_i_n_d_o_w
107: directly.
108:
109: _T_T_Y_G_e_t_C_h_a_r returns one character from the window.
110:
111: _S_e_t_S_t_d_o_u_t sets things up so that the standard I/O routines
112: which write to stdout will write to the window instead.
113: This is particularly useful with the _c_u_r_s_e_s(_3_X) package
114: since it always writes to stdout.
115:
116: _R_e_s_e_t_S_t_d_o_u_t resets stdout to its original value.
117:
118: SEE ALSO
119: printf(3S), xterm(1), Xtext(3X), curses(3X), X(8C)
120:
121: AUTHOR
122: Paul Asente, Stanford University
123:
124: BUGS
125: _T_T_Y_P_r_i_n_t_f truncates its output if the resulting string is
126:
127:
128:
129: Printed 9/15/87 28 January 1985 2
130:
131:
132:
133:
134:
135:
136: XTTY(3X) UNIX Programmer's Manual XTTY(3X)
137:
138:
139:
140: more than 2048 characters long.
141:
142: It is impossible to make one implementation that works
143: correctly for both monochrome and color displays since you
144: cannot specify colors on a monochrome display and reverse-
145: video doesn't make much sense on a color display. This ver-
146: sion works for monochrome displays.
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195: Printed 9/15/87 28 January 1985 3
196:
197:
198:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.