|
|
1.1 root 1: .TH BTOC 3R
2: .XE "setjwin"
3: .XE "P->btoc"
4: .XE "P->ctob"
5: .SH NAME
6: btoc: setjwin, P->btoc, P->ctob \- specify rows and columns and default outline
7: .SH SYNOPSIS
8: \f3
9: #include <dmd.h>
10: .sp
11: void setjwin (cols, rows)
12: .br
13: int cols, rows;
14: .sp
15: Point (\(**P->btoc)(x, y, p)
16: .br
17: int x,y;
18: .br
19: struct Proc \(**p;
20: .sp
21: Point (\(**P->ctob)(x, y, p)
22: .br
23: int x,y;
24: .br
25: struct Proc \(**p;
26: .SH DESCRIPTION
27: The purpose of the \fIsetjwin\fR and \fIbtoc\fR functions is to report the
28: number of character rows and columns available in an application's window.
29: These routines are intended to be used by terminal emulator applications
30: executing in the 630 MTG.
31: If the application is running in a \fIlayers\fR
32: window, the character rows and columns information is sent to the host.
33: This information is then made available to application programs
34: running on the host through an \fIioctl\fR() call to the xt device driver
35: with the \fIrequest\fR argument of JWINSIZE.
36: The windowing utilities \fIjwin\fR program is a simple host application
37: which uses this facility to print rows and columns on its standard
38: output. Other host applications, such as the \fIvi\fR editor, also use this
39: facility to determine available rows and columns.
40: .P
41: The \fIsetjwin\fR function is called directly from an application
42: program when the application begins execution, either after being
43: downloaded or started from the application cache.
44: The parameters \fIcols\fR and \fIrows\fR correspond to character
45: columns and character rows respectively.
46: .P
47: \fIBtoc\fR is called indirectly by the 630 MTG system control
48: process whenever the application's window is reshaped.
49: .I P->btoc
50: is a pointer stored in the
51: application's process table.
52: The application's process table is simply a structure
53: of type \fIProc\fR that contains system information
54: about the application program
55: and is maintained and used by the 630 MTG's system processes.
56: .I P->btoc
57: points to a function named, for example, \fIbits_to_char\fR(),
58: which returns a
59: .I Point
60: structure.
61: The function \fIbits_to_char\fR() must be specified in
62: the application program and the
63: .I P->btoc
64: pointer must be set
65: in the application's initialization routine to point to these functions.
66: The \fIbits_to_char\fR() function will then
67: be called by the 630 MTG's system control process whenever the application's
68: window is reshaped.
69: .P
70: The parameters passed to the \fIbtoc\fR() function are:
71: .RS 3
72: \f3x\f1 = the width of the application's window in pixels
73: .br
74: \f3y\f1 = the height of the application's window in pixels
75: .br
76: \f3p\f1 = a pointer to the application's process table.
77: .RE
78: .PP
79: The two integers x and y (returned in
80: the \fIPoint\fR structure) are the character rows and columns, respectively.
81: .P
82: \fISetjwin\fR and the \fIbtoc\fR() functions serve similar
83: purposes, but both functions are necessary for the following reasons.
84: \fISetjwin\fR
85: is used to inform the host of character rows and columns when an application
86: boots. The \fIbtoc\fR() function cannot be used in this situation
87: because the application has not yet executed, and therefore \fIP->btoc\fR
88: has not been initialized.
89: On the other hand, the \fIbtoc\fR() function is used to
90: inform the host of character rows and columns when an application's window is
91: reshaped.
92: The 630 MTG system control process needs to send a message
93: specifying current window size to the
94: host xt driver when a window is reshaped, and it is not possible
95: to wait for the application to call \fIsetjwin\fR. This makes
96: the \fIbtoc\fR() function necessary.
97: .P
98: If an application does not use the \fIsetjwin\fR and \fIbtoc\fR
99: facilities, the host will be told the character row and
100: columns which would be available if Windowproc was running in
101: a window the size of the application's window.
102: .P
103: The purpose of a \fIctob\fR() function is to specify a default outline
104: for a window being reshaped based on the \fIHost\fR
105: default rows and columns settings
106: specified during the 630 MTG \fISetup\fR procedure. See the
107: \fI630 MTG Terminal User's Guide\fR
108: for more information about \fISetup\fR and \fIHost\fR
109: default rows and columns settings.
110: .P
111: Initialization of \fIP->ctob\fR is identical to initialization of
112: \fIP->btoc\fR as described above. \fIP->ctob\fR is set to point
113: to a function named, for example, \fIchar_to_bits\fR().
114: The \fIchar_to_bits\fR() function is called by the 630 MTG
115: system control process before an application's
116: window is reshaped to determine the default window outline to
117: display for the application during the reshape procedure.
118: .P
119: The parameters passed to \fIctob\fR() are, in order,
120: x and y (the \fIHost\fR default
121: rows and columns, respectively), specified for a window in
122: \fISetup\fR; and \fIp\fR, a pointer
123: to the application's process table. The two integers x and y (returned
124: by \fIctob\fR() in
125: the \fIPoint\fR structure) are the width and height, respectively, in pixels,
126: of the window outline to be displayed.
127: .P
128: Note that \fIctob\fR
129: could disregard the parameters x and y and always return a predetermined
130: outline. This is commonly done by non-terminal emulator applications
131: that want to display a default outline which is not necessarily based upon
132: \fISetup\fR options.
133: .P
134: If a \fIctob\fR function is not specified,
135: a sweep cursor will appear without a default outline when
136: the application program is reshaped.
137: .P
138: The cache(3L) function calls \fIctob\fR to determine the default outline
139: for applications which are invoked from the \fBMore\fR menu.
140: .SH EXAMPLE
141: A simple example of a \fIbits_to_char\fR() and a \fIchar_to_bits\fR() function
142: is shown below.
143: .P
144: .RS 3
145: .nf
146: .ft CM
147:
148: #include <dmd.h>
149: #include <font.h>
150:
151: Point bits_to_char();
152: Point char_to_bits();
153:
154: main()
155: {
156: .
157: .
158:
159: P->btoc = bits_to_char;
160: P->ctob = char_to_bits;
161:
162: .
163: .
164: }
165:
166: Point
167: bits_to_char(x,y,p)
168: int x,y;
169: struct Proc *p;
170: {
171: Point q;
172:
173: /* INSET is a constant equal to the pixel width of */
174: /* the 630 window border. It is defined in dmdproc.h. */
175: /* Dmdproc.h is included by dmd.h. */
176: q.x = (x - 2*INSET) / FONTWIDTH(largefont);
177: q.y = (y - 2*INSET) / FONTHEIGHT(largefont);
178: return q;
179: }
180:
181: Point
182: char_to_bits(x,y,p)
183: int x,y;
184: struct Proc *p;
185: {
186: Point q;
187:
188: q.x = FONTWIDTH(largefont) * x + 2*INSET;
189: q.y = FONTHEIGHT(largefont) * y + 2*INSET;
190: return q;
191: }
192:
193: .RE
194: .fi
195: .ft R
196: .SH SEE ALSO
197: cache(3L), globals (3R), structures(3R).
198: .br
199: \fI630 MTG Terminal User's Guide\fR.
200: .br
201: jwin(1), vi(1) in the \f2UNIX System V Release 3 User's Reference Manual\f1.
202: .br
203: ioctl(2) in the \f2UNIX System V Programmer Reference Manual\f1.
204: .br
205: xt(7) in the \f2UNIX System V Release 3 System Administrator's Reference Manual\f1.
206: .SH WARNINGS
207: Since \fIbtoc\fR() and \fIctob\fR() are called
208: from the terminal's control process,
209: the variable \fIP\fR should not be referenced within these routines.
210: Instead, the parameter \fIp\fR should be used to reference the application's
211: process table.
212: .P
213: The two integers x and y returned by ctob in the point
214: structure must be less than or equal to XMAX and YMAX,
215: respectively.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.