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